Files Classes Functions Hierarchy
#include <textGame.h>
Public Member Functions | |
| textGame () | |
| void | printMenu () |
| void | printGameState () |
Definition at line 9 of file textGame.h.
| textGame::textGame | ( | ) |
Definition at line 23 of file textGame.cpp.
References playerGame::alive, playerGame::alive_doubleAndPlay(), playerGame::alive_hold(), playerGame::alive_play(), playerGame::dealerWins, playerGame::notalive_dealCards(), playerGame::playerWins, printGameState(), and printMenu().
00024 { 00025 char ch; 00026 for (;;) 00027 { 00028 printMenu(); 00029 00030 cin >> ch; 00031 if (ch=='q') 00032 return; 00033 00034 if (pg.alive) 00035 { 00036 switch (ch) 00037 { 00038 case '1': pg.alive_hold(); break; 00039 case '2': pg.alive_play(); break; 00040 case '3': pg.alive_doubleAndPlay(); break; 00041 } 00042 } 00043 else 00044 { 00045 switch (ch) 00046 { 00047 case '1': pg.notalive_dealCards(); break; 00048 case '2': 00049 cout << "dealerWins=" << pg.dealerWins << " "; 00050 cout << "playerWins=" << pg.playerWins << endl; 00051 continue; 00052 case '3': return; 00053 } 00054 } 00055 00056 printGameState(); 00057 } 00058 00059 }
| void textGame::printGameState | ( | ) |
Definition at line 8 of file textGame.cpp.
References hand::calculate(), playerGame::deal, hand::hasAce, dealer::hnd, and playerGame::player.
Referenced by textGame().
00009 { 00010 hand & dh(pg.deal->hnd); 00011 hand & ph(pg.player); 00012 cout << "D: " << dh.calculate() << " "; 00013 if (dh.hasAce) 00014 cout << "hasAce"; 00015 cout << endl; 00016 cout << "P: " << ph.calculate() << " "; 00017 if (ph.hasAce) 00018 cout << "hasAce"; 00019 cout << endl; 00020 }
| void textGame::printMenu | ( | ) |
Definition at line 61 of file textGame.cpp.
References playerGame::alive.
Referenced by textGame().
00062 { 00063 if (pg.alive) 00064 print_alive(); 00065 else 00066 print_notalive(); 00067 }
1.5.8