Rules
1) The object of the game is to beat the dealer's score with a total equal to or less than
twenty one.
2) The game uses a standard deck (or multiple decks of cards). There are no jokers in the
deck(s). Face cards count as 10 points each, Aces may count as either 1 or 11, whilst all
other cards have their face value.
3) If the game is being played using wagers, then the player must place a wager before the
hand is dealt.
4) The dealer then deals two cards to each player. These cards are typically dealt face up.
5) The dealer then deals two cards to himself or herself. One of the dealer's cards is dealt
face up, whilst the other card is dealt face down.
6) Play then progresses around the table. A player is allowed several different options with
his or her hand. However, we will only implement some of these for our game.
a. The player can "hit". That is, the player can request an additional card to add to
his or her hand. The player can then select another option. However, if the
additional card forces the player over 21, then the player loses and must surrender
his or her cards and wager. This is called a bust.
b. The player can "stand". That is, the player can keep the value of cards that he or
she has. Play progresses to the next player.
c. The player can "double down". This is where a player doubles his or her wager.
The player then receives an additional card, but cannot receive any additional
cards. Play progresses to the next player.
7) After all the players have finished their turns. The dealer turns over his or her hidden card
and adds up his or her score. If the score is 17 or more, the dealer is finished. If the
dealer's score is 16 or less, then the dealer must "hit" until his or her score is greater than
16 or he or she busts.
8) After the dealer has completed his or her turn, all the remaining hands are compared
against the dealer's score. If a player has a higher score than the dealer or the dealer
"busted", then the player wins an amount equal to his or her wager. If the player has a
score less than the dealer, then he or she loses his wager. If the player ties with the dealer,
the game is said to be a "push", and the original wager is returned to the player.
9) BlackJack- This is when a player is dealt an ace and a ten with his or her first two cards.
In this case, the player wins 1.5 times his or her wager unless the dealer also has
blackjack in which case it is a push. If the dealer has blackjack, then all players who don't
have a blackjack lose.There are also special insurance rules for when the dealer shows an
ace, but we will worry about these later.
In this assignment, you will use classes and dynamic arrays to create a blackjack simulator that
pits a single player against the dealer. The game should use the rules given above and should
allow a player to keep track of the number of games they won. It is not necessary to implement
betting, although you are free to do so if you would like.
...
Separation of Lanthanides/ Lanthanides and Actinides
Rules1) The object of the game is to beat the dealers score wit.docx
1. Rules
1) The object of the game is to beat the dealer's score with a
total equal to or less than
twenty one.
2) The game uses a standard deck (or multiple decks of cards).
There are no jokers in the
deck(s). Face cards count as 10 points each, Aces may count as
either 1 or 11, whilst all
other cards have their face value.
3) If the game is being played using wagers, then the player
must place a wager before the
hand is dealt.
4) The dealer then deals two cards to each player. These cards
are typically dealt face up.
5) The dealer then deals two cards to himself or herself. One of
the dealer's cards is dealt
face up, whilst the other card is dealt face down.
6) Play then progresses around the table. A player is allowed
several different options with
his or her hand. However, we will only implement some of these
for our game.
a. The player can "hit". That is, the player can request an
additional card to add to
his or her hand. The player can then select another option.
However, if the
additional card forces the player over 21, then the player loses
and must surrender
his or her cards and wager. This is called a bust.
b. The player can "stand". That is, the player can keep the value
of cards that he or
she has. Play progresses to the next player.
c. The player can "double down". This is where a player doubles
his or her wager.
The player then receives an additional card, but cannot receive
2. any additional
cards. Play progresses to the next player.
7) After all the players have finished their turns. The dealer
turns over his or her hidden card
and adds up his or her score. If the score is 17 or more, the
dealer is finished. If the
dealer's score is 16 or less, then the dealer must "hit" until his
or her score is greater than
16 or he or she busts.
8) After the dealer has completed his or her turn, all the
remaining hands are compared
against the dealer's score. If a player has a higher score than the
dealer or the dealer
"busted", then the player wins an amount equal to his or her
wager. If the player has a
score less than the dealer, then he or she loses his wager. If the
player ties with the dealer,
the game is said to be a "push", and the original wager is
returned to the player.
9) BlackJack- This is when a player is dealt an ace and a ten
with his or her first two cards.
In this case, the player wins 1.5 times his or her wager unless
the dealer also has
blackjack in which case it is a push. If the dealer has blackjack,
then all players who don't
have a blackjack lose.There are also special insurance rules for
when the dealer shows an
ace, but we will worry about these later.
In this assignment, you will use classes and dynamic arrays to
create a blackjack simulator that
pits a single player against the dealer. The game should use the
rules given above and should
allow a player to keep track of the number of games they won.
It is not necessary to implement
betting, although you are free to do so if you would like.
3. Classes
In order to do this, your program will need to have three
separate classes.
Card Class
First, you will need a class for individual cards. This card class
should have member variables
for: suit (e.g. spades), value (e.g. jack), and points (e.g. 10).
You should obviously have
constructors, accessors, and mutators for this class. In addition,
you will need to overload the
following C++ operators for this class (==, =, <, >, and <<).
Deck Class
Next, you will need a deck. As a member variable, the deck will
need to contain all 52 cards. For
ease of implementation, you can put all 52 cards into a vector,
since you can shuffle them using
the following command:
std::random_shuffle( d.begin(), d.end() );
The deck should also have a constructor and a member function
that allows you to get a card
from it. Overloading the << operator is a good way to test the
functionality of the deck, but is not
necessary for the program.
Hand Class
Finally, the hand class will contain the cards in the player’s
hand. You must implement this class
using a member variable that is a dynamic array of cards for the
player’s hand. You will also
need to have member variables for the number of cards in the
hand as well as the score.
Obviously, you should write constructors, accessors, and
mutators for this class. Since this class
also uses dynamic memory, you will need to write a copy
constructor, destructor, and overloaded
4. equal (if implementing splits).
The other item that needs to be added to this class is an ability
to put an additional card into the
hand as player’s will often take additional cards during the
game of blackjack. Adding a card to
the hand requires reallocating dynamic memory and will be
similar to a copy constructor.
Implement your program using separate compilation for the
voter class and the main program.
As always, your code should have appropriate comments to
explain the program and the code. It
should be written in a consistent and readable form and should
compile without errors or
warnings.