Introduction In this homework, we will implement a variation of Trash, a simple children’s card game also sometimes called Garbage. The first step is to learn how to play Trash, which is most easily accomplished by watching this tutorial video
As the video describes, game play is quite simple. Each player is dealt 10 cards from a standard 52 card deck, which are placed face down in front of the player in two rows, conceptually labeled 1 through 10 (we’ll call this 10-card configuration the player’s table). The remaining cards are placed in a draw pile. The game is played in rounds: within a round, players alternate taking turns. A turn begins with the player drawing a card (typically from the draw pile but optionally from the discard pile). If the position on the player’s table whose label corresponds to the draw value is face down, it is replaced with by the draw (face up), and the replaced card is then compared to the player’s table. Thus begins a series of replacements, which only ends when
(i) the card in play is does not correspond to a labeled position on the table, or
(ii) the card in play corresponds to a labeled position with a face up card. At this point, the card in play is added, face up, to the discard pile and the turn ends. The round proceeds turn-by-turn until one player manages to fill their table with cards placed face up in label order. At this point, the round is finished, and the losing player(s) are awarded the sum of the labels of the face-down cards that remain on their table: note that the player who completed his or her table earns 0 points, which implies that the player with the lowest point total at the end of the game is the winner (indeed, this is the case). The game proceeds round-by-round, but after each round the winning player’s table size is reduced by 1 face-down for all subsequent rounds. The game ends when any player table is reduced to zero size. A few important observations. First, Trash is entirely a game of luck; the player makes essentially no choices while playing the game! Drawing a card starts a chain of replacements until nothing more can be replaced. The only choice a player makes is whether to draw his or her card from the draw pile or the discard pile. But even this is a false choice: if the card from the discard pile matches a face-down card on the player’s table, the correct choice is to draw from the discard pile: so this is hardly a choice. Second, the number of players and the size of the initial table can be parameterized with only minimal concern. Indeed, it’s perfectly reasonable to play Trash with one player as a solitaire! It’s also perfectly reasonable to play with more than two players. The only concerns are
(i) that the length of the game measured in rounds will increase with the number of players and the initial table size, and
(ii) as the number of players grows, so must the size of the deck. To see why the latter is so, consider that if there are more than four players with a standard deck, there is a good chance that the game will not terminate, since no player is guaranteed that they will be able to collect all of the cards required to complete their table. You are to implement a parameterized version of Trash, which takes as input nplayers, the number of players, and nrounds, the number of rounds, which in turn determine nsuits, the number of suits in the deck, and nsize, the initial size of the player’s table. Your game will rely on a non-standard deck that consists of nrounds+3 cards in each of nsuits = nplayers +2 suits. Note that if nplayers = 2 and nrounds = 10, you will be playing the standard 2 player 52 card deck game. Note also, however, that it is perfectly acceptable to play a game with nplayers =1, in which case the lone player is assured of a victory since they will never be assigned any points. Fortunately, you won’t have to start from scratch, as the template file already contains the rudiments of the game. Your job is to complete each required function (do not alter the function signatures), testing each function separately, and then test the game as a whole before uploading your code to be graded.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
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
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme