Queues

This program is a simulation of the card game War.

Rules:

The queue must be dynamic, keep the initial size and grow by value less than 13 ( this guarantees two memory growths ).

Cards

You will need to create a Card type. This type will need to support comparision and output.

Create a deck of cards and shuffle them, deal the cards to the players, and begin the game.

NOTE: if player one wins, enqueue his/her card first. Same deal for player two, this may prevent some really long, almost infinite runs.

I/O tricks

The output should look something like the file at this link.

Each hand you need this to output the cards played, an indicator of who won the hand, and how many cards each player has. Don't track the number of cards in the main, put that work into the queue, since the size is a property of the queue.

Your output needs to look similar like mine. At a minimum each field needs to be lined up so that it is easy to read. That means you will need to use the stream manipulators like left, right, and setw. Don't forget to include iomanip, or you will get lots of errors and warnings.

At the end, you need to output who won, the number of hands played and the number of ties.

shuffle logic

For every item find a random item to swap with. Repeat this 7 times ( typically this value is a prime close to the square of the number of items to shuffle ). Make sure the generator only get seeded once.

This program is due on July 15th.

The Goals