Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Updates: 1. You may add the following method to the Deck API public Deck (ArrayList ) that creates a new Deck with the given array

image text in transcribedimage text in transcribed

Updates: 1. You may add the following method to the Deck API public Deck (ArrayList) that creates a new Deck with the given array list of cards, instead of the default 52 cards in a full deck. This assignment picks up where we left off with the previous assignment. Your objective is to use our card API to implement the Crazy Eights card game. Here are the rules of our version of the game: .Each player is initially dealt n cards from a deck of 52 cards, where n is specified by the user . The winner of the game is the first person to discard (play) all the cards in their hand. . To begin play after the cards are dealt, one card is drawn from the deck and placed on top of a discard pile (which is empty when the game starts). At their turn, each player must play a card that matches the top card on the pile. The matching is determined as follows: o cards of the same suit match o cards of the same rank match o A card with rank 8 can be used to change the suit of the current card on top of the pile. This current top card is now deemed to have a rank of 8 and the new If a player is unable to play at their turn, they must draw the top card from the deck . If no more cards are available in the deck, then the top card on the discard pile is suit that was just declared. and lose their turn. retained, and all other cards in the discard pile are added to the deck, which is then shuffled. An d the game then resumes, from where it stopped. The game ends when there is a winner, or when no player can play a card, and there are n o more cards in the deck Your task is to code: . a game that enforces these rules * a human player that can select cards and play the game . a basic computer player that just plays the first card it cain Updates: 1. You may add the following method to the Deck API public Deck (ArrayList) that creates a new Deck with the given array list of cards, instead of the default 52 cards in a full deck. This assignment picks up where we left off with the previous assignment. Your objective is to use our card API to implement the Crazy Eights card game. Here are the rules of our version of the game: .Each player is initially dealt n cards from a deck of 52 cards, where n is specified by the user . The winner of the game is the first person to discard (play) all the cards in their hand. . To begin play after the cards are dealt, one card is drawn from the deck and placed on top of a discard pile (which is empty when the game starts). At their turn, each player must play a card that matches the top card on the pile. The matching is determined as follows: o cards of the same suit match o cards of the same rank match o A card with rank 8 can be used to change the suit of the current card on top of the pile. This current top card is now deemed to have a rank of 8 and the new If a player is unable to play at their turn, they must draw the top card from the deck . If no more cards are available in the deck, then the top card on the discard pile is suit that was just declared. and lose their turn. retained, and all other cards in the discard pile are added to the deck, which is then shuffled. An d the game then resumes, from where it stopped. The game ends when there is a winner, or when no player can play a card, and there are n o more cards in the deck Your task is to code: . a game that enforces these rules * a human player that can select cards and play the game . a basic computer player that just plays the first card it cain

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

More Books

Students also viewed these Databases questions