Question: Project 2 : Blackjack Write a C program that simulates a game of blackjack between you and a virtual dealer. You only need to make

Project 2: Blackjack
Write a C program that simulates a game of blackjack between you and a virtual dealer. You only
need to make one of the two projects.
To simplify the game, well make 3 changes to the rule set.
Assume only one player and the dealer.
Aces can ordinarily be worth 1 or 11 points. In our game they can only be worth 11.
Assume that ties result in the player getting their bet back.
Heres a detailed step by step on how your game should be played.
1. Run the game with ./blackjack.exe, or /blackjack.exe load with load passed as a
command line argument to signal you want to load a previous game.
a. If load is passed, load dealer and player hands, the deck, the chips, and the
bet, then skip to step 6.
2. The player is given 1000 chips.
3. The player is asked to make a bet. They type in a number, or 0 to make no bet and
leave the casino with their earnings.
4. The player and dealer are dealt two cards each.
5. If the player is dealt 21, they receive 1.5x their bet, a new round is immediately started.
6. The player is shown their cards, current score, dealers first card, and asked if they want
to hit by typing h stay by typing s or take a break and save the game by typing b
a. Hit deals the player a card and starts a new round
b. Stay ends the round
c. Break saves the game in a file and exits the program (just call exit(0);)
7. If the player has more than 21, round ends.
At the end of the round, if the dealer has less than 16 points, they draw another card. Then the
round is resolved in one of the following ways.
1. If both player and dealer have more than 21, or if they tie in any way round ends and no
chips are lost.
2. If only the player has more than 21 chips, they bust, lose the bet.
3. If the dealer has more than 21 points or less than the player, round ends, and the player
gains 2x the bet.
4. If the dealer has a higher score, the player loses their bet.

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 Programming Questions!