Exemple #1
0
        private void PH(
            IGameParticipant currentGameParticipant,
            int n,
            int n1,
            int r)
        {
            Random random = new Random();
            int rnd = random.Next(1, 3);

            if (this.rounds < 2)
            {
                if (this.call <= 0)
                {
                    currentGameParticipant.ChooseToCheck(currentGameParticipant);
                }

                if (this.call > 0)
                {
                    if (this.call >= RoundN(currentGameParticipant.Chips, n1))
                    {
                        currentGameParticipant.ChooseToFold(currentGameParticipant);
                    }

                    if (currentGameParticipant.Raise > RoundN(currentGameParticipant.Chips, n))
                    {
                        currentGameParticipant.ChooseToFold(currentGameParticipant);
                    }

                    if (!currentGameParticipant.FoldTurn)
                    {
                        if (this.call >= RoundN(currentGameParticipant.Chips, n) &&
                            this.call <= RoundN(currentGameParticipant.Chips, n1))
                        {
                            this.ChooseToCall(currentGameParticipant);
                        }

                        if (currentGameParticipant.Raise <= RoundN(currentGameParticipant.Chips, n) &&
                            currentGameParticipant.Raise >= RoundN(currentGameParticipant.Chips, n) / 2)
                        {
                            this.ChooseToCall(currentGameParticipant);
                        }

                        if (currentGameParticipant.Raise <= RoundN(currentGameParticipant.Chips, n) / 2)
                        {
                            if (currentGameParticipant.Raise > 0)
                            {
                                currentGameParticipant.Raise = (int)RoundN(currentGameParticipant.Chips, n);
                                this.Raised(currentGameParticipant);
                            }
                            else
                            {
                                currentGameParticipant.Raise = this.call * 2;
                                this.Raised(currentGameParticipant);
                            }
                        }
                    }
                }
            }

            if (this.rounds >= 2)
            {
                if (this.call > 0)
                {
                    if (this.call >= RoundN(currentGameParticipant.Chips, n1 - rnd))
                    {
                        currentGameParticipant.ChooseToFold(currentGameParticipant);
                    }

                    if (currentGameParticipant.Raise > RoundN(currentGameParticipant.Chips, n - rnd))
                    {
                        currentGameParticipant.ChooseToFold(currentGameParticipant);
                    }

                    if (!currentGameParticipant.FoldTurn)
                    {
                        if (this.call >= RoundN(currentGameParticipant.Chips, n - rnd) &&
                            this.call <= RoundN(currentGameParticipant.Chips, n1 - rnd))
                        {
                            this.ChooseToCall(currentGameParticipant);
                        }

                        if (currentGameParticipant.Raise <= RoundN(currentGameParticipant.Chips, n - rnd) &&
                            currentGameParticipant.Raise >= RoundN(currentGameParticipant.Chips, n - rnd) / 2)
                        {
                            this.ChooseToCall(currentGameParticipant);
                        }

                        if (currentGameParticipant.Raise <= RoundN(currentGameParticipant.Chips, n - rnd) / 2)
                        {
                            if (currentGameParticipant.Raise > 0)
                            {
                                currentGameParticipant.Raise = (int)RoundN(currentGameParticipant.Chips, n - rnd);
                                Raised(currentGameParticipant);
                            }
                            else
                            {
                                currentGameParticipant.Raise = this.call * 2;
                                this.Raised(currentGameParticipant);
                            }
                        }
                    }
                }

                if (this.call <= 0)
                {
                    currentGameParticipant.Raise = (int)RoundN(currentGameParticipant.Chips, r - rnd);
                    this.Raised(currentGameParticipant);
                }
            }

            if (currentGameParticipant.Chips <= 0)
            {
                currentGameParticipant.FoldTurn = true;
            }
        }
Exemple #2
0
        void Smooth(
            IGameParticipant currentGameParticipant,
            int call,
            int raise)
        {
            //Random random = new Random();
            //int rnd = random.Next(1, 3);
            if (this.call <= 0)
            {
                currentGameParticipant.ChooseToCheck(currentGameParticipant);
            }
            else
            {
                if (this.call >= RoundN(currentGameParticipant.Chips, call))
                {
                    if (currentGameParticipant.Chips > this.call)
                    {
                        this.ChooseToCall(currentGameParticipant);
                    }
                    else if (currentGameParticipant.Chips <= this.call)
                    {
                        currentGameParticipant.RaiseTurn = false;
                        currentGameParticipant.Turn = false;
                        currentGameParticipant.Chips = 0;
                        currentGameParticipant.ParticipantPanel.StatusButton.Text =
                            "Call " + currentGameParticipant.Chips;
                        this.potTextBox.Text =
                            (int.Parse(this.potTextBox.Text) + currentGameParticipant.Chips).ToString();
                    }
                }
                else
                {
                    if (currentGameParticipant.Raise > 0)
                    {
                        if (currentGameParticipant.Chips >= currentGameParticipant.Raise * 2)
                        {
                            currentGameParticipant.Raise *= 2;
                            this.Raised(currentGameParticipant);
                        }
                        else
                        {
                            this.ChooseToCall(currentGameParticipant);
                        }
                    }
                    else
                    {
                        currentGameParticipant.Raise = this.call * 2;
                        this.Raised(currentGameParticipant);
                    }
                }
            }

            if (currentGameParticipant.Chips <= 0)
            {
                currentGameParticipant.FoldTurn = true;
            }
        }
Exemple #3
0
        // private void HP(ref int sChips, ref bool sTurn, ref bool sFTurn, Label sStatus, double botPower, int n, int n1)
        private void HP(
            IGameParticipant currrentGameParticipant,
            int n,
            int n1)
        {
            Random random = new Random();
            int rnd = random.Next(1, 4);

            if (this.call <= 0)
            {
                currrentGameParticipant.ChooseToCheck(currrentGameParticipant);
            }

            if (this.call > 0)
            {
                if (rnd == 1)
                {
                    if (this.call <= RoundN(currrentGameParticipant.Chips, n))
                    {
                        this.ChooseToCall(currrentGameParticipant);
                    }
                    else
                    {
                        currrentGameParticipant.ChooseToFold(currrentGameParticipant);
                    }
                }

                if (rnd == 2)
                {
                    if (this.call <= RoundN(currrentGameParticipant.Chips, n1))
                    {
                        this.ChooseToCall(currrentGameParticipant);
                    }
                    else
                    {
                        currrentGameParticipant.ChooseToFold(currrentGameParticipant);
                    }
                }
            }

            if (rnd == 3)
            {
                if (currrentGameParticipant.Raise == 0)
                {
                    currrentGameParticipant.Raise = this.call * 2;
                    this.Raised(currrentGameParticipant);
                }
                else
                {
                    if (currrentGameParticipant.Raise <= RoundN(currrentGameParticipant.Chips, n))
                    {
                        currrentGameParticipant.Raise = this.call * 2;
                        this.Raised(currrentGameParticipant);
                    }
                    else
                    {
                        currrentGameParticipant.ChooseToFold(currrentGameParticipant);
                    }
                }
            }

            if (currrentGameParticipant.Chips <= 0)
            {
                currrentGameParticipant.FoldTurn = true;
            }
        }