Finding Fish Card Game V2 (Base Code Available)
Description
To do this, we will provide code that lets us simulate a deck of cards and players. If you are unfamiliar with playing cards and card games, please see our brief introduction to card games.
We have provided code that does the following:
- Create and shuffle a deck of cards. Print the cards in the deck.
- Create 4 players: Player 1, Player 2, Player 3, and Player 4.
Part 1
Implement the following part of the game:
- Each player takes turns drawing a card from the deck until there are no cards in the deck. Print the line
"Player {X} drew a card"when this happens. - Print out the cards in the hand of each player in sorted order. When printing the cards, group them by suit, and sort them by rank. The suits can be in any order. For this example, all
♣cards are together and sorted, all♦cards are together and sorted, etc.
Part 2: Trick Taking
Now that the game is set up, let’s play! The game will be played as a series of rounds called“tricks”.
- Players can play a card. This means that they remove the card from their hand and place it on the table.
- A“trick”is complete when all four players play a card.
The game starts by picking one player to play first. These players will play each trick as follows:
- The selected player plays a random card from their hand. This is the starter.
- Every following player plays a card from their hand. This card must be the same suit as the starter. You can choose any valid card in this step. Do not worry about player strategy.
- If a player does not have any cards in their hand of the same suit as the starter, they may play any card.
- Print out each player and the card that they played, using the message
"Player {X} played {Card}". - The winner is the player who played the card with the highest rank card that is also the same suit as the starter.
- Print the name of the winner. The winner of this trick is now the starting player for the next trick.
- This is repeated until all of the players have no cards in their hands, then the game ends.
For this part of the problem, simulate an entire game. There should be 13 rounds total in the game. You can make the players play any card they want that follows the rules. Do not worry about strategy.
This is a card-game simulation problem centered on object modeling and rule-based turn processing. In Part 1, you need to shuffle a standard 52-card deck, deal cards round-robin to four players, and print each hand sorted by suit and then rank. In Part 2, you simulate 13 trick-taking rounds: the starting player plays a card, later players follow suit if possible, otherwise play any card, and the winner is determined by the highest-ranked card of the starter’s suit. The main skills are clean class design, list manipulation, sorting, and maintaining game state across rounds.