Ejemplo n.º 1
0
        /// <summary>
        /// Bot makes calculations and decides how to play his turn based on several factors
        /// </summary>
        /// <param name="currentHighestBet">The current highest bet on the board.</param>
        /// <param name="playersNotFolded">The number of players not folded.</param>
        /// <param name="canCheck">if set to <c>true</c> the bot [can check] 
        /// (true only if no one has called or raised before him and the turn part is past the flop).</param>
        /// <param name="currentPartOfTurn">The current part of the turn.</param>
        /// <param name="randomBehavior">The random behavior that's one of the factors in the bots decision making.</param>
        public void PlayTurn(ref int currentHighestBet, int playersNotFolded, bool canCheck, TurnParts currentPartOfTurn, Random randomBehavior)
        {
            CardPowerCalculator.GetCurrentStrengthOfCards(this.Hand);
            int feelingLucky = randomBehavior.Next(0, 100);
            int bluff = randomBehavior.Next(0, 10);
            int turnPartFactor = (int)currentPartOfTurn * 40;

            if (this.CheckShouldRaise(playersNotFolded, turnPartFactor, feelingLucky, bluff))
            {
                this.Raise(currentHighestBet * 2, ref currentHighestBet);
            }
            else if (this.CheckShouldCall(playersNotFolded, turnPartFactor, feelingLucky, bluff))
            {
                this.Call(currentHighestBet);
            }
            else if (canCheck)
            {
                this.Check();
            }
            else
            {
                this.Fold();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Bot makes calculations and decides how to play his turn based on several factors
        /// </summary>
        /// <param name="currentHighestBet">The current highest bet on the board.</param>
        /// <param name="playersNotFolded">The number of players not folded.</param>
        /// <param name="canCheck">if set to <c>true</c> the bot [can check]
        /// (true only if no one has called or raised before him and the turn part is past the flop).</param>
        /// <param name="currentPartOfTurn">The current part of the turn.</param>
        /// <param name="randomBehavior">The random behavior that's one of the factors in the bots decision making.</param>
        public void PlayTurn(ref int currentHighestBet, int playersNotFolded, bool canCheck, TurnParts currentPartOfTurn, Random randomBehavior)
        {
            CardPowerCalculator.GetCurrentStrengthOfCards(this.Hand);
            int feelingLucky   = randomBehavior.Next(0, 100);
            int bluff          = randomBehavior.Next(0, 10);
            int turnPartFactor = (int)currentPartOfTurn * 40;

            if (this.CheckShouldRaise(playersNotFolded, turnPartFactor, feelingLucky, bluff))
            {
                this.Raise(currentHighestBet * 2, ref currentHighestBet);
            }
            else if (this.CheckShouldCall(playersNotFolded, turnPartFactor, feelingLucky, bluff))
            {
                this.Call(currentHighestBet);
            }
            else if (canCheck)
            {
                this.Check();
            }
            else
            {
                this.Fold();
            }
        }