COMPUTER PROGRAMMING I
Final Project – Blackjack (21) Iván Amaya: 2016-I
This document presents a brief introduction to the game of blackjack, as well as the minimum requirements that your
implementation must consider.
1 Game description
1.1 Basics
The idea behind blackjack is to get as close as possible to 21 while avoiding going over it. Thus, if the player has 20
points and the dealer has 18, the player wins. There are certain elements to consider within the game logic, and they
will be described below.
The game begins by placing bets. Afterwards, the dealer puts a face-up card for each player and one for himself. A
second card is dealt to the players in the same order and also facing up, but the dealer receives his card facing down.
The round starts with the player to the left of the dealer, and keeps going until returning to himself. Keep in mind that
the dealer plays against each player one at a time.
1.2 Card values
Numbered cards take their written value, with the exception of the ace. The latter is worth 1 or 11, and the player
chooses which one is more favorable. The remaining cards, i.e. the face cards (jack, queen, and king), are worth 10
points. This means that if a player gets a face card (or a 10) and an ace, he/she automatically wins since 10 + 11 = 21
(in fact, this is called a natural or a blackjack).
1.3 Moves
In each turn, the player needs to choose between “Hit” or “Stand”. In the first case, a new card is dealt to the player
and the total is updated. In the second case, the turn ends and the dealer moves on to the next one. Keep in mind that
a player can keep hitting until he/she either goes bust (over 21) or decides to “Stand”.
1.4 Special moves
Sometimes, special conditions arise in the game of blackjack that lead to special moves. Following is a description of
these scenarios so that you can implement them.
1.4.1 Naturals
At the beginning of each round, the hand of each player is checked. If they have a ten-card and an ace, a blackjack is
declared. If the dealer does not have a similar hand (i.e. another blackjack), the house pays one and a half times the
player’s bet. Should the dealer have a blackjack, a stand-off (i.e. a tie) is declared and the player reclaims his bet. If
the dealer has a blackjack and a player don’t, the dealer wins the player’s bet.
1.4.2 Doubling down
If a player hand totals 9, 10, or 11 with the initial two cards, the player is given the choice of doubling down. Under
this scenario, the player doubles his bet and is dealt only one faced-down card (i.e. he automatically stands with three
cards). This card remains face down until all bets are fixed at the end of the round.
1.4.3 Splitting
If the initial two cards of a player are of the same denomination (i.e. two aces, two nines, two queens, etc.), the player
may choose to split his/her game. Since the player now has two hands, an additional bet must be placed (of the same
amount). At this point, each hand is treated separately, as if there were two players, with a couple exceptions. If the
initial cards are aces, the player only receives one card on each hand and then automatically stands. If one hand gets
a natural, the dealer only pays one time the bet (and not one and a half as explained above). The hand to the left of the
players is dealt first.
1.4.4 Insurance
Whenever the dealer has an ace facing up in the starting hand, any player may bet that his facing down card is a ten
card. This side bet cannot be more than half the initial bet of that player. After all side bets have been placed, the
dealer looks at his faced-down card. If it is a ten card, he flips it over and pays each player twice the value of the side
bet. However, if this happens and a player does not have a blackjack, said player losses his/her main bet.
1.5 Dealer
The logic behind the dealer behavior is straightforward. After all players have stood or busted, he flips his faced-down
card. If the total is 17 or more, he must stand. Otherwise, he keeps hitting until reaching 17 or more. Should the dealer
have an ace, he must score it as 11 if it makes the total 17 or more (without busting) and stand. The dealer may never
double down or split his hand.
2 Team and logistics
Each team is made up of, maximum, two students.
The last part of the semester will be allotted for the development of the final phases of the project. Hint: Do not wait
until the end of the semester to begin working on your project.
3 Program requirements
Each program must include a user menu that contains the following actions: start game, options, credits, exit. Within
the options menu, the user must be able to change the minimum and maximum bets, as well as the starting money.
It is only required to program one human player. However, if your team manage to program more than one player
(besides the dealer), it could be beneficial.
The program must keep a score with the number of times the dealer and the player have won. Said score must be
visible at all times (i.e. for as long as the game is in progress).
The program must simulate a graphics interface by printing characters in the console. Each card must be drawn as the
game progress. In order to do so, remember to clean the screen after each frame. Hint: Define functions that plot each
element in the screen, so that the code is cleaner and easier to debug.
After each hand, the deck must be reshuffled.
The program must incorporate a bonus event that simulates a charitable soul passing by the table. As soon as the player
runs out of money, the program must roll the event and decide whether the event unfolds. The probability of this event
should be low enough for keeping the game interesting (e.g. 10%).
The player must be able to withdraw from the table after each hand, thus ending the game.
The game must consider the special moves described within this document. Therefore, if there is a natural, the round
should terminate immediately (with the respective winners declared and collecting bets).
4 More information
In order to obtain more information about the game of blackjack, feel free to visit:
http://www.bicyclecards.com/how-to-play/blackjack/
https://www.blackjackinfo.com/blackjack-rules/