Exemplo n.º 1
0
        public override void ExecuteChoice(int factorN, int factorN1, int randParameter)
        {
            IPlayer bot           = this.PokerTable.Database.Players[this.Index];
            Label   botStatus     = bot.Status;
            double  formulaResult = 0;

            Random optionsGenerator = new Random();
            double randChoice       = optionsGenerator.Next(1, 3);

            if (this.PokerTable.Database.CallAmount <= 0)
            {
                this.Check(botStatus, bot);
            }
            else
            {
                formulaResult = BotHandlerUtil.ChoiceFormula(bot.ChipsAmount, factorN);
                if (this.PokerTable.Database.CallAmount >= formulaResult)
                {
                    if (bot.ChipsAmount > this.PokerTable.Database.CallAmount)
                    {
                        this.Call(botStatus, bot);
                    }
                    else if (bot.ChipsAmount <= this.PokerTable.Database.CallAmount)
                    {
                        this.AllInCall(botStatus, bot);
                    }
                }
                else
                {
                    if (this.PokerTable.Database.RaiseAmount > 0)
                    {
                        if (bot.ChipsAmount >= this.PokerTable.Database.RaiseAmount * 2)
                        {
                            this.PokerTable.Database.RaiseAmount *= 2;
                            this.Raise(botStatus, bot);
                        }
                        else
                        {
                            this.Call(botStatus, bot);
                        }
                    }
                    else
                    {
                        this.PokerTable.Database.RaiseAmount = this.PokerTable.Database.CallAmount * 2;
                        this.Raise(botStatus, bot);
                    }
                }
            }

            if (bot.ChipsAmount <= 0)
            {
                bot.Bet = BetOptions.AllIn;
            }
        }
Exemplo n.º 2
0
        public override void ExecuteChoice(int factorN, int factorN1, int randParameter)
        {
            IPlayer bot             = this.PokerTable.Database.Players[this.Index];
            Label   botStatus       = bot.Status;
            double  formulaResultN  = BotHandlerUtil.ChoiceFormula(bot.ChipsAmount, factorN);
            double  formulaResultN1 = BotHandlerUtil.ChoiceFormula(bot.ChipsAmount, factorN1);

            Random optionsGenerator = new Random();
            int    randChoice       = optionsGenerator.Next(1, 3);

            if (this.PokerTable.Database.RoundType < CommunityCardRound.Turn)
            {
                if (this.PokerTable.Database.CallAmount <= 0)
                {
                    this.Check(botStatus, bot);
                }

                ////If he needs to call or raise
                if (this.PokerTable.Database.CallAmount > 0)
                {
                    if (this.PokerTable.Database.CallAmount >= formulaResultN)
                    {
                        this.Fold(botStatus, bot);
                    }

                    if (this.PokerTable.Database.RaiseAmount > formulaResultN)
                    {
                        this.Fold(botStatus, bot);
                    }

                    if (bot.Bet != BetOptions.Fold)
                    {
                        if (this.PokerTable.Database.CallAmount >= formulaResultN && this.PokerTable.Database.CallAmount <= formulaResultN1)
                        {
                            this.Call(botStatus, bot);
                        }

                        if (this.PokerTable.Database.RaiseAmount <= formulaResultN && this.PokerTable.Database.RaiseAmount >= formulaResultN1 / 2)
                        {
                            this.Call(botStatus, bot);
                        }

                        if (this.PokerTable.Database.RaiseAmount <= formulaResultN / 2)
                        {
                            if (this.PokerTable.Database.RaiseAmount > 0)
                            {
                                this.PokerTable.Database.RaiseAmount = formulaResultN;
                                this.Raise(botStatus, bot);
                            }
                            else
                            {
                                this.PokerTable.Database.RaiseAmount = this.PokerTable.Database.CallAmount * 2;
                                this.Raise(botStatus, bot);
                            }
                        }
                    }
                }
            }

            if (this.PokerTable.Database.RoundType >= CommunityCardRound.Turn)
            {
                if (this.PokerTable.Database.CallAmount > 0)
                {
                    formulaResultN1 = BotHandlerUtil.ChoiceFormula(bot.ChipsAmount, factorN1 - randChoice);
                    if (this.PokerTable.Database.CallAmount >= formulaResultN1)
                    {
                        this.Fold(botStatus, bot);
                    }

                    formulaResultN = BotHandlerUtil.ChoiceFormula(bot.ChipsAmount, factorN - randChoice);
                    if (this.PokerTable.Database.RaiseAmount > formulaResultN)
                    {
                        this.Fold(botStatus, bot);
                    }

                    if (bot.Bet != BetOptions.Fold)
                    {
                        if (this.PokerTable.Database.CallAmount >= formulaResultN && this.PokerTable.Database.CallAmount <= formulaResultN1)
                        {
                            this.Call(botStatus, bot);
                        }

                        if (this.PokerTable.Database.RaiseAmount <= formulaResultN && this.PokerTable.Database.RaiseAmount >= formulaResultN)
                        {
                            this.Call(botStatus, bot);
                        }

                        if (this.PokerTable.Database.RaiseAmount <= formulaResultN / 2)
                        {
                            if (this.PokerTable.Database.RaiseAmount > 0)
                            {
                                this.PokerTable.Database.RaiseAmount = formulaResultN;
                                this.Raise(botStatus, bot);
                            }
                            else
                            {
                                this.PokerTable.Database.RaiseAmount = this.PokerTable.Database.CallAmount * 2;
                                this.Raise(botStatus, bot);
                            }
                        }
                    }
                }

                if (this.PokerTable.Database.CallAmount <= 0)
                {
                    formulaResultN = BotHandlerUtil.ChoiceFormula(bot.ChipsAmount, randParameter - randChoice);
                    this.PokerTable.Database.RaiseAmount = formulaResultN;
                    this.Raise(botStatus, bot);
                }
            }

            if (bot.ChipsAmount <= 0)
            {
                bot.Bet = BetOptions.AllIn;
            }
        }