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 15
This is a 4-player card game where each player will have 10 cards in the form of 5 cards in a stack and the next 5 cards in a queue from a deck of 52 cards. There will also be 4 cards on the table face up.
In each players turn, the player will try to make a total point of exactly 15 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 15, 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 15, 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 15, the player will get 15 points, and both the cards that add up to 15 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 player(s) with the highest points will be the winner(s).
Initial Setup:
(A) The game consists of a deck of 52 cards with 4 sets. Each set contains cards numbered 1 to 13 with a specific color. Our deck has RED(R), GREEN(G), ORANGE(O), and PURPLE(P) colors. Example cards: 1R,10G,3O,13P, etc.
(B) An initial queue called deck of size 52. The cards will be stored in this queue.
(C) Each player (Players 1 to 4) has a dedicated stack and queue with a size of 5 each. For player i, we called them stack_i and queue_i. 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 4 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 game_score.txt file with the below format:
Scores:
Player_1=0.0;
Player_2=30.0;
Player_3=0.0;
Player_4=15.0;
Player 2 wins!
Or
Player_1=0.0;
Player_2=15.0;
Player_3=0.0;
Player_4=15.0;
Player(s)2 and 4 wins!
Or
Player_1=15.0;
Player_2=15.0;
Player_3=15.0;
Player_4=15.0;
It's 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
Problem: Card game - Match exactly 1 5 This is a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!