Create the game:
Implement the rules of the game 1 at a time and test each one to make sure it works as expected.
Helps if you display the cards as they are played so you can see that everything is working on screen.
Create a class War
Optionally but recommended read over the rubric and put todo comments in your war class as a checklist of steps to complete
Example - // TODO: Create the Player class
All new classes need “using CardGame;” at the top of the file above the namespace in order to have access to the PlayingCard and Deck classes.
Begin to outline methods for implementing the game's rules and structure, such as initial setup, playing the game, and any other methods you need. Below are a few examples ideas:
Initialize (setting up the game)
This method should be for prepping the game. That means creating a Deck instance, filling the deck, shuffling the deck, and drawing cards from the deck to deal out half (26) to each player
Play (core gameplay)
This method should handle playing a game of War.
The rules logic will go here and will determine what other methods get called and when, such as having each player play a card, the comparison of them, initiating War, etc.
int CompareRank(PlayingCard, PlayingCard) (similar to week 1)
War compares card ranks, not values, so GetValue and CompareCards from the PlayingCard class will not be enough on their own
GetRank or a combination of GetRank and GetValue/CompareCards can be used to compare the rank of the two cards being played and compared.
10, Jack, Queen, and King are all different ranks and should not be treated as equal (again, we’re comparing ranks, not values)
Ace is a trump card, the rank Ace should win against any other rank that is not an Ace.
Add to each method as you complete the other requirements to test them, feel free to create any other methods to help with organization.
Create the Player class and its necessary fields and methods:
field: protected PlayingCard
initialized to size 52 (winning player will have every PlayingCard that started in the Deck)
It is protected so that classes that derive from Player, specifically Human and Computer, can have access.
method: public void AddCards(PlayingCard)
This method will be used to add cards to the bottom of the player’s array of cards.
This means the “bottom” needs to be kept track of, review the ILAs if necessary (NextEmptySpotIndex)
method: public virtual PlayingCard PlayCard()
This method must return null.
Child classes will have to override this method to return the card they are playing from their array of cards.
Add any fields you need to the War class
Initialized to size 2
Holds 1 Computer at index 0
Holds 1 Human at index 1
(review Inheritance and Polymorphism if necessary)
(optional but useful) bool Running
if you want to use this to control the game loop in the Play method
Add any other fields you need to achieve functionality (might have to add them as you realize that you need them)