Files Classes Functions Hierarchy
#include <playerGame.h>
Public Member Functions | |
| void | notalive_dealCards () |
| void | alive_hold () |
| void | alive_play () |
| void | alive_doubleAndPlay () |
| playerGame () | |
| ~playerGame () | |
Public Attributes | |
| deck * | cards |
| dealer * | deal |
| hand | player |
| uint | dealerWins |
| uint | playerWins |
| uint | bet |
| bool | alive |
Definition at line 8 of file playerGame.h.
| playerGame::playerGame | ( | ) |
Definition at line 10 of file playerGame.cpp.
References alive, cards, deal, dealerWins, and playerWins.
00011 { 00012 dealerWins=0; 00013 playerWins=0; 00014 00015 cards = new deckpontoon(); 00016 deal = new dealer(*cards); 00017 00018 alive=false; 00019 }
| playerGame::~playerGame | ( | ) |
| void playerGame::alive_doubleAndPlay | ( | ) |
Definition at line 101 of file playerGame.cpp.
References alive, alive_play(), and bet.
Referenced by textGame::textGame().
00102 { 00103 assert(alive==true); 00104 00105 bet *= 2; 00106 alive_play(); 00107 }
| void playerGame::alive_hold | ( | ) |
Definition at line 46 of file playerGame.cpp.
References alive, bet, deal, dealerWins, dealer::hnd, hand::isbusted(), dealer::play(), player, playerWins, and hand::value.
Referenced by textGame::textGame().
00047 { 00048 assert(alive==true); 00049 00050 assert(player.isbusted()==false); 00051 00052 deal->play(); 00053 00054 alive=false; 00055 00056 if (deal->hnd.isbusted()) 00057 { 00058 playerWins += bet; 00059 return; 00060 } 00061 00062 if (deal->hnd.value > player.value) 00063 { 00064 dealerWins += bet; 00065 return; 00066 } 00067 00068 if (deal->hnd.value < player.value) 00069 { 00070 playerWins += bet; 00071 return; 00072 } 00073 00074 // Draw game then do nothing. 00075 }
| void playerGame::alive_play | ( | ) |
Definition at line 78 of file playerGame.cpp.
References hand::add(), alive, bet, hand::calculate(), cards, dealerWins, deck::draw(), hand::isbusted(), player, and playerWins.
Referenced by alive_doubleAndPlay(), and textGame::textGame().
00079 { 00080 assert(alive==true); 00081 00082 player.add(cards->draw()); 00083 if (player.isbusted()) 00084 { 00085 alive=false; 00086 dealerWins += bet; 00087 return; 00088 } 00089 00090 if (player.calculate()==21) 00091 { 00092 alive=false; 00093 playerWins += bet; 00094 return; 00095 } 00096 00097 00098 }
| void playerGame::notalive_dealCards | ( | ) |
Definition at line 31 of file playerGame.cpp.
References hand::add(), alive, bet, cards, deal, deck::draw(), dealer::hnd, player, and hand::reset().
Referenced by textGame::textGame().
00032 { 00033 assert(alive==false); 00034 00035 player.reset(); 00036 player.add(cards->draw()); 00037 deal->hnd.reset(); 00038 deal->hnd.add(cards->draw()); 00039 00040 bet=1; 00041 00042 alive=true; 00043 }
Definition at line 30 of file playerGame.h.
Referenced by alive_doubleAndPlay(), alive_hold(), alive_play(), notalive_dealCards(), playerGame(), textGame::printMenu(), and textGame::textGame().
Definition at line 25 of file playerGame.h.
Referenced by alive_doubleAndPlay(), alive_hold(), alive_play(), and notalive_dealCards().
Definition at line 13 of file playerGame.h.
Referenced by alive_play(), notalive_dealCards(), playerGame(), and ~playerGame().
Definition at line 15 of file playerGame.h.
Referenced by alive_hold(), notalive_dealCards(), playerGame(), textGame::printGameState(), and ~playerGame().
Definition at line 20 of file playerGame.h.
Referenced by alive_hold(), alive_play(), playerGame(), and textGame::textGame().
Definition at line 17 of file playerGame.h.
Referenced by alive_hold(), alive_play(), notalive_dealCards(), and textGame::printGameState().
Definition at line 22 of file playerGame.h.
Referenced by alive_hold(), alive_play(), playerGame(), and textGame::textGame().
1.5.8