Пример #1
0
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();

}
Пример #2
0
Poker* Poker::create(const char *pszFileName, const CCRect& rect){
	Poker* pk = new Poker();
	if (pk && pk->initWithFile(pszFileName,rect))
	{
		pk->autorelease();
		return pk;
	}
	CC_SAFE_DELETE(pk);
	return pk;
}
Пример #3
0
//============================ Poker  =============================
Poker * Poker::create(pokerColor color, int number){
	Poker* poker = new Poker();

	if (poker && poker->init(color, number))
	{
		poker->autorelease();
        poker->retain();
        
		return poker;
	}
	CC_SAFE_DELETE(poker);
	return nullptr;
}
Пример #4
0
Poker* Poker::copy(){
	Poker* pk;
	if(m_huaSe != Gui)
		pk = Poker::create("poker.png",CCRect(this->m_num*pkWidth,this->m_huaSe*pkHeight,pkWidth,pkHeight));
	else
		pk = Poker::create("poker.png",CCRect((this->m_num-XiaoGui)*pkWidth,this->m_huaSe*pkHeight,pkWidth,pkHeight));
	pk->m_isDianJi = this->m_isDianJi;
	pk->m_isSelect = this->m_isSelect;
	pk->setHuaSe(this->getHuaSe());
	pk->setNum(this->getNum());
	pk->m_gameMain = this->m_gameMain;
	return pk;
}
Пример #5
0
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();
		}
	}

}
Пример #6
0
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



}
Пример #7
0
//creating the cards in hand
void GamePlay::Cards()
{
	Poker a;
	a.playertest(tablehand, hand);
	a.playerval(playerhand);
	a.playersuit(playerhand);

	a.computertest(tablehand, cpuhand);
	a.computerval(computerhand);
	a.computersuit(computerhand);


}
Пример #8
0
int main(int argc, char * argv[])
{
	char selection;
	while (true)
	{
		menu();
		selection = getSelection();
		if (selection == 'b' || selection == 'B') // BlackJack
		{
			cout << "Loading BlackJack..." << endl;
			BlackJack * game = new BlackJack();
			game->play();
			delete game; game = NULL;
		}
		else if (selection == 'p' || selection == 'P') // Poker
		{
			cout << "Loading Poker..." << endl;
			Poker * game = new Poker();
			game->play();
			delete game; game = NULL;
		}
		else if (selection == 't' || selection == 'T') // Texas Holdem
		{
			cout << "Under construction. . ." << endl << endl;
			cin.get();
		}
		else if (selection == 'q' || selection == 'Q') // Quit
			break;
		else
			cout << "Please make a selection." << endl << endl;
	}
	cout << "Thanks for playing!" << endl;
	cout << "Happy Coding!" << endl;
	_getch();
	return 0;
}
Пример #9
0
//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

}
Пример #10
0
int main()
{
	int playerCash = 1000;
	int betAmt = 0;
	cout << "Welcome to Five Card Draw Poker!\n\n";

	bool cont = true;
	char contChar = 'y';

	char fold;

	while (cont == true)
	{
		Poker a; //initialize and shuffle deck

		cout << "You currently have $" << playerCash << " in  your wallet\n\n";
		cout << "How much would you like to bet initially?\n\n";
		cin >> betAmt;
		a.bet(betAmt);
		playerCash -= betAmt;
		cout << "\nYou now have $" << playerCash << " in your wallet\n";

		a.dealPlayer();
		a.oppDeal();
		a.oppSort(); //deal opponent initial cards
		a.sort();
		a.printCards(); //show players hand
		cout << "You currently have $" << playerCash << " in  your wallet\n\n";
		cout << "Do you want to fold?(y/n)\n";
		cin >> fold;

		if (fold == 'n'|| fold == 'N')
		{

			a.newCards();
			a.sort();
			a.printCards();
			a.outputHand(a.evalHand());
			a.oppEval();
			a.oppDraw();

			if (a.detWinner(a.evalHand(), a.oppEval()) == true)
			{
				a.printOppCards();
				cout << "Opponent had " << a.oppString() << "\n\n";
				cout << "You win!\n\n";
				playerCash += a.giveWinnings();
				cout << "You now have $" << playerCash << "in your pot\n\n";
			}
			else
			{
				a.printOppCards();
				cout << "Opponent had " << a.oppString() << "\n\n";
				cout << "You lost\n\n";
			}
		}
			cout << "Play again?(y/n)\n";
			cin >> contChar;
			cout << "\n\n";
			if (contChar == 'n' || contChar == 'N')
				return 0;
	}
}
Пример #11
0
void GamePlay::thirdhand()
{
	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;
	Aesthetics cb;
	system("cls");
	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
	cin.get();
	cout << chand;
	g = 0;
	duringhand = true;
	if (!duringhand)
	{
		cb.text1("You Ran Out of Money!");
		cin.get();
		system("cls");
		Clear();
		NGameMenu();
	}
	if (cash == 0)
	{
		Clear();
		system("cls");
		NGameMenu();
	}
	if (cpucash == 0)
	{
		system("cls");
		Aesthetics a;
		a.textattr(13);
		cout << " " << endl;
		cout << " " << endl;
		cout << "               /////////////////////////////////////////////////" << endl;
		cout << "               // "; a.textattr(3); cout << "*         *  *           *        *       * "; a.textattr(13); cout << "//" << endl;
		cout << "               //    "; a.textattr(3); cout << " * "; a.textattr(6); cout << "    CPU RAN OUT OF MONEY!         "; a.textattr(3); cout << "*   "; a.textattr(13); cout << "//" << endl;
		cout << "               // "; a.textattr(3); cout << "*                                     *     "; a.textattr(13); cout << "//" << endl;
		cout << "               //   "; a.textattr(3); cout << "*          "; a.textattr(6); cout << "You Win!                     "; a.textattr(3); cout << "* "; a.textattr(13); cout << "//" << endl;
		cout << "               //  "; a.textattr(3); cout << "*   "; a.textattr(3); cout << "*                             *    *   "; a.textattr(13); cout << "//" << endl;
		a.textattr(13); cout << "               //"; a.textattr(3); cout << "*********************************************"; a.textattr(13); cout << "//" << endl;
		a.textattr(13); cout << "               /////////////////////////////////////////////////" << endl;
		cout << " " << endl;
		cout << " " << endl;
		cout << " " << endl;
		NGameMenu2();
	}
	NewHand();

}
Пример #12
0
// 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();
	}
}