Exemple #1
0
        private void Smooth(
            IPokerPlayer pokerPlayer,
            Label botStatus,
            int name,
            int n,
            int r,
            int neededChipsToCall,
            TextBox potStatus,
            ref int raise,
            ref bool raising,
            ref int rounds)
        {
            int rnd = this.randomGenerator.Next(1, 3);

            if (neededChipsToCall <= 0)
            {
                this.playerActions.Check(pokerPlayer, botStatus, ref raising);
            }
            else
            {
                if (neededChipsToCall >= PlayerActions.RoundN(pokerPlayer.Chips, n))
                {
                    if (pokerPlayer.Chips > neededChipsToCall)
                    {
                        this.playerActions.Call(
                            pokerPlayer,
                            botStatus,
                            ref raising,
                            ref neededChipsToCall,
                            potStatus);
                    }
                    else if (pokerPlayer.Chips <= neededChipsToCall)
                    {
                        raising = false;
                        pokerPlayer.AbleToMakeTurn = false;
                        pokerPlayer.Chips          = 0;
                        botStatus.Text             = "Call " + pokerPlayer.Chips;
                        potStatus.Text             = (int.Parse(potStatus.Text) + pokerPlayer.Chips).ToString();
                    }
                }
                else
                {
                    if (raise > 0)
                    {
                        if (pokerPlayer.Chips >= raise * 2)
                        {
                            raise *= 2;

                            this.playerActions.Raised(
                                pokerPlayer,
                                botStatus,
                                ref raising,
                                ref raise,
                                ref neededChipsToCall,
                                potStatus);
                        }
                        else
                        {
                            this.playerActions.Call(
                                pokerPlayer,
                                botStatus,
                                ref raising,
                                ref neededChipsToCall,
                                potStatus);
                        }
                    }
                    else
                    {
                        raise = neededChipsToCall * 2;

                        this.playerActions.Raised(
                            pokerPlayer,
                            botStatus,
                            ref raising,
                            ref raise,
                            ref neededChipsToCall,
                            potStatus);
                    }
                }
            }

            if (pokerPlayer.Chips <= 0)
            {
                pokerPlayer.OutOfChips = true;
            }
        }
Exemple #2
0
 public HandTypes(IRandomGenerator randomGenerator)
 {
     this.randomGenerator = randomGenerator;
     this.playerActions = new PlayerActions();
 }
Exemple #3
0
 public HandTypes(IRandomGenerator randomGenerator)
 {
     this.randomGenerator = randomGenerator;
     this.playerActions   = new PlayerActions();
 }