Question: Problem: Card game - Match exactly 1 5 This is a 4 - player card game where each player will have 1 0 cards in
Problem: Card game Match exactly
This is a player card game where each player will have cards in the form of cards in a stack and the next cards in a queue from a deck of cards. There will also be cards on the table face up
In each players turn, the player will try to make a total point of exactly by adding the number of the top card in the players stack and the number of one of four cards on the table. If none of the cards on the table adds up to exactly then the player can dequeue players choice, if wants to swap one card from the players queue and swap it with the top card of the players stack the top card from the stack must be enqueued to the players queue After swapping if performed by the player if the top card still does not make a total point of exactly then the players card from the top of the stack will be popped and discarded, and enqueued back to the deck. Otherwise, for the match of point the player will get points, and both the cards that add up to will be discarded from the stack and the table and enqueued back to the deck. The table will be refilled from the deck.
After five rounds of play the stacks of each player will be empty and the game ends. At this point, the players with the highest points will be the winners
Initial Setup:
A The game consists of a deck of cards with sets. Each set contains cards numbered to with a specific color. Our deck has REDR GREENG ORANGEO and PURPLEP colors. Example cards: RGOP etc.
B An initial queue called deck of size The cards will be stored in this queue.
C Each player Players to has a dedicated stack and queue with a size of each. For player i we called them stacki and queuei These stacks and queues function like personal zones where players accumulate cards and play during the game.
D Create classes for a bounded stack and a bounded queue called Stack and Queue, respectively. Then, create each instance of these classes as required.
E A table with a list of cards face up on the table.
F Implement your solution with modularization using functions.
The final score of the players will also be stored in a gamescore.txt file with the below format:
Scores:
Player;
Player;
Player;
Player;
Player wins!
Or
Player;
Player;
Player;
Player;
Players and wins!
Or
Player;
Player;
Player;
Player;
Its a tie! No one Wins!
Solve it using python and give exact output and formatting of the tables of players as shown in sample output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
