Question: CEN 4 8 8 - Homework 4 - Spring 2 0 2 4 This homework is the repetition of the second homework by using object

CEN488- Homework 4- Spring 2024 This homework is the repetition of the second homework by using object-oriented programming, with the following requirements: 1. Each player must be an instance of a class. The class should have appropriate attributes and methods. One of the private attributes should record the players' previous plays (Number of players, the order and total the points of the player at the end of each game). A getter method should return the past plays of the player. 2. The Game is also an instance of the classes. The Game class must record the previous plays (name of the payers and the winner) as a private attribute. A class method should display or print to a file the data of the previous plays: If there is no argument, the data must be displayed on the screen; otherwise, if there is a proper file name, the file must be created with the data of the previous plays. If the argument does exist but it is not a proper file name, The file name should be Game_dd_mm_yy_nn.txt, where the current day, month and year are represented by dd, mm and yy respectively. The nn is a 2-digit decimal number that represents the order of the play in the current day. The 2nd Homework : The objective of the game is to get rid of the cards in each players hand. When the cards in any players hand finish, the current round ends, and the total points of the rest of the players are added to their account. If the points of any player exceed 400, that player leaves the game. The game continues till the last player remains. This one is the winner of the game. The game starts with determining the number and name of players. The number of players should be 3 to 6. Each player may prefer to use their name or a nickname, which is assigned to the player randomly from a list of nicknames you defined in your code. Each round starts with assigning 10 cards randomly to each player from a set of 3 decks. At each round, the first player position shifts towards the next one. At the beginning of each round, the first player puts any one of the cards in the hand onto the table. The next player must put an appropriate card onto the table. Any player, who does not have an appropriate card, must draw cards from the undealt part of the deck, till finding a card to put on the table. An "appropriate card" is any card, which has at least one common value with the card on the table. At the end of each round, the points of each player are calculated by summing up all card values remaining in the players hand: Each card value is determined by adding the card number to the suit value: Suits: Clubs-2 points; Diamonds 4- points; Hearts-8 points; Spades -12 points Numbers 2-9 equal their values, and A: 10 points, J: 11 points, Q: 12 points, K: 13 points. Upload your code as a python file *.py RULE: The programmer manages the players and selects cards for the player, each player's right to turn continues in turn. 1 round consists of 10 games for each player. There should be a card selection menu with at least 2 and a maximum of 13 options in each game. Cards that may be suitable are randomly shown, the programmer selects that card, if there is no suitable card. Each player can draw cards until they reach a maximum of 13 cards. After completing one round, each player returns to the beginning for the second round. When the player's right to play ends, the scores of that round are kept and added up with the score at the end of the next round. Whoever reaches 400 is eliminated and the game continues until 1 player remains. The last remaining player wins.

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!