Example #1
0
        private void SetCallButtonTextIfNeeded()
        {
            int uncalledBet = CurrentHand.GetHighestBetNotInPot() - CurrentPlayer.CurrentBet;

            if (uncalledBet > 0)
            {
                GameController.Instance.SetCallButtonText(uncalledBet.ToString());
            }
        }
Example #2
0
        private void SetBetButtonTextIfNeeded()
        {
            int  uncalledBet = CurrentHand.GetHighestBetNotInPot() - CurrentPlayer.CurrentBet;
            bool canBet      = uncalledBet == 0 && !CurrentHandState.Instance.IsPreflop;

            if (canBet)
            {
                GameController.Instance.SetBetButtonText(_bigBlindSize.ToString());
            }
        }
Example #3
0
        private void SetRaiseButtonTextIfNeeded()
        {
            int  uncalledBet = CurrentHand.GetHighestBetNotInPot() - CurrentPlayer.CurrentBet;
            bool canRaise    = uncalledBet > 0 && CurrentPlayer.ChipCount > uncalledBet;

            if (canRaise)
            {
                int minRaiseAmount = Math.Min(CurrentHand.GetHighestBetNotInPot() * 2, CurrentPlayer.ChipCount);
                GameController.Instance.SetRaiseButtonText(minRaiseAmount.ToString());
            }
        }
Example #4
0
        private bool NeedToDealNextStreet()
        {
            bool allThePlayersMadeTurn = true;
            bool noUncalledBets        = true;
            int  playerNotAllInCount   = 0;

            foreach (Player player in CurrentHand.PlayersInvolved)
            {
                if (player.IsAllIn)
                {
                    continue;
                }

                playerNotAllInCount++;

                int uncalledBet = CurrentHand.GetHighestBetNotInPot() - player.CurrentBet;
                if (uncalledBet > 0)
                {
                    noUncalledBets = false;
                }

                if (!player.HasMadeTurn)
                {
                    allThePlayersMadeTurn = false;
                }
            }

            if (noUncalledBets)
            {
                if (allThePlayersMadeTurn || playerNotAllInCount <= 1)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        private PlayerState GetActivePlayerState()
        {
            if (CurrentPlayer.IsAI)
            {
                return(PlayerState.IsAI);
            }

            int  uncalledBet = CurrentHand.GetHighestBetNotInPot() - CurrentPlayer.CurrentBet;
            bool canCall     = uncalledBet > 0;
            bool canCheck    = uncalledBet == 0;
            bool canBet      = canCheck && !CurrentHandState.Instance.IsPreflop;
            bool canRaise    = uncalledBet >= 0 && CurrentPlayer.ChipCount > uncalledBet;

            if (CurrentPlayer.IsAllIn)
            {
                return(PlayerState.IsAllIn);
            }
            else if (canCall && canRaise)
            {
                return(PlayerState.CanFoldCallRaise);
            }
            else if (canCheck && canBet)
            {
                return(PlayerState.CanFoldCheckBet);
            }
            else if (canCheck && canRaise)
            {
                return(PlayerState.CanFoldCheckRaise);
            }
            else if (canCall)
            {
                return(PlayerState.CanFoldCall);
            }

            return(PlayerState.Invalid);
        }