Пример #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
void GamePlay::River()
{
	Setup();
	tablehand = hands.dealCards(deck, tablehand, 1);
	Cards(); //creating the hands  
	getValues();
	uiText();
	betSystem();
	finalCards();
}
Пример #3
0
void GamePlay::Turn()
{

	Setup();
	tablehand = hands.dealCards(deck, tablehand,  1);
	Cards();
	getValues();
	uiText();
	betSystem();
	River();
}
Пример #4
0
void GamePlay::makeHands()
{
	
	deck = hands.createdeck(deck);
	tablehand = hands.dealCards(deck,tablehand, 3);
	hand = hands.dealCards(deck,hand,2);
	for (size_t i = 0; i < listOfComputerPlayers.size(); i++)
	{
		listOfComputerPlayers[i].cpuhand = hands.dealCards(deck, listOfComputerPlayers[i].cpuhand, 2);
		listOfComputerPlayers[i].computerHandText = "??????";
	}
	Cards();//creating the hands  
}
Пример #5
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();

}
Пример #6
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();
	}
}
Пример #7
0
int main(int argc, char** argv) {

	Player **Gamer;
	int numberOfGamers = 6; // количество игроков за столом
	int numberOfRounds=4;
	Gamer = new Player*[6]; // 6 игроков
	Pack Cards(0); // колода карт
	Card FiveCard[5]; // 5 общих карт
	int nRound = 1; // первый круг торговли
	/* создадим numberOfGamers игроков */
	for (int i = 0; i < numberOfGamers; i++) {
		Gamer[i] = new Player("Gamer" + from_int(i), 50, i);
		Gamer[i][0].SetCards(Cards.getCard(), Cards.getCard());
		std::cout << Gamer[i][0].getLogin() << " "
				<< Gamer[i][0].GetFirstCard().getRank() << " of "
				<< Gamer[i][0].GetFirstCard().getSuit() << " ";
		std::cout << Gamer[i][0].GetSecondCard().getRank() << " of "
				<< Gamer[i][0].GetSecondCard().getSuit() << std::endl;
	}
	// ставки игроков для теста
	/*
	int Stavki[4][6] = {
			{ 2, 2, 2, 2, 2, 2 },
			{ 6, 5, 6, 6, 6, 6 },
			{ 6, 0, 4, 5, 6, 6 },
			{ 2, 0, 0, 0, 4, 5 } };*/
	int **Stavki= new int*[numberOfRounds];
		for (int i=0;i<numberOfRounds;i++)
			Stavki[i]= new int[numberOfGamers];
	createSetOfStakes(Stavki,numberOfRounds,numberOfGamers);
	// объявление банка
	Bank bank(Gamer, numberOfGamers);
	// круг торговли и заполнение банка
	std::cout << "Round " << nRound << std::endl;
	// ставки игроков
	for (int i = 0; i < numberOfGamers; i++) {
		std::cout << "Gamer" << i + 1 << " stake is " << Stavki[nRound - 1][i]
				<< " ";
		bank.addPlayer(*Gamer[i], Stavki[nRound - 1][i], nRound - 1);
	}
	std::cout << std::endl;

	std::cout << "------------Card Pack-----------" << std::endl;
	for (int i = 0; i < 3; i++) {
		FiveCard[i] = Cards.getCard();
		std::cout << FiveCard[i].getRank() << " of " << FiveCard[i].getSuit()
				<< std::endl;
	}

	// круг торговли и заполнение банка
	std::cout << "Round " << ++nRound <<std::endl;
	// ставки игроков
	for (int i = 0; i < numberOfGamers; i++) {
		std::cout << "Gamer" << i + 1 << " stake is" << Stavki[nRound - 1][i]
				<< " ";
		bank.addPlayer(*Gamer[i], Stavki[nRound - 1][i], nRound - 1);
	}
	std::cout << std::endl;

	std::cout << "------------Card Pack-----------" << std::endl;
	FiveCard[3] = Cards.getCard();
	for (int i = 0; i < 4; i++) {
		std::cout << FiveCard[i].getRank() << " of " << FiveCard[i].getSuit()
				<< std::endl;
	}

	// круг торговли и заполнение банка
	std::cout << "Round " << ++nRound << std::endl;;
	// ставки игроков
	for (int i = 0; i < numberOfGamers; i++) {
		std::cout << "Gamer" << i + 1 << " stake is " << Stavki[nRound - 1][i]
				<< " ";
		bank.addPlayer(*Gamer[i], Stavki[nRound - 1][i], nRound - 1);
	}
	std::cout << std::endl;

	std::cout << "------------Card Pack-----------" << std::endl;
	FiveCard[4] = Cards.getCard();
	for (int i = 0; i < 5; i++) {
		std::cout << FiveCard[i].getRank() << " of " << FiveCard[i].getSuit()
				<< std::endl;
	}

	// последний круг торговли и заполнение банка
	std::cout << "Round " << ++nRound << std::endl;
	// ставки игроков
	for (int i = 0; i < numberOfGamers; i++) {
		std::cout << "Gamer" << i + 1 << " stake is" << Stavki[nRound - 1][i]
				<< " ";
		bank.addPlayer(*Gamer[i], Stavki[nRound - 1][i], nRound - 1);
	}
	std::cout << std::endl;

	Calculation counting(Gamer, FiveCard, 6);
	counting.WinnersCalc();
	for (int i = 0; i < 6; i++) {
		std::cout << Gamer[i][0].getLogin() << " is in "
				<< Gamer[i][0].getWinPlace() << " place " << " has "
				<< counting.GetCombinationName(Gamer[i]) << std::endl;
	}
	// раздача денег
	bank.winners();

	std::cout << std::endl;
	for (int i = 0; i < numberOfGamers; i++) {
		std::cout << "Position table: " << Gamer[i]->getPosition() << " "<<Gamer[i]->getLogin()<<" ";
		std::cout << Gamer[i]->getPurse() << "$"<<std::endl;
	}
	std::cout << "SumBank: " << bank.getSumBank() << std::endl;

	for (int i = 0; i < 6; i++) {
		delete[] Gamer[i];
	}
	delete[] Gamer;
	return 0;
}
Пример #8
0
void GamePlay::finalCards()
{
	//CHANGE ME
	PlayerHandValue = 0;
	listOfComputerPlayers[0].CpuHandValue = 0;
	showComputer = true;
	shows = true;

	system("cls");
	if (tablehand.size() < 4)
	{

		tablehand = hands.dealCards(deck, tablehand, 2);
	}
	if (tablehand.size() < 5)
	{

		tablehand = hands.dealCards(deck, tablehand, 1);
	}
	Cards();
	getValues();
	
	if (playerFold == true)
	{
		PlayerHandValue = 0;
	}
	for (size_t i = 0; i < listOfComputerPlayers.size(); i++)
	{

			listOfComputerPlayers[i].computerHandText = checks.handText(listOfComputerPlayers[i].CpuHandValue);
		
	}

	determine();

	uiText();

	if (listOfComputerPlayers.size() == 1)
	{
		drawcard.createhand(hand, 25, 40);
		drawcard.createhand(tablehand, 5, 20);
		drawcard.createhand(listOfComputerPlayers[0].cpuhand, 24, 3);
	}
	if (listOfComputerPlayers.size() == 2)
	{
		drawcard.createhand(hand, 25, 40);
		drawcard.createhand(tablehand, 5, 20);
		drawcard.createhand(listOfComputerPlayers[0].cpuhand, 1, 3);
		drawcard.createhand(listOfComputerPlayers[1].cpuhand, 60, 3);
	}
	if (listOfComputerPlayers.size() == 3)
	{
		drawcard.createhand(hand, 1, 40);
		drawcard.createhand(tablehand, 5, 20);
		drawcard.createhand(listOfComputerPlayers[0].cpuhand, 1, 3);
		drawcard.createhand(listOfComputerPlayers[1].cpuhand, 60, 3);
		drawcard.createhand(listOfComputerPlayers[2].cpuhand, 60, 40);
	}


	cin.get();


	gameoverCheck();

	Clear();
	system("cls");
	Flop();
}