コード例 #1
0
        public override bool Join(TexasHoldemPlayer <PlayerIdType> player)
        {
            if (player.pointManager.Points > bigBlind)
            {
                return(base.Join(player));
            }

            return(false);
        }
コード例 #2
0
        private void UpdateWhenPlayerBets()
        {
            int iPrevious = (int)seatedPlayers.IndexOf(currentPlayer) - 1;

            if (iPrevious < 0)
            {
                iPrevious = seatedPlayers.Count - 1;
            }
            endingPlayer = seatedPlayers[iPrevious];
        }
コード例 #3
0
        private void NextRound()
        {
            Debug.Assert(round != Round.GameOver);

            foreach (var player in GetPlayers())
            {
                if (player.bet < currentBet)
                {
                    seatedPlayers.Remove(player);
                }
            }

            if (seatedPlayers.Count <= 1)
            {
                round = Round.GameOver;
            }
            else
            {
                round++;
            }

            switch (round)
            {
            case Round.Flop:
                DealToTable(3);
                break;

            case Round.Turn:
                DealToTable(1);
                break;

            case Round.River:
                DealToTable(1);
                break;

            case Round.GameOver:
                EndGame();
                break;

            default:
                Debug.Fail();
                break;
            }

            currentPlayer = firstToAct;
            int iPrevious = (int)seatedPlayers.IndexOf(firstToAct) - 1;

            if (iPrevious < 0)
            {
                iPrevious = seatedPlayers.Count - 1;
            }
            endingPlayer = seatedPlayers[iPrevious];
        }
コード例 #4
0
 private void SelectNextPlayerOrNextRound()
 {
     if (currentPlayer == endingPlayer)
     {
         NextRound();
     }
     else
     {
         int iNext = (int)seatedPlayers.IndexOf(currentPlayer) + 1;
         if (iNext >= seatedPlayers.Count)
         {
             iNext = 0;
         }
         currentPlayer = seatedPlayers[iNext];
     }
 }
コード例 #5
0
        private void UpdateWhenPlayerDrops(uint iPlayerSeat)
        {
            int iNext = (int)iPlayerSeat;

            if (iNext >= seatedPlayers.Count)
            {
                iNext = 0;
            }
            if (currentPlayer.idObject.Equals(firstToAct.idObject))
            {
                firstToAct = seatedPlayers[iNext];
            }

            if (currentPlayer.idObject.Equals(endingPlayer.idObject) || seatedPlayers.Count == 1)
            {
                NextRound();
            }
            else
            {
                currentPlayer = seatedPlayers[iNext];
            }
        }
コード例 #6
0
        public override bool StartGame()
        {
            if (isReadyToStart)
            {
                round = Round.PreFlop;
                ShufflePlayersAndPutInSeats();

                for (int i = 0; i < 2; i++)
                {
                    foreach (var player in seatedPlayers)
                    {
                        DealCard(player.hand);
                    }
                }

                uint iBig = seatedPlayers.Count >= 3 ? 2u : 0u;
                if (bigBlind > 0)
                {
                    ulong littleBlind = bigBlind / 2;
                    seatedPlayers[1].PlaceBet(littleBlind, true);
                    seatedPlayers[(int)iBig].PlaceBet(bigBlind, true);
                }

                uint iFirstToAct = iBig + 1;
                if (iFirstToAct >= seatedPlayers.Count)
                {
                    iFirstToAct = 0;
                }
                firstToAct    = seatedPlayers[(int)iFirstToAct];
                currentPlayer = firstToAct;
                endingPlayer  = seatedPlayers[(int)iBig];
                tableCards.Clear();

                return(true);
            }

            return(false);
        }