Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C language, Linux . Playing cards We would like to create a simple playing cards application that involves 4 players. The 4 players are numbered

C language, Linux . image text in transcribed
image text in transcribed
Playing cards We would like to create a simple playing cards application that involves 4 players. The 4 players are numbered 0 through 3, where player 0 and 2 are members of team 1 playing against team 2 composed of player 1 and 3. For those who do not know already, playing card decks are composed of 52 cards that belong to 4 different categories: spades (4), hearts (C), diamonds (O) and clubs Each category is composed of 13 cards numbered 2 to 10 in addition to a Jack, a Queen a King and an Ace. The Ace cards have the least value of 1. Then you have the cards numbered 2 through 10. The Jack cards have the value 11, followed by the Queen cards whose values are 12 followed by the King cards whose values are 13. The rules of the game are as follows: 1. Before a major round starts, a player should shuffle the cards (order them randomly in any order). If this is the first major round, then player 0 shuffles the cards. Else, it should be the player next to the one who shuffled the cards in the previous major round (cards' shuffling occurs in a round-robin fashion among players). 2. Once the player ends shuffling the cards, he distributes 13 cards in order to each player, starting by the player who is next to him and ending byif He thus gets the last 13 cards from the deck. 3. The player who received his 13 cards first should open the first minor round by putting on the table the highest card he has. By the phrase putting on the table I mean writing the chosen card value in the shared memory. The remaining 3 players are obliged to put in order on the table the highest card they have and that belongs to the same category put on the table by the player who opened the minor round (the category can be either .. C, or 4. If any of the other 3 players doesn't have a card of the same category as chosen by the player who opened the minor round, he can put on the table a card that belongs to another category and that has the least value. This card will not be considered for that minor round 5. Once the 4 players have put their cards on the table, a referee will add the card values for each team. The team who ends up having the highest sum wins the minor round. The minor score for the winning team is incremented by 1. The minor score of the other team remains unchanged. 6. The team member who has put the highest card in the previous round wll be the one to open the next minor round by applying the same rules described above. 7. Once the 4 players have played 13 minor rounds (since they have 13 cards), the referee compares the minor scores of the 2 teams. The team who has the highest minor score is called the winner of the major round. The major round score for the Playing cards We would like to create a simple playing cards application that involves 4 players. The 4 players are numbered 0 through 3, where player 0 and 2 are members of team 1 playing against team 2 composed of player 1 and 3. For those who do not know already, playing card decks are composed of 52 cards that belong to 4 different categories: spades (4), hearts (C), diamonds (O) and clubs Each category is composed of 13 cards numbered 2 to 10 in addition to a Jack, a Queen a King and an Ace. The Ace cards have the least value of 1. Then you have the cards numbered 2 through 10. The Jack cards have the value 11, followed by the Queen cards whose values are 12 followed by the King cards whose values are 13. The rules of the game are as follows: 1. Before a major round starts, a player should shuffle the cards (order them randomly in any order). If this is the first major round, then player 0 shuffles the cards. Else, it should be the player next to the one who shuffled the cards in the previous major round (cards' shuffling occurs in a round-robin fashion among players). 2. Once the player ends shuffling the cards, he distributes 13 cards in order to each player, starting by the player who is next to him and ending byif He thus gets the last 13 cards from the deck. 3. The player who received his 13 cards first should open the first minor round by putting on the table the highest card he has. By the phrase putting on the table I mean writing the chosen card value in the shared memory. The remaining 3 players are obliged to put in order on the table the highest card they have and that belongs to the same category put on the table by the player who opened the minor round (the category can be either .. C, or 4. If any of the other 3 players doesn't have a card of the same category as chosen by the player who opened the minor round, he can put on the table a card that belongs to another category and that has the least value. This card will not be considered for that minor round 5. Once the 4 players have put their cards on the table, a referee will add the card values for each team. The team who ends up having the highest sum wins the minor round. The minor score for the winning team is incremented by 1. The minor score of the other team remains unchanged. 6. The team member who has put the highest card in the previous round wll be the one to open the next minor round by applying the same rules described above. 7. Once the 4 players have played 13 minor rounds (since they have 13 cards), the referee compares the minor scores of the 2 teams. The team who has the highest minor score is called the winner of the major round. The major round score for the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions