Question: Write a program in Java to play the card game War. You may only use ArrayLists to store the cards in this program. A standard

Write a program in Java to play the card game War. You may only use ArrayLists to store the cards in this program. A standard deck of 52 cards is dealt so that both players have 26 cards. During each play, both players get a card from the top of their hand face up.

Whoever plays the card of the higher rank wins both cards and places them at the bottom of his stack of cards. If both cards played are of the same rank, then both players play three additional cards face down and then one more card face up.

The player who wins the war by playing the higher card wins all ten cards.If the ranks are still the same, additional wars are played until one player wins the turn.If either player runs out of cards to play, he loses the game.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!