void GamePlay::thirdhand2() { Checks b; PlayerHandValue = 0; CpuHandValue = 0; result = ""; int x = 24; int y = 3; showc = true; shows = true; PressEnterToContinue = "Press Enter To Continue..."; Checks ck; Poker a; system("cls"); a.tablecards(deck, 10); a.createhand(hand, 25, 40); a.createtable(tablehand, 5, 17); // this will create the table, passing in the table hand, always pass in 5 and 7 for location Cards(); a.createtable(cpuhand, x, y);//creating the hands PlayerHandValue = ck.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue CpuHandValue = ck.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue if (foldv) { PlayerHandValue = 0; } ck.determine(PlayerHandValue, CpuHandValue); if (showc) { chand = chand; } if (shows) { PressEnterToContinue = PressEnterToContinue; } if (!foldc) { fold = " "; } if (foldc == true) { //fold = "YOU LOSE!"; } Text(); // method to display the text on screen cout << chand; cin.get(); g = 0; cash = 0; if (cash == 0) { Clear(); system("cls"); NGameMenu(); } NewHand(); }
void GamePlay::CpuFold(int CpuHandValue) { Poker a; if (cpucash > 0) { if (CpuHandValue < 5) { cpubet = 0; cpucash = cpucash - cpubet; pot = pot + cpubet; a.tablecards(deck, 10); //thirdhand(); Fold(); } } }
void GamePlay::NewHand() { Poker a; foldc = false; //call the NewHand method to begin a new hand without changing the pot and cash values Clear();// clearing all stored variables cash = cash; cpucash = cpucash; system("cls"); // clearing the screen a.createdeck(deck); // creating a deck of cards a.tablecards(deck, 8); // creating the table cards passing value for amount of cards // begins at 5, so 8 for 3 cards 9 for 4 cards and 10 for 5 cards, should be able to clear tablecards and pass in //new value as long as deck is not shuffled so starts at 8, bet 1 add card bet 2 add another, bet 3 determine winner a.playercard(deck);// creates the players hand with 2 cards a.cpucard(deck);//creates the players hand with 2 cards Game(); // begins the game }
//resets all game stuff void GamePlay::Start() //What user will see first, displays start money (Omoney) { Poker a; //call the Start method when you want to start a new game Clear();// clearing all stored variables //GamePlay(); system("cls"); // clearing the screen cash = 200; // initializing player cash amount cpucash = 200; // initializing cpu cash amount pot = 0; // initializing pot value to 0 a.createdeck(deck); // creating a deck of cards //a.shuffle(deck); // shuffling the deck a.tablecards(deck, 8); // creating the table cards passing value for amount of cards // begins at 5, so 8 for 3 cards 9 for 4 cards and 10 for 5 cards, should be able to clear tablecards and pass in //new value as long as deck is not shuffled so starts at 8, bet 1 add card bet 2 add another, bet 3 determine winner a.playercard(deck);// creates the players hand with 2 cards a.cpucard(deck);//creates the players hand with 2 cards a.createhand(hand, 25, 40); // draw player cards, passing in hand, 5 and 20 stay the same for location a.createtable(tablehand, 5, 17);// drawing the table cards passing in table hand, 5 and 7 stay for location Game(); // begins the game }
// main game logic goes in here void GamePlay::Game() { Checks ck1; Checks ck2; Checks ck3; Poker a; int x = 24; int y = 3; duringhand = true; if (g == 0) { PlayerHandValue = 0; CpuHandValue = 0; result = ""; system("cls"); showc = false; shows = false; foldc = false; fold = " "; a.createhand(hand, 25, 40); a.createtable(tablehand, 5, 17); // this will create the table, passing in the table hand, always pass in 5 and 7 for location Cards();//creating the hands a.drawdefaultcpu(cpuhand, x, y); PlayerHandValue = ck1.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue CpuHandValue = ck1.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue if (!showc) { chand = "?????"; } if (!shows) { PressEnterToContinue = " "; } if (!foldc) { fold = " "; } random = rand() % 10; if (random < 3) { CpuFold(CpuHandValue); } Text(); // method to display the text on screen // //betting logic // method for cpu betting logic, passing in CpuHandValue to determine what it does bet = menu(); // storing the variable returned from menu class to bet Betting(bet); // player betting method passing in the value stored at bet CpuBetting(bet); g++; Game(); } if (g == 1) { PlayerHandValue = 0; CpuHandValue = 0; result = ""; system("cls"); a.createhand(hand, 25, 40); if (!allin) { a.tablecards(deck, 9); } a.createtable(tablehand, 5, 17); a.createtable(tablehand, 5, 17);// this will create the table, passing in the table hand, always pass in 5 and 7 for location Cards();//creating the hands a.drawdefaultcpu(cpuhand, x, y); PlayerHandValue = ck2.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue CpuHandValue = ck2.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue if (!showc) { chand = "?????"; } if (!shows) { PressEnterToContinue = " "; } if (!foldc) { fold = " "; } random = rand() % 10; if (random < 3) { CpuFold(CpuHandValue); } Text(); // method to display the text on screen // bet = menu(); // storing the variable returned from menu class to bet Betting(bet); // player betting method passing in the value stored at bet CpuBetting(bet); g = 2; //Game(); } if (g == 2) { PlayerHandValue = 0; CpuHandValue = 0; result = ""; system("cls"); a.createhand(hand, 25, 40); if (!allin) { a.tablecards(deck, 10); } a.createtable(tablehand, 5, 17); // this will create the table, passing in the table hand, always pass in 5 and 7 for location Cards();//creating the hands a.drawdefaultcpu(cpuhand, x, y); PlayerHandValue = ck3.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue CpuHandValue = ck3.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue if (!showc) { chand = "?????"; } if (!shows) { PressEnterToContinue = " "; } if (!foldc) { fold = " "; } random = rand() % 10; if (random < 3) { CpuFold(CpuHandValue); } Text(); // method to display the text on screen // bet = menu(); // storing the variable returned from menu class to bet Betting(bet); // player betting method passing in the value stored at bet CpuBetting(bet); g = 3; //Game(); } if (g == 3) { thirdhand(); } }