Files Classes Functions Hierarchy
#include <hand.h>
Public Member Functions | |
| uintc | calculate () const |
| Calculated the greatest value of the hand. | |
| void | add (uintc card) |
| Add a card to the hand. | |
| bool const | isbusted () const |
| Is the hand busted/lost? | |
| void | reset () |
| Remove all cards from the hand. | |
| void | reset (uintc card) |
| Remove all cards from the hand and add the new card. | |
Public Attributes | |
| uint | value |
| The sum of cards excluding the first ace. | |
| bool | hasAce |
| Has the hand got this non-unique card. | |
Definition at line 13 of file hand.h.
| void hand::add | ( | uintc | card | ) |
Add a card to the hand.
Definition at line 29 of file hand.cpp.
Referenced by playerGame::alive_play(), playerGame::notalive_dealCards(), and dealer::play().
00030 { 00031 if (card!=1) 00032 { 00033 value += card; 00034 return; 00035 } 00036 00037 if (hasAce) 00038 { 00039 value += card; 00040 return; 00041 } 00042 00043 hasAce = true; 00044 }
| uintc hand::calculate | ( | ) | const |
Calculated the greatest value of the hand.
Definition at line 47 of file hand.cpp.
Referenced by playerGame::alive_play(), isbusted(), dealer::playAgainst(), and textGame::printGameState().
00048 { 00049 if (hasAce==false) 00050 return value; 00051 00052 if (value+11<=21) 00053 return value+11; 00054 00055 return value + 1; 00056 }
| bool const hand::isbusted | ( | ) | const |
Is the hand busted/lost?
Definition at line 4 of file hand.cpp.
References calculate().
Referenced by playerGame::alive_hold(), and playerGame::alive_play().
00005 { 00006 if (calculate()>21) 00007 return true; 00008 00009 return false; 00010 }
| void hand::reset | ( | uintc | card | ) |
| void hand::reset | ( | ) |
Remove all cards from the hand.
Definition at line 13 of file hand.cpp.
Referenced by playerGame::notalive_dealCards(), and dealer::playAgainst().
Has the hand got this non-unique card.
Definition at line 27 of file hand.h.
Referenced by add(), playerGameSimulate::calculate(), calculate(), playerGameSimulate::calculateHit(), textGame::printGameState(), and reset().
The sum of cards excluding the first ace.
Definition at line 24 of file hand.h.
Referenced by add(), playerGame::alive_hold(), playerGameSimulate::calculate(), calculate(), playerGameSimulate::calculateHit(), dealer::play(), and reset().
1.5.8