Question
In C Programming language please 2 Project Description Thirty One, or Scat, is a card game for 2 or more people and isplayed with a
In C Programming language please
2 Project Description
Thirty One, or Scat, is a card game for 2 or more people and isplayed with a standard 52 playing card deck. In Thirty One, Acesare worth 11 points, face cards are worth 10 points, and numberedcards are worth their face value. The objective of the game is tohave a hand equal to or as close to 31 as possible. We will playthe game with just two players, Alice and Bob.
2.1 Game Rules
Each player begins with a $100.
Alice and Bob alternate in becoming dealers. The dealer shufflesthe deck and passes out three cards
to each player.
The game proceeds in rounds. On each round, the player initiateshis/her turn by placing a bet. Other players choose to meet thatbet or raise to a higher bet one time. Each player must meet thehighest bet to stay in the game, otherwise they fold their hand andtheir right to win the pot.
After betting, the player who plays first chooses to either picka card from the card stock pile or the top card from the discardpile. Then, the player must discard one of their cards, all in anattempt to get a hand as close or equal to 31. Only cards ofthe same suit count as points. For example, if Alice has anAce of Spades, an 8 of Spades, and a King of Hearts, her hand isworth 19.
A hand with three cards with the same value but different suitsis worth 30 points. E.g., a two of clubs, a two of spades, and atwo of hearts is worth 30 points.
If a player hits 31, he/she immediately reveals his/her cardsand wins the bet.
When a player is comfortable with their hand, they declare theend of current game. All other players then have one more draw totry and improve their hand. The player with the highest hand winsthe pot. If multiple players have the same hand, the pot issplit.
A quick view of the gameplay can be foundhere https://www.youtube.com/watch?v=DV-mQDxD5gI.
2.2 Coding Requirements
Playing cards must be are represented as structures:
typedef struct card s { char suit[9];
int value;
struct card s *pt; } card;
You are allowed to add attributes to this definition, but not toremove any. For instance, you can add another card pointer to makethis a doubly-connected list. The use of a doubly-linked list isrecommended as it is easier to add and delete cards from thelist.
At the beginning, the user can choose to shuffle the deck orload a predefined sequence of cards from a file (for testing). Acard can be represented in any way of your choosing. For instance,ace of hearts can be represented as “1 h” or “1 hearts” or “1 2”(first number is the card value and second is the suit where 1 isspades, 2 is hearts, 3 is diamonds, and 4 is clubs.
The card stock pile is represented as a dynamic list ofcards. The list is created by reading the cards from a file or anyother initialization. Cards drawn from the deck and dealt to theplayers are deleted from the list. You can adapt the addition anddeletion function from lecture to create and delete cards for thecard stock pile list.
2
4.
5.
3
1. 2.
3. 4.
The discard pile is represented as a dynamic list of cards.Cards that are discarded are added to the list and cards that aredrawn from the discard pile are deleted from the list. You canreuse the addition and deletion function to add and delete cardsfor the discard pile list.
Each player’s hand can be represented as a card array or adynamic list of cards.
Optional Features for Extra Credit:
Game statistics. Keep statistics on the number of gamesplayed, each player’s winning percentage, and the percentage ofgame won at different hand values.
Automating one player. Modify your code to automate one ofthe players to be played by your code. You can use the gamestatistics to inform your decisions on which hands have higherchances of winning.
Graphics. Add graphics to your game. You can print cardsusing ascii art.
Multi-player: Extend your gameplay to be played by more thantwo players. Determine the number of players at the beginning of the game.
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
include include include typedefstructcard char suit9 int value struct card next struct card prev car...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started