예제 #1
0
void RoundManager::fold()
{
	/*
	1. reduce amountOfPlayeresRemaining--
	2. adjust array to fill the gaps
	3. check if theres more than 1 available
	4. if so, keep going
	5. if not, trigger roundOver();
	*/

	amountOfPlayersRemaining--;

	if (amountOfPlayersRemaining > 1)
	{
		for (int i = currentPlayerIndex; i < amountOfPlayersRemaining; ++i)
			players[i] = players[i + 1];

		playersDidActions--;
		currentPlayerIndex--;

		finishTurn();
	}
	else
		roundOver();




}
예제 #2
0
파일: Room.cpp 프로젝트: dyf303/Landlord
void Room::UpdateThree(uint32 diff)
{
	threePlayerList::iterator itr = _threePlayerList.begin();
	for (threePlayerList::iterator itr = _threePlayerList.begin(),next; itr != _threePlayerList.end(); itr = next)
	{
		next = itr;
		next++;
		if (LogoutThree(*itr))
		{
			_threePlayerList.erase(itr);
			continue;
		}
		if (allStart(*itr) && allAtThree(*itr) && allWaitDealCards(*itr))
		{
			dealCards(*itr);
		}
		if (roundOver(*itr))
		{
			_threePlayerList.erase(itr);
		}
	}
}
예제 #3
0
// possible 4th step in "casual round loop". might be called from step 3, but not necessarily
void RoundManager::roundStateSwitch()
{
	if (roundState == PREFLOP)
	{
		currentPlayerIndex = (dealerIndex) % amountOfPlayersRemaining;

		int flop0[2] = { FMath::RandRange(0, 3), FMath::RandRange(0, 12) };
		int flop1[2] = { FMath::RandRange(0, 3), FMath::RandRange(0, 12) };
		int flop2[2] = { FMath::RandRange(0, 3), FMath::RandRange(0, 12) };

		while (!controlDeck(flop0[0], flop0[1]))
		{
			flop0[0] = FMath::RandRange(0, 3);
			flop0[1] = FMath::RandRange(0, 12);
		}

		while (!controlDeck(flop1[0], flop1[1]))
		{
			flop1[0] = FMath::RandRange(0, 3);
			flop1[1] = FMath::RandRange(0, 12);
		}

		while (!controlDeck(flop2[0], flop2[1]))
		{
			flop2[0] = FMath::RandRange(0, 3);
			flop2[1] = FMath::RandRange(0, 12);
		}

		flop[0] = new Card(flop0[0], flop0[1]);
		flop[1] = new Card(flop1[0], flop1[1]);
		flop[2] = new Card(flop2[0], flop2[1]);

	}
	else if (roundState == FLOP)
	{
		currentPlayerIndex = (dealerIndex) % amountOfPlayersRemaining;

		int turnA[2] = { FMath::RandRange(0, 3), FMath::RandRange(0, 12) };

		while (!controlDeck(turnA[0], turnA[1]))
		{
			turnA[0] = FMath::RandRange(0, 3);
			turnA[1] = FMath::RandRange(0, 12);
		}

		turn = new Card(turnA[0], turnA[1]);
	}
	else if (roundState == TURN)
	{
		currentPlayerIndex = (dealerIndex) % amountOfPlayersRemaining;

		int riverA[2] = { FMath::RandRange(0, 3), FMath::RandRange(0, 12) };

		while (!controlDeck(riverA[0], riverA[1]))
		{
			riverA[0] = FMath::RandRange(0, 3);
			riverA[1] = FMath::RandRange(0, 12);
		}

		river = new Card(riverA[0], riverA[1]);
	}
	else if (roundState == RIVER)
	{
		roundOver();
	}


	lastBet = bigBlind;
	playersDidActions = 0;
	roundState++;
}