logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Garard BerwickkCriminology
(5/5)

646 Answers

Hire Me
expert
Mario FuscoOthers
(5/5)

842 Answers

Hire Me
expert
Basudev RoyMathematics
(/5)

784 Answers

Hire Me
expert
Julian RichardsonnEconomics
(5/5)

569 Answers

Hire Me
Others
(5/5)

Write a program that simulates a card game involving 3 players and a deck of 48 Catalan cards

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Final project: Simulation of a multiplayer game using Catalan Cards

Write a program that simulates a card game involving 3 players and a deck of 48 Catalan cards shown below

Image courtesy wikipedia: https://en.wikipedia.org/wiki/Spanish_playing_cards#/media/File:Spanish_deck_Fournier.jpg

Each card in the deck is identified by its suit and value.

The suit of a card maybe any among the following: "Clubs", "Golds", "Cups", "Swords"

The value of the card can be any number from 1 to 12 (Note that there are 12 values per suit even though the image above only shows 10)

Your program should use an interactive menu to simulate the progress of the game among 3 players.

The program begins by displaying the following menu options and prompt the user to select an option: (10 pts)

s: start new game

p: Pull cards for all players o: output deck

h: output players’ hand e: exchange one card d: declare winner

q: quit

Select an option:

Note the last prompt must end with a newline.

If the user selects option q, the program should end.

If the user selects any other option, the program should take the appropriate action and display the menu again.

If the user selects options p, o, h, e, d before selecting s, the program should print the message

“Please select option s to start a new game” and it should display the menu again.

s: start new game (20 pts)

The user selects this option to start a new game. When this option is selected, the program should do three things:

1) Prompt the user to enter the names of the three players as follows: (5 pts)

Enter player 1’s name:

Alexander the Great

Enter player 2’s name:

Bismarck

Enter player 3’s name:

Charles V of Spain

2) Build a deck of 48 Catalan cards using an appropriate data structure (list/dictionary/etc) (10 pts)

3) Create an empty hand of cards for each player using an appropriate data structure. If the players’ hand has cards from a previous game, those cards should be deleted. (5 pts)

p: Pull cards for all players (10 pts)

If the deck has at least 9 cards, add three cards from the deck to each of the player’s hand. Do not overwrite the cards that are already in the player’s hand. The cards should be selected from the deck at random. The deck should be updated so that the cards that are given to the players are removed from the deck.

Hint: Consider using an appropriate function from the random module: random.randint() or random.shuffle()

o: output deck (5 pts)

Print the cards remaining in” the deck first in the order of their suit: "Clubs", "Golds", "Cups", "Swords". For each suit print the cards in ascending order of the values. Below is an example of a deck that has only 12 cards left:

Clubs 1

Clubs 7

Clubs 10

Clubs 13

Golds 2

Golds 9

Golds 11

Golds 12

Cups 2

Cups 9

Cups 11

Swords 2

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme