Programming Problem

ACEY DUCEY CARD GAME


OVERVIEW

We want a computer program to simulate the card game of Acey Ducey. The computer is to play the role of the dealer. You are dealt two cards face up. The player has an option to bet or not to bet depending on whether you feel the next card dealt will have a value between the first two. If you bet, the third card is dealt and the computer determines if you won or lost, adding or subtracting your bet accordingly.

Your initial bankroll is $100. The game continues until you lose all your money, break the bank (exceeds $100,000), or enter a negative bet to indicate you want to quit.

CLARIFICATIONS

If a bet of zero is entered, no third card is displayed. Instead a "Chicken" message is displayed and play continues with a new turn.

If you try to bet more money than you have, a warning message informs you how much you are allowed to bet, and the bet prompt is redisplayed.

When you quit by entering a negative bet, the final total is displayed, along with a good bye message.

The progam won't simulate an actual card deck. Instead a predetermined sequence of cards will be used.

The game should display card names: ace, two, three, ... jack, queen, king. 

ASSUMPTIONS

It's assumed that bank limit is within integer range allowed by compiler.

Floating point or character input is not allowed.

INPUT REQUIREMENTS

Amount of user's bet, an integer.


FUNCTIONAL REQUIREMENTS

1. Deal two cards, displaying the card name (ace, two, ... king)

2. Display bet prompt

3. Obtain users bet

4. Reject bet greater than bankroll, show TooBigBet msg

5. If bet is zero show chicken msg, skip turn

6. Determine outcome:
 

6.1 Deal third card.

6.2 If third card is between first two, show win msg

6.3 otherwise show lose msg


7. Update bankroll (adding for wins, subtracting for losses)

8. Show current bankroll

9. End the game:
 

9.1 If bank is broken show broke bank msg

9.2 If user runs out of money show busted msg

9.3 If player quits show quit msg


USER INTERFACE REQUIREMENTS

The output format should appear as shown below:

Sample Execution

Welcome to Acey Ducey.

You now have $100.

You are dealt: five jack

Your bet? 50

Third card is: six You won!

You now have $150.

You are dealt: queen ten

Your bet? 2

Third card is: two You lost!

You now have $148.

You are dealt: four nine

Your bet? 20

Third card is: ten You lost!

You now have $128.

You are dealt: king three

Your bet? 200

Sorry, you only have $128 to bet.

Your bet? 100

Third card is: five You won!

You now have $228.

You are dealt: three two

Your bet? 0

Chicken!

You now have $228.

You are dealt: queen five

Your bet? -1

You quit with $228. Thanks for playing.