WAR! A Two Player Card Game


Assigned Thursday, October 3th
Program Due Thursday, October 17rd by 8:00am
Weight 7%
Updates


Objectives

To gain experience in the following areas.

To continue to gain experience in the following areas.



Project Description

Perhaps the simplest card game in the known universe is the kid's game of "War". In this simple game, a standard 52-card deck is shuffled and cards are dealt to each of the two players, alternating between the players, who place each card on the top of their pile. In each turn, the players both show the face of their top card. The player with the higher ranking card wins his opponent's card and puts both cards on the bottom of his pile. If the two cards are of the same rank, WAR breaks out. Each player places three (3) cards face down while yelling "I DE-CLARE" as loud as possible, then turn over the next (4th) card while shouting "WAR!!". The player with the higher ranking 4th card wins the two (2) cards that originally tied, all six (6) cards that were face down, plus the two (2) cards that determined the winner of the WAR -- ten (10) cards in all. Of course, if both players' 4th cards are the same rank, there's another immediate WAR. Play continues until one player has all the cards.

In this project, you will implement classes necessary to play a variation of WAR. In this simplified variation, the two players will turn over all cards in their piles just once. At the end of the game, the player with the most cards will be declared the winner.

For each turn, each player's name, the card he/she shows, and the result of the turn should be displayed. At the end of the game, the number of cards won by each player, the number of WARs won by each player, and the total number of WARs during the game should be displayed.

Sample output from an actual run of this project is shown below.

Welcome to WAR!!
Please enter player 1's name: Bob
Please enter player 2's name: Mary
Please enter the RNG seed for shuffling: 123456

Turn  1
-------
Bob shows three of Spades
Mary shows three of Hearts
WAR!!

Turn 2 ------- Bob shows four of Spades Mary shows jack of Diamonds Mary wins 10 cards
Turn 3 ------- Bob shows eight of Spades Mary shows eight of Hearts WAR!!
....
Turn 19 ----- Bob shows five of Diamonds Mary shows jack of Spades Mary wins 2 cards
Turn 20 ----- Bob shows three of Diamonds Mary shows ace of Hearts Mary wins 2 cards
Game Over!! There were 2 wars Bob won 22 cards and 1 war(s) Mary won 30 cards and 1 war(s) Winner: Mary

Project Specification Details

You will be given Project2.java that has main( ) already written. You will also be given two files, Rank.java and Suit.java that contain enumerated data types for card ranks and suits, respectively. You will be expected to write the following classes.