Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please take a look for all of five classes! Thank you very much! Background Information: Our WAR game variation: There are two players playing the

Please take a look for all of five classes! Thank you very much!

Background Information: Our WAR game variation: There are two players playing the game. Each of the players are dealt a set of cards (with equal number of cards) from a shuffled deck of cards. When the game starts, the players open up the top card. The open cards are compared to see which one is higher. In the comparison, the King card is the highest while the Ace card is the lowest. In the event of a tie, the suit of the card will determine the winner of the match. The suits are ranked as follows (from the highest suit rank): Spades, Hearts, Diamonds, Clubs. The suit with the higher rank wins. The winner of the match gets a point. Note that there will always be a winner in a match. The game continues until all the player cards have been played and the player with the higher score wins the war.

Developing the Game Before the game can be developed, a number of required classes need to be developed. 1. The Card Class The Card class should describe a specific card, ie., the Ace of Spaces. It should have the usual getters and setters and any addditional methods that will be needed to determine the outcome of the card match.

2. The CardDeck Class The CardDeck class contains the standard deck of 52 cards (4 suits with each suit containing 13 different ranks of cards). To hold the cards, you must use a generic DoublyLinkedList structure. Use this class to initally populate the deck with the 52 cards (much like opening a new deck). In addition, you can also use this class for the shuffled deck of cards that will be used in the game.

3. The Shuffler Class This class is used to shuffle a deck of cards. You will need to use this class before the game can be started. You may want to research how to shuffle a deck of cards, using Java. The details of how the deck is shuffled is left to you. However, what is important here is that the deck of cards are shuffled and that the results of each shuffle are different.

4. The LinkedList Implementation of the Stack class For the Stack class you must use the LinkedList Implementation of the Stack structure. This development is a major component of this assignment. You must create a StackInterface class as well.

5. The WarGame Class (which is the main processor class) This is the processor class that actually plays the game. It starts off with getting a deck of cards, shuffling the deck, and dealing the cards to the players. The number of cards that the players get is determined by the user of your game. Once the cards are dealt, then the game begins and scoring is done using the game description above. For the game, the shuffled deck, and the cards that the players have, are implemented using the LinkedListStack.

Program Development:

1. You may want to start with the shuffling algorithm. Rather than shuffle a deck of cards, test your shuffle algorithm by shuffling 10 numbers and see if your shuffler works. Once this works, it can easily be expanded to 52 cards which can be done later.

2. Next, develop the Card class. This is a relatively simple class and should not take too long.

3. Once the Card class is developed, develop the CardDeck class. Work on how you will initially populate the deck of cards.

4. Once you are satisfied with the CardDeck class, develop the Shuffler class using the shuffling algorithm in #1 but expanding it to accommodate a full deck of cards. Once finished, you can now shuffle any deck of cards.

5. Once done, you now have the basic requirements to start working on the game itself. There are a number of approaches to completing this.

a. One approach is to develop the Stack class first, using the class discussions as the guide in the development. Once this is developed, the WarGame class can now be developed and tested.

b. A second approach is to develop the WarGame class by using the Java Stack class as the Stack structure. It is true that you cannot submit your assignment with this class but nothing prevents you from using it to help in the development. Once you are satisfied with the WarGame class, you can now concentrate on developing your own Stack class. Then, modify the WarGame class to reflect the fact that you will now use the Stack class you developed.

As before, incremental development is the way to handle large development projects.

Testing the Game As suggested, the system should be thoroughly tested. To do this, test each class as it is being developed. You may create a number of test clients to do the testing.

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Communicate based on goals

Answered: 1 week ago