Example #1
0
        //public void ChooseToCall(IGameParticipant currentChooseToCall);

        //public void ChooseToRaise(IGameParticipant currentChooseToCall);

        public void ChooseToFold(IGameParticipant currentGameParticipant)
        {
            currentGameParticipant.RaiseTurn = false;
            currentGameParticipant.ParticipantPanel.StatusButton.Text = "Is Folded";
            currentGameParticipant.Turn = false;
            currentGameParticipant.FoldTurn = true;
        }
Example #2
0
        private void rTwoPair(IGameParticipant currentGameParticipant)
        {
            // TODO: Extract method
            for (int tc = 16; tc >= 12; tc--)
            {
                int max = tc - 12;
                if (this.reserve[0] / 4 != this.reserve[0 + 1] / 4)
                {
                    for (int k = 1; k <= max; k++)
                    {
                        if (tc - k < 12)
                        {
                            max--;
                        }
                        else
                        {
                            if (this.reserve[0] / 4 == this.reserve[tc] / 4 &&
                                this.reserve[0 + 1] / 4 == this.reserve[tc - k] / 4 ||
                                this.reserve[0 + 1] / 4 == this.reserve[tc] / 4 &&
                                this.reserve[0] / 4 == this.reserve[tc - k] / 4)
                            {
                                if (this.reserve[0] / 4 == 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)(13 * 4 + (this.reserve[0 + 1] / 4) * 2 + currentGameParticipant.Type * 100);
                                    this.AddWin(
                                        currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }

                                if (this.reserve[0 + 1] / 4 == 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)(13 * 4 + (this.reserve[0] / 4) * 2 + currentGameParticipant.Type * 100);
                                    this.AddWin
                                        (currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }

                                if (this.reserve[0 + 1] / 4 != 0 &&
                                    this.reserve[0] / 4 != 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)((this.reserve[0] / 4) * 2 + (this.reserve[0 + 1] / 4) * 2 + currentGameParticipant.Type * 100);
                                    this.AddWin(
                                        currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        // TODO: Extract method
        private void rFullHouse(
            IGameParticipant currentGameParticipant,
            int[] straight)
        {
            this.type = currentGameParticipant.Power;
            for (int j = 0; j <= 12; j++)
            {
                var fh = straight.Where(o => o / 4 == j).ToArray();
                if (fh.Length == 3)
                {
                    if (fh.Length == 2)
                    {
                        if (fh.Max() / 4 == 0)
                        {
                            currentGameParticipant.Type = 6;
                            currentGameParticipant.Power =
                                (int)(13 * 2 + currentGameParticipant.Type * 100);
                            this.AddWin(
                                currentGameParticipant.Power,
                                currentGameParticipant.Type);
                            break;
                        }

                        if (fh.Max() / 4 > 0)
                        {
                            currentGameParticipant.Type = 6;
                            currentGameParticipant.Power =
                                (int)(fh.Max() / 4 * 2 + currentGameParticipant.Type * 100);
                            this.AddWin(
                                currentGameParticipant.Power,
                                currentGameParticipant.Type);
                            break;
                        }
                    }


                    if (fh.Max() / 4 == 0)
                    {
                        currentGameParticipant.Power = 13;
                        j = -1;
                    }
                    else
                    {
                        currentGameParticipant.Power = fh.Max() / 4;
                        j = -1;
                    }
                }
            }

            if (currentGameParticipant.Type != 6)
            {
                currentGameParticipant.Power = (int)this.type;
            }
        }
Example #4
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;
            }
        }
Example #5
0
        private void rStraightFlush(
            IGameParticipant currentGameParticipant,
            int[] st1,
            int[] st2,
            int[] st3,
            int[] st4)
        {
            if (st1.Length >= 5)
            {
                if (st1[0] + 4 == st1[4])
                {
                    currentGameParticipant.Type = 8;
                    currentGameParticipant.Power =
                        (int)(st1.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (st1[0] == 0 &&
                    st1[1] == 9 &&
                    st1[2] == 10 &&
                    st1[3] == 11 &&
                    st1[0] + 12 == st1[4])
                {
                    currentGameParticipant.Type = 9;
                    currentGameParticipant.Power =
                        (int)(st1.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (st2.Length >= 5)
            {
                if (st2[0] + 4 == st2[4])
                {
                    currentGameParticipant.Type = 8;
                    currentGameParticipant.Power =
                        (int)(st2.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (st2[0] == 0 && st2[1] == 9 &&
                    st2[2] == 10 && st2[3] == 11 &&
                    st2[0] + 12 == st2[4])
                {
                    currentGameParticipant.Type = 9;
                    currentGameParticipant.Power =
                        (int)(st2.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (st3.Length >= 5)
            {
                if (st3[0] + 4 == st3[4])
                {
                    currentGameParticipant.Type = 8;
                    currentGameParticipant.Power =
                        (int)(st3.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (st3[0] == 0 &&
                    st3[1] == 9 &&
                    st3[2] == 10 &&
                    st3[3] == 11 &&
                    st3[0] + 12 == st3[4])
                {
                    currentGameParticipant.Type = 9;
                    currentGameParticipant.Power =
                        (int)(st3.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (st4.Length >= 5)
            {
                if (st4[0] + 4 == st4[4])
                {
                    currentGameParticipant.Type = 8;
                    currentGameParticipant.Power =
                        (int)(st4.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (st4[0] == 0 &&
                    st4[1] == 9 &&
                    st4[2] == 10 &&
                    st4[3] == 11 &&
                    st4[0] + 12 == st4[4])
                {
                    currentGameParticipant.Type = 9;
                    currentGameParticipant.Power =
                        (int)(st4.Max() / 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }
        }
Example #6
0
        //private void ChooseToFold(IGameParticipant currentGameParticipant)
        //{
        //    GameParticipant.raising = false;
        //    currentGameParticipant.ParticipantPanel.StatusButton.Text = "Is Folded";
        //    currentGameParticipant.Turn = false;
        //    currentGameParticipant.FoldTurn = true;
        //}

        ////private void ChooseToCheck(IGameParticipant currentGameParticipant)
        //{
        //    currentGameParticipant.ParticipantPanel.StatusButton.Text = "Check";
        //    currentGameParticipant.Turn = false;
        //    GameParticipant.raising = false;
        //}

        private void ChooseToCall(IGameParticipant currentGameParticipant)
        {
            currentGameParticipant.RaiseTurn = false;
            currentGameParticipant.Turn = false;
            currentGameParticipant.Chips -= this.call;
            currentGameParticipant.ParticipantPanel.Text = "Call " + this.call;
            this.potTextBox.Text = (int.Parse(this.potTextBox.Text) + this.call).ToString();
        }
Example #7
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;
            }
        }
Example #8
0
        void AI(int firstCard, int secondCard, IGameParticipant currentGameParticipant)
        {
            int botType = (int)currentGameParticipant.Type;

            if (!currentGameParticipant.FoldTurn)
            {
                if (botType == -1)
                {
                    this.HighCard(currentGameParticipant);
                }
                else if (botType == 0)
                {
                    this.PairTable(currentGameParticipant);
                }
                else if (botType == 1)
                {
                    this.PairHand(currentGameParticipant);
                }
                else if (botType == 2)
                {
                    this.TwoPair(currentGameParticipant);
                }
                else if (botType == 3)
                {
                    this.ThreeOfAKind(currentGameParticipant);
                }
                else if (botType == 4)
                {
                    this.Straight(currentGameParticipant);
                }
                // TODO: botType will never be 5.5, because it is int
                else if (botType == 5 ||
                    botType == 5.5)
                {
                    this.Flush(currentGameParticipant);
                }
                else if (botType == 6)
                {
                    this.FullHouse(currentGameParticipant);
                }
                else if (botType == 7)
                {
                    this.FourOfAKind(currentGameParticipant);
                }
                else if (botType == 8 ||
                    botType == 9)
                {
                    this.StraightFlush(currentGameParticipant);
                }
            }

            if (currentGameParticipant.FoldTurn)
            {
                this.cardImages[firstCard].Visible = false;
                this.cardImages[secondCard].Visible = false;
            }
        }
Example #9
0
 private void HighCard(IGameParticipant currentGameParticipant)
 {
     this.HP(currentGameParticipant, 20, 25);
 }
Example #10
0
        void ValidateWinner(
            IGameParticipant currentGameParticipant,
            string currentText,
            string lastly)
        {
            //TODO: needs some upgrading
            double currentGameParticipantType = currentGameParticipant.Type;
            int currentGameParticipantPower = currentGameParticipant.Power;

            if (lastly == " ")
            {
                lastly = "Bot 5";
            }

            for (int j = 0; j <= 16; j++)
            {
                //await Task.Delay(5);
                if (this.cardImages[j].Visible)
                {
                    this.cardImages[j].Image = this.deck[j];
                }
            }

            if (currentGameParticipantType == this.winningHand.Current)
            {
                if (currentGameParticipantPower == this.winningHand.Power)
                {
                    this.winners++;
                    this.winnersChecker.Add(currentText);
                    if (currentGameParticipantType == -1)
                    {
                        this.writer.Print(currentText + " High Card ");
                    }
                    else if (currentGameParticipantType == 1 ||
                        currentGameParticipantType == 0)
                    {
                        this.writer.Print(currentText + " Pair ");
                    }
                    else if (currentGameParticipantType == 2)
                    {
                        this.writer.Print(currentText + " Two Pair ");
                    }
                    else if (currentGameParticipantType == 3)
                    {
                        this.writer.Print(currentText + " Three of a Kind ");
                    }
                    else if (currentGameParticipantType == 4)
                    {
                        this.writer.Print(currentText + " straight ");
                    }
                    else if (currentGameParticipantType == 5 ||
                        currentGameParticipantType == 5.5)
                    {
                        this.writer.Print(currentText + " Flush ");
                    }
                    else if (currentGameParticipantType == 6)
                    {
                        this.writer.Print(currentText + " Full House ");
                    }
                    else if (currentGameParticipantType == 7)
                    {
                        this.writer.Print(currentText + " Four of a Kind ");
                    }
                    else if (currentGameParticipantType == 8)
                    {
                        this.writer.Print(currentText + " straight Flush ");
                    }
                    else if (currentGameParticipantType == 9)
                    {
                        this.writer.Print(currentText + " Royal Flush ! ");
                    }
                }
            }

            if (currentText == lastly) //lastfixed
            {
                if (this.winners > 1)
                {
                    if (this.winnersChecker.Contains("Player"))
                    {
                        this.player.Chips += int.Parse(this.potTextBox.Text) / this.winners;
                        this.player.ParticipantPanel.ChipsTextBox.Text = this.player.Chips.ToString();
                        //pPanel.Visible = true;

                    }

                    for (int bot = 0; bot < NumberOfBots; bot++)
                    {
                        int botIndex = bot + 1;
                        if (this.winnersChecker.Contains($"Bot {botIndex}"))
                        {
                            this.gameBots[bot].Chips += int.Parse(this.potTextBox.Text) / this.winners;
                            this.gameBots[bot].ParticipantPanel.ChipsTextBox.Text =
                                this.gameBots[bot].Chips.ToString();
                            //gameBots[bot].Visible = true;
                        }
                    }

                    //await Finish(1);
                }

                if (this.winners == 1)
                {
                    if (this.winnersChecker.Contains("Player"))
                    {
                        this.player.Chips += int.Parse(this.potTextBox.Text);
                        //await Finish(1);
                        //pPanel.Visible = true;
                    }

                    for (int bot = 0; bot < NumberOfBots; bot++)
                    {
                        int botIndex = bot + 1;
                        if (this.winnersChecker.Contains($"Bot {botIndex}"))
                        {
                            this.gameBots[bot].Chips += int.Parse(this.potTextBox.Text) / this.winners;
                            //await Finish(1)
                            //gameBots[bot].Visible = true;
                        }
                    }
                }
            }
        }
Example #11
0
        //void FixCall(Label status, ref int currentCall, ref int currentRaise, int options)
        //{
        //    if (rounds != 4)
        //    {
        //        if (options == 1)
        //        {
        //            if (status.Text.Contains("Raise"))
        //            {
        //                var changeRaise = status.Text.Substring(6);
        //                currentRaise = int.Parse(changeRaise);
        //            }
        //            else if (status.Text.Contains("Call"))
        //            {
        //                var changeCall = status.Text.Substring(5);
        //                currentCall = int.Parse(changeCall);
        //            }
        //            else if (status.Text.Contains("Check"))
        //            {
        //                currentRaise = 0;
        //                currentCall = 0;
        //            }
        //        }
        //        if (options == 2)
        //        {
        //            if (currentRaise != raise && currentRaise <= raise)
        //            {
        //                call = Convert.ToInt32(raise) - currentRaise;
        //            }

        //            if (currentCall != call || currentCall <= call)
        //            {
        //                call = call - currentCall;
        //            }

        //            if (currentRaise == raise && raise > 0)
        //            {
        //                call = 0;
        //                callButton.Enabled = false;
        //                callButton.Text = "Call button is unable.";
        //            }
        //        }
        //    }
        //}

        // Temporary FixCall workaround
        // TODO: Consolidate FixCall for player and for bot. (Process through shared interface)
        //void FixCallPlayer(int options)
        //{
        //    if (this.rounds != 4)
        //    {
        //        if (options == 1)
        //        {
        //            if (this.player.ParticipantPanel.StatusButton.Text.Contains("Raise"))
        //            {
        //                var changeRaise = this.player.ParticipantPanel.StatusButton.Text.Substring(6);
        //                this.player.Raise = int.Parse(changeRaise);
        //            }
        //            else if (this.player.ParticipantPanel.StatusButton.Text.Contains("Call"))
        //            {
        //                var changeCall = this.player.ParticipantPanel.StatusButton.Text.Substring(5);
        //                this.player.Call = int.Parse(changeCall);
        //            }
        //            else if (this.player.ParticipantPanel.StatusButton.Text.Contains("Check"))
        //            {
        //                this.player.Raise = 0;
        //                this.player.Call = 0;
        //            }
        //        }
        //        if (options == 2)
        //        {
        //            if (this.player.Raise != 0)
        //            {
        //                this.call = this.player.Raise;
        //            }

        //            if (this.player.Call != call || this.player.Call <= call)
        //            {
        //                this.call = this.call - this.player.Call;
        //            }

        //            if (this.player.Raise != 0)
        //            {
        //                this.call = 0;
        //                this.player.Raise = 0;
        //                this.callButton.Enabled = false;
        //                this.callButton.Text = "Call button is unable.";
        //            }
        //        }
        //    }
        //}

        void FixParticipantCall(IGameParticipant currentBot, int options)
        {
            if (this.rounds != 4)
            {
                if (options == 1)
                {
                    if (currentBot.ParticipantPanel.StatusButton.Text.Contains("Raise"))
                    {
                        var changeRaise = currentBot.ParticipantPanel.StatusButton.Text.Substring(6);
                        currentBot.Raise = int.Parse(changeRaise);
                    }
                    else if (currentBot.ParticipantPanel.StatusButton.Text.Contains("Call"))
                    {
                        var changeCall = currentBot.ParticipantPanel.StatusButton.Text.Substring(5);
                        currentBot.Call = int.Parse(changeCall);
                    }
                    else if (currentBot.ParticipantPanel.StatusButton.Text.Contains("Check"))
                    {
                        currentBot.Raise = 0;
                        currentBot.Call = 0;
                    }
                }

                if (options == 2)
                {
                    // Changed // todor
                    if (currentBot.Raise != 0)
                    {
                        this.call = currentBot.Raise;
                    }

                    if (currentBot.Call != this.call ||
                        currentBot.Call <= this.call)
                    {
                        this.call = this.call - currentBot.Call;
                    }

                    if (currentBot.Raise != 0)
                    {
                        this.call = 0;
                        currentBot.Raise = 0;
                        this.callButton.Enabled = false;
                        this.callButton.Text = "Call button is unable.";
                    }
                }
            }
        }
Example #12
0
        private void rHighCard(IGameParticipant currentGameParticipant)
        {
            if (this.reserve[0] / 4 > this.reserve[0 + 1] / 4)
            {
                currentGameParticipant.Type = -1;
                currentGameParticipant.Power = this.reserve[0] / 4;
                this.AddWin(
                    currentGameParticipant.Power,
                    currentGameParticipant.Type);
            }
            else
            {
                currentGameParticipant.Type = -1;
                currentGameParticipant.Power =
                    this.reserve[0 + 1] / 4;
                this.AddWin(
                    currentGameParticipant.Power,
                    currentGameParticipant.Type);
            }

            if (this.reserve[0] / 4 == 0 ||
                this.reserve[0 + 1] / 4 == 0)
            {
                currentGameParticipant.Type = -1;
                currentGameParticipant.Power = 13;
                this.AddWin(
                    currentGameParticipant.Power,
                    currentGameParticipant.Type);
            }
        }
Example #13
0
        private void rPairFromHand(IGameParticipant currentGameParticipant)
        {
            if (this.reserve[0] / 4 == this.reserve[0 + 1] / 4)
            {
                if (this.reserve[0] / 4 == 0)
                {
                    currentGameParticipant.Type = 1;
                    currentGameParticipant.Power =
                        (int)(13 * 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
                else
                {
                    currentGameParticipant.Type = 1;
                    currentGameParticipant.Power =
                        (int)((this.reserve[0 + 1] / 4) * 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }


            for (int tc = 16; tc >= 12; tc--)
            {
                if (this.reserve[0 + 1] / 4 == this.reserve[tc] / 4)
                {
                    if (this.reserve[0 + 1] / 4 == 0)
                    {
                        currentGameParticipant.Type = 1;
                        currentGameParticipant.Power =
                            (int)(13 * 4 + this.reserve[0] / 4 + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 1;
                        currentGameParticipant.Power =
                            (int)((this.reserve[0 + 1] / 4) * 4 + this.reserve[0] / 4 + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }

                if (this.reserve[0] / 4 == this.reserve[tc] / 4)
                {
                    if (this.reserve[0] / 4 == 0)
                    {
                        currentGameParticipant.Type = 1;
                        currentGameParticipant.Power = (int)(13 * 4 + this.reserve[0 + 1] / 4 + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 1;
                        currentGameParticipant.Power =
                            (int)((this.reserve[tc] / 4) * 4 + this.reserve[0 + 1] / 4 + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }
        }
Example #14
0
        private void rPairTwoPair(IGameParticipant currentGameParticipant)
        {
            // TODO: Extract method
            for (int tc = 16; tc >= 12; tc--)
            {
                int max = tc - 12;
                for (int k = 1; k <= max; k++)
                {
                    if (tc - k < 12)
                    {
                        max--;
                    }

                    if (tc - k >= 12)
                    {
                        if (this.reserve[tc] / 4 == this.reserve[tc - k] / 4)
                        {
                            if (this.reserve[tc] / 4 != this.reserve[0] / 4 &&
                                this.reserve[tc] / 4 != this.reserve[0 + 1] / 4 &&
                                currentGameParticipant.Type == 1)
                            {
                                if (this.reserve[0 + 1] / 4 == 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)((this.reserve[0] / 4) * 2 + 13 * 4 + currentGameParticipant.Type * 100);
                                    this.AddWin(
                                        currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }

                                if (this.reserve[0] / 4 == 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)((this.reserve[0 + 1] / 4) * 2 + 13 * 4 + currentGameParticipant.Type * 100);
                                    this.AddWin(
                                        currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }

                                if (this.reserve[0 + 1] / 4 != 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)((this.reserve[tc] / 4) * 2 + (this.reserve[0 + 1] / 4) * 2 + currentGameParticipant.Type * 100);
                                    this.AddWin(
                                        currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }

                                if (this.reserve[0] / 4 != 0)
                                {
                                    currentGameParticipant.Type = 2;
                                    currentGameParticipant.Power =
                                        (int)((this.reserve[tc] / 4) * 2 + (this.reserve[0] / 4) * 2 + currentGameParticipant.Type * 100);
                                    this.AddWin(
                                        currentGameParticipant.Power,
                                        currentGameParticipant.Type);
                                }
                            }

                            if (currentGameParticipant.Type == -1)
                            {
                                if (this.reserve[0] / 4 > this.reserve[0 + 1] / 4)
                                {
                                    if (this.reserve[tc] / 4 == 0)
                                    {
                                        currentGameParticipant.Type = 0;
                                        currentGameParticipant.Power =
                                            (int)(13 + this.reserve[0] / 4 + currentGameParticipant.Type * 100);
                                        // using AddWin method with current value = 1 was intended
                                        // to match with default game logic 
                                        this.AddWin(currentGameParticipant.Power, 1);
                                    }
                                    else
                                    {
                                        currentGameParticipant.Type = 0;
                                        currentGameParticipant.Power =
                                            (int)(this.reserve[tc] / 4 + this.reserve[0] / 4 + currentGameParticipant.Type * 100);
                                        this.AddWin(currentGameParticipant.Power, 1);
                                    }
                                }
                                else
                                {
                                    if (this.reserve[tc] / 4 == 0)
                                    {
                                        currentGameParticipant.Type = 0;
                                        currentGameParticipant.Power =
                                            (int)(13 + this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                                        this.AddWin(currentGameParticipant.Power, 1);
                                    }
                                    else
                                    {
                                        currentGameParticipant.Type = 0;
                                        currentGameParticipant.Power =
                                            (int)(this.reserve[tc] / 4 + this.reserve[0 + 1] / 4 + currentGameParticipant.Type * 100);
                                        this.AddWin(currentGameParticipant.Power, 1);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #15
0
 private void FourOfAKind(IGameParticipant currentGameParticipant)
 {
     Random fk = new Random();
     int fkCall = fk.Next(1, 4);
     int fkRaise = fk.Next(2, 5);
     if (currentGameParticipant.Power <= 752 &&
         currentGameParticipant.Power >= 704)
     {
         this.Smooth(currentGameParticipant, fkCall, fkRaise);
     }
 }
Example #16
0
 private void PairTable(IGameParticipant currentGameParticipant)
 {
     this.HP(currentGameParticipant, 16, 25);
 }
Example #17
0
        private void StraightFlush(IGameParticipant currentGameParticipant)
        {
            Random sf = new Random();
            int sfCall = sf.Next(1, 3);
            int sfRaise = sf.Next(1, 3);

            if (currentGameParticipant.Power <= 913 &&
                currentGameParticipant.Power >= 804)
            {
                this.Smooth(currentGameParticipant, sfCall, sfRaise);
            }
        }
Example #18
0
        private void PairHand(IGameParticipant currentGameParticipant)
        {
            Random rPair = new Random();
            int rCall = rPair.Next(10, 16);
            int rRaise = rPair.Next(10, 13);

            if (currentGameParticipant.Power <= 199 &&
                currentGameParticipant.Power >= 140)
            {
                this.PH(currentGameParticipant, rCall, 6, rRaise);
            }
            else if (currentGameParticipant.Power <= 139 &&
                currentGameParticipant.Power >= 128)
            {
                this.PH(currentGameParticipant, rCall, 7, rRaise);
            }
            else if (currentGameParticipant.Power < 128 &&
                currentGameParticipant.Power >= 101)
            {
                this.PH(currentGameParticipant, rCall, 9, rRaise);
            }
        }
Example #19
0
 private void Raised(IGameParticipant currentGameParticipant)
 {
     currentGameParticipant.Chips -= currentGameParticipant.Raise;
     currentGameParticipant.ParticipantPanel.StatusButton.Text =
         "Raise " + currentGameParticipant.Raise;
     this.potTextBox.Text =
         (int.Parse(this.potTextBox.Text) + currentGameParticipant.Raise).ToString();
     this.call = currentGameParticipant.Raise;
     currentGameParticipant.RaiseTurn = true;
     currentGameParticipant.Turn = false;
 }
Example #20
0
        private void TwoPair(IGameParticipant currentGameParticipant)
        {
            Random rPair = new Random();
            int rCall = rPair.Next(6, 11);
            int rRaise = rPair.Next(6, 11);

            if (currentGameParticipant.Power <= 290 &&
                currentGameParticipant.Power >= 246)
            {
                this.PH(currentGameParticipant, rCall, 3, rRaise);
            }
            else if (currentGameParticipant.Power <= 244 &&
                currentGameParticipant.Power >= 234)
            {
                this.PH(currentGameParticipant, rCall, 4, rRaise);
            }
            else if (currentGameParticipant.Power < 234 &&
                currentGameParticipant.Power >= 201)
            {
                this.PH(currentGameParticipant, rCall, 4, rRaise);
            }
        }
Example #21
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;
            }
        }
Example #22
0
        private void ThreeOfAKind(IGameParticipant currentGameParticipant)
        {
            Random tk = new Random();
            int tCall = tk.Next(3, 7);
            int tRaise = tk.Next(4, 8);

            if (currentGameParticipant.Power <= 390 &&
                currentGameParticipant.Power >= 330)
            {
                this.Smooth(currentGameParticipant, tCall, tRaise);
            }

            if (currentGameParticipant.Power <= 327 &&
                currentGameParticipant.Power >= 321)//10  8
            {
                this.Smooth(currentGameParticipant, tCall, tRaise);
            }

            if (currentGameParticipant.Power < 321 &&
                currentGameParticipant.Power >= 303)//7 2
            {
                this.Smooth(currentGameParticipant, tCall, tRaise);
            }
        }
Example #23
0
        void Rules(
            int firstCard,
            int secondCard,
            IGameParticipant currentGameParticipant)
        {
            //if (firstCard == 0 &&
            //    secondCard == 1)
            //{
            //}

            if (!currentGameParticipant.FoldTurn ||
                firstCard == 0 &&
                secondCard == 1 &&
                this.player.ParticipantPanel.StatusButton.Text.Contains("Fold") == false)
            {
                //int[] straight1 = new int[5];
                int[] straight = new int[7];

                straight[0] = this.reserve[firstCard];
                straight[1] = this.reserve[secondCard];
                straight[2] = this.reserve[12];
                straight[3] = this.reserve[13];
                straight[4] = this.reserve[14];
                straight[5] = this.reserve[15];
                straight[6] = this.reserve[16];

                var a = straight.Where(o => o % 4 == 0).ToArray();
                var b = straight.Where(o => o % 4 == 1).ToArray();
                var c = straight.Where(o => o % 4 == 2).ToArray();
                var d = straight.Where(o => o % 4 == 3).ToArray();

                var st1 = a.Select(o => o / 4).Distinct().ToArray();
                var st2 = b.Select(o => o / 4).Distinct().ToArray();
                var st3 = c.Select(o => o / 4).Distinct().ToArray();
                var st4 = d.Select(o => o / 4).Distinct().ToArray();

                Array.Sort(straight);
                Array.Sort(st1);
                Array.Sort(st2);
                Array.Sort(st3);
                Array.Sort(st4);

                for (int cardIndex = 0; cardIndex < AllCardsOnTheTable; cardIndex++)
                {
                    // bool  
                    if (this.reserve[cardIndex] == int.Parse(
                        this.cardImages[firstCard].Tag.ToString()) &&
                        this.reserve[cardIndex + 1] == int.Parse(
                            this.cardImages[secondCard].Tag.ToString()))
                    {
                        //Pair from Hand current = 1
                        this.rPairFromHand(currentGameParticipant);

                        // Pair or Two Pair from Table current = 2 || 0
                        this.rPairTwoPair(currentGameParticipant);

                        // Two Pair current = 2
                        this.rTwoPair(currentGameParticipant);

                        // Three of a kind current = 3
                        this.rThreeOfAKind(currentGameParticipant, straight);

                        // straight current = 4
                        this.rStraight(currentGameParticipant, straight);

                        // Flush current = 5 || 5.5
                        this.rFlush(currentGameParticipant, straight);

                        // Full House current = 6
                        this.rFullHouse(currentGameParticipant, straight);

                        // Four of a Kind current = 7
                        this.rFourOfAKind(currentGameParticipant, straight);

                        // straight Flush current = 8 || 9
                        this.rStraightFlush(currentGameParticipant, st1, st2, st3, st4);

                        // High Card current = -1
                        this.rHighCard(currentGameParticipant);
                    }
                }
            }
        }
Example #24
0
        private void Straight(IGameParticipant currentGameParticipant)
        {
            Random str = new Random();
            int sCall = str.Next(3, 6);
            int sRaise = str.Next(3, 8);

            if (currentGameParticipant.Power <= 480 &&
                currentGameParticipant.Power >= 410)
            {
                this.Smooth(currentGameParticipant, sCall, sRaise);
            }
            else if (currentGameParticipant.Power <= 409 &&
                currentGameParticipant.Power >= 407)//10  8
            {
                this.Smooth(currentGameParticipant, sCall, sRaise);
            }
            else if (currentGameParticipant.Power < 407 &&
                currentGameParticipant.Power >= 404)
            {
                this.Smooth(currentGameParticipant, sCall, sRaise);
            }
        }
Example #25
0
        private void rFourOfAKind(IGameParticipant currentGameParticipant, int[] straight)
        {
            for (int j = 0; j <= 3; j++)
            {
                if (straight[j] / 4 == straight[j + 1] / 4 &&
                    straight[j] / 4 == straight[j + 2] / 4 &&
                    straight[j] / 4 == straight[j + 3] / 4)
                {
                    currentGameParticipant.Type = 7;
                    currentGameParticipant.Power =
                        (int)(straight[j] / 4 * 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (straight[j] / 4 == 0 &&
                    straight[j + 1] / 4 == 0 &&
                    straight[j + 2] / 4 == 0 &&
                    straight[j + 3] / 4 == 0)
                {
                    currentGameParticipant.Type = 7;
                    currentGameParticipant.Power =
                        (int)(13 * 4 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }
        }
Example #26
0
        private void Flush(IGameParticipant currentGameParticipant)
        {
            Random fsh = new Random();
            int fCall = fsh.Next(2, 6);
            int fRaise = fsh.Next(3, 7);

            this.Smooth(currentGameParticipant, fCall, fRaise);
        }
Example #27
0
        private void rFlush(IGameParticipant currentGameParticipant, int[] straight)
        {
            // should be here?
            var f1 = straight.Where(o => o % 4 == 0).ToArray();
            var f2 = straight.Where(o => o % 4 == 1).ToArray();
            var f3 = straight.Where(o => o % 4 == 2).ToArray();
            var f4 = straight.Where(o => o % 4 == 3).ToArray();

            if (f1.Length == 3 || f1.Length == 4)
            {
                if (this.reserve[0] % 4 == this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f1[0] % 4)
                {
                    currentGameParticipant.Type = 5;

                    if (this.reserve[0] / 4 > f1.Max() / 4)
                    {
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                    }

                    if (this.reserve[0 + 1] / 4 > f1.Max() / 4)
                    {
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                    }
                    else if (this.reserve[0] / 4 < f1.Max() / 4 &&
                        this.reserve[0 + 1] / 4 < f1.Max() / 4)
                    {
                        currentGameParticipant.Power =
                            (int)(f1.Max() + currentGameParticipant.Type * 100);
                    }

                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f1.Length == 4) // different cards in hand
            {
                if (this.reserve[0] % 4 != this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f1[0] % 4)
                {
                    currentGameParticipant.Type = 5;

                    if (this.reserve[0] / 4 > f1.Max() / 4)
                    {
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                    }
                    else
                    {
                        currentGameParticipant.Power =
                            (int)(f1.Max() + currentGameParticipant.Type * 100);
                    }

                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] % 4 != this.reserve[0] % 4 &&
                    this.reserve[0 + 1] % 4 == f1[0] % 4)
                {
                    currentGameParticipant.Type = 5;
                    if (this.reserve[0 + 1] / 4 > f1.Max() / 4)
                    {
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f1.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f1.Length == 5)
            {
                if (this.reserve[0] % 4 == f1[0] % 4 &&
                    this.reserve[0] / 4 > f1.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] % 4 == f1[0] % 4 &&
                    this.reserve[0 + 1] / 4 > f1.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
                else if (this.reserve[0] / 4 < f1.Min() / 4 &&
                    this.reserve[0 + 1] / 4 < f1.Min())
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(f1.Max() + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f2.Length == 3 || f2.Length == 4)
            {
                if (this.reserve[0] % 4 == this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f2[0] % 4)
                {
                    if (this.reserve[0] / 4 > f2.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }

                    if (this.reserve[0 + 1] / 4 > f2.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else if (this.reserve[0] / 4 < f2.Max() / 4 &&
                        this.reserve[0 + 1] / 4 < f2.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power = (int)(f2.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f2.Length == 4) // different cards in hand
            {
                if (this.reserve[0] % 4 != this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f2[0] % 4)
                {
                    if (this.reserve[0] / 4 > f2.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f2.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }

                if (this.reserve[0 + 1] % 4 != this.reserve[0] % 4 && this.reserve[0 + 1] % 4 == f2[0] % 4)
                {
                    if (this.reserve[0 + 1] / 4 > f2.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f2.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f2.Length == 5)
            {
                if (this.reserve[0] % 4 == f2[0] % 4 &&
                    this.reserve[0] / 4 > f2.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] % 4 == f2[0] % 4 &&
                    this.reserve[0 + 1] / 4 > f2.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
                else if (this.reserve[0] / 4 < f2.Min() / 4 && this.reserve[0 + 1] / 4 < f2.Min())
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(f2.Max() + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f3.Length == 3 || f3.Length == 4)
            {
                if (this.reserve[0] % 4 == this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f3[0] % 4)
                {
                    if (this.reserve[0] / 4 > f3.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                        this.AddWin(currentGameParticipant.Power, currentGameParticipant.Type);
                    }

                    if (this.reserve[0 + 1] / 4 > f3.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else if (this.reserve[0] / 4 < f3.Max() / 4 && this.reserve[0 + 1] / 4 < f3.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f3.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f3.Length == 4)//different cards in hand
            {
                if (this.reserve[0] % 4 != this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f3[0] % 4)
                {
                    if (this.reserve[0] / 4 > f3.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f3.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }

                if (this.reserve[0 + 1] % 4 != this.reserve[0] % 4 &&
                    this.reserve[0 + 1] % 4 == f3[0] % 4)
                {
                    if (this.reserve[0 + 1] / 4 > f3.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f3.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f3.Length == 5)
            {
                if (this.reserve[0] % 4 == f3[0] % 4 &&
                    this.reserve[0] / 4 > f3.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                    this.AddWin(currentGameParticipant.Power, currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] % 4 == f3[0] % 4 &&
                    this.reserve[0 + 1] / 4 > f3.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
                else if (this.reserve[0] / 4 < f3.Min() / 4 &&
                    this.reserve[0 + 1] / 4 < f3.Min())
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(f3.Max() + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f4.Length == 3 || f4.Length == 4)
            {
                if (this.reserve[0] % 4 == this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f4[0] % 4)
                {
                    if (this.reserve[0] / 4 > f4.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }

                    if (this.reserve[0 + 1] / 4 > f4.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else if (this.reserve[0] / 4 < f4.Max() / 4 &&
                        this.reserve[0 + 1] / 4 < f4.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f4.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f4.Length == 4)//different cards in hand
            {
                if (this.reserve[0] % 4 != this.reserve[0 + 1] % 4 &&
                    this.reserve[0] % 4 == f4[0] % 4)
                {
                    if (this.reserve[0] / 4 > f4.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f4.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }

                if (this.reserve[0 + 1] % 4 != this.reserve[0] % 4 &&
                    this.reserve[0 + 1] % 4 == f4[0] % 4)
                {
                    if (this.reserve[0 + 1] / 4 > f4.Max() / 4)
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                    else
                    {
                        currentGameParticipant.Type = 5;
                        currentGameParticipant.Power =
                            (int)(f4.Max() + currentGameParticipant.Type * 100);
                        this.AddWin(
                            currentGameParticipant.Power,
                            currentGameParticipant.Type);
                    }
                }
            }

            if (f4.Length == 5)
            {
                if (this.reserve[0] % 4 == f4[0] % 4 &&
                    this.reserve[0] / 4 > f4.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] % 4 == f4[0] % 4 &&
                    this.reserve[0 + 1] / 4 > f4.Min() / 4)
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(this.reserve[0 + 1] + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
                else if (this.reserve[0] / 4 < f4.Min() / 4 &&
                    this.reserve[0 + 1] / 4 < f4.Min())
                {
                    currentGameParticipant.Type = 5;
                    currentGameParticipant.Power =
                        (int)(f4.Max() + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            // ace
            if (f1.Length > 0)
            {
                if (this.reserve[0] / 4 == 0 &&
                    this.reserve[0] % 4 == f1[0] % 4 &&
                    f1.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] / 4 == 0 &&
                    this.reserve[0 + 1] % 4 == f1[0] % 4
                    && f1.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f2.Length > 0)
            {
                if (this.reserve[0] / 4 == 0 &&
                    this.reserve[0] % 4 == f2[0] % 4 &&
                    f2.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] / 4 == 0 &&
                    this.reserve[0 + 1] % 4 == f2[0] % 4 &&
                    f2.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f3.Length > 0)
            {
                if (this.reserve[0] / 4 == 0 &&
                    this.reserve[0] % 4 == f3[0] % 4 &&
                    f3.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] / 4 == 0 &&
                    this.reserve[0 + 1] % 4 == f3[0] % 4 &&
                    f3.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }

            if (f4.Length > 0)
            {
                if (this.reserve[0] / 4 == 0 &&
                    this.reserve[0] % 4 == f4[0] % 4 &&
                    f4.Length > 0)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }

                if (this.reserve[0 + 1] / 4 == 0 &&
                    this.reserve[0 + 1] % 4 == f4[0] % 4)
                {
                    currentGameParticipant.Type = 5.5;
                    currentGameParticipant.Power =
                        (int)(13 + currentGameParticipant.Type * 100);
                    this.AddWin(
                        currentGameParticipant.Power,
                        currentGameParticipant.Type);
                }
            }
        }
Example #28
0
        private void FullHouse(IGameParticipant currentGameParticipant)
        {
            Random flh = new Random();
            int fhCall = flh.Next(1, 5);
            int fhRaise = flh.Next(2, 6);

            if (currentGameParticipant.Power <= 626 &&
                currentGameParticipant.Power >= 620)
            {
                this.Smooth(currentGameParticipant, fhCall, fhRaise);
            }

            if (currentGameParticipant.Power < 620 &&
                currentGameParticipant.Power >= 602)
            {
                this.Smooth(currentGameParticipant, fhCall, fhRaise);
            }
        }
Example #29
0
 public void ChooseToCheck(IGameParticipant currentGameParticipant)
 {
     currentGameParticipant.ParticipantPanel.StatusButton.Text = "Check";
     currentGameParticipant.Turn = false;
     currentGameParticipant.RaiseTurn = false;
 }
Example #30
0
 private void rThreeOfAKind(IGameParticipant currentGameParticipant, int[] straight)
 {
     // TODO: Etract method
     for (int j = 0; j <= 12; j++)
     {
         var fh = straight.Where(o => o / 4 == j).ToArray();
         if (fh.Length == 3)
         {
             if (fh.Max() / 4 == 0)
             {
                 currentGameParticipant.Type = 3;
                 currentGameParticipant.Power =
                     (int)(13 * 3 + currentGameParticipant.Type * 100);
                 this.AddWin(
                     currentGameParticipant.Power, currentGameParticipant.Type);
             }
             else
             {
                 currentGameParticipant.Type = 3;
                 currentGameParticipant.Power =
                     (int)(fh[0] / 4 + fh[1] / 4 + fh[2] / 4 + currentGameParticipant.Type * 100);
                 this.AddWin(
                     currentGameParticipant.Power,
                     currentGameParticipant.Type);
             }
         }
     }
 }