Exemple #1
0
 public void Raise(IPlayer player, ref bool raising, ref double raise, ref int call, IPot pot)
 {
     player.Raise(Convert.ToInt32(raise));
     pot.Add(Convert.ToInt32(raise));
     call = Convert.ToInt32(raise);
     raising = true;
 }
Exemple #2
0
        public void Flush(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall  = this.rnd.Next(2, 6);
            int randomRaise = this.rnd.Next(3, 7);

            this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
        }
Exemple #3
0
        public void FourOfAKind(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall  = this.rnd.Next(1, 4);
            int randomRaise = this.rnd.Next(2, 5);

            if (player.Type.Power <= 752 && player.Type.Power >= 704)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #4
0
        public void StraightFlush(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall  = this.rnd.Next(1, 3);
            int randomRaise = this.rnd.Next(1, 3);

            if (player.Type.Power <= 913 && player.Type.Power >= 804)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #5
0
        public void Smooth(IPlayer player, int n, int r, int call, IPot pot, ref double Raise, ref bool raising)
        {
            if (call <= 0)
            {
                this.playerActions.Check(player, ref raising);
            }
            else
            {
                if (call >= RoundN(player.Chips, n))
                {
                    if (player.Chips > call)
                    {
                        this.playerActions.Call(player, ref raising, call, pot);
                    }
                    else if (player.Chips <= call)
                    {
                        raising                 = false;
                        player.IsInTurn         = false;
                        player.Chips            = 0;
                        player.StatusLabel.Text = "Call " + player.Chips;
                        pot.Add(player.Chips);
                        //textboxPot.Text = (int.Parse(textboxPot.Text) + player.Chips).ToString();
                    }
                }
                else
                {
                    if (Raise > 0)
                    {
                        if (player.Chips >= Raise * 2)
                        {
                            Raise *= 2;
                            this.playerActions.Raise(player, ref raising, ref Raise, ref call, pot);
                        }
                        else
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }
                    }
                    else
                    {
                        Raise = call * 2;
                        this.playerActions.Raise(player, ref raising, ref Raise, ref call, pot);
                    }
                }
            }

            if (player.Chips <= 0)
            {
                player.FoldedTurn = true;
            }
        }
Exemple #6
0
        public void FullHouse(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomhCall = this.rnd.Next(1, 5);
            int randomRaise = this.rnd.Next(2, 6);

            if (player.Type.Power <= 626 && player.Type.Power >= 620)
            {
                this.type.Smooth(player, randomhCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power < 620 && player.Type.Power >= 602)
            {
                this.type.Smooth(player, randomhCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #7
0
 public GameEngine(IPlayer human, ICollection<IAIPlayer> enemies, IPot pot, IDealer dealer, IDeck deck, IMessageWriter messageWriter, IHandTypeHandler handTypeHandler)
 {
     this.human = human;
     this.enemies = new List<IAIPlayer>(enemies);
     this.Pot = pot;
     this.dealer = dealer;
     this.deck = deck;
     this.MessageWriter = messageWriter;
     this.handTypeHandler = handTypeHandler;
     this.BigBlind = AppSettigns.DefaultMinBigBlind;
     this.SmallBlind = AppSettigns.DefaultMinSmallBlind;
     this.SetDefaultCall();
     this.Raise = 0;
     this.IsAnyPlayerRaise = false;
 }
Exemple #8
0
 public GameEngine(IPlayer human, ICollection <IAIPlayer> enemies, IPot pot, IDealer dealer, IDeck deck, IMessageWriter messageWriter, IHandTypeHandler handTypeHandler)
 {
     this.human           = human;
     this.enemies         = new List <IAIPlayer>(enemies);
     this.Pot             = pot;
     this.dealer          = dealer;
     this.deck            = deck;
     this.MessageWriter   = messageWriter;
     this.handTypeHandler = handTypeHandler;
     this.BigBlind        = AppSettigns.DefaultMinBigBlind;
     this.SmallBlind      = AppSettigns.DefaultMinSmallBlind;
     this.SetDefaultCall();
     this.Raise            = 0;
     this.IsAnyPlayerRaise = false;
 }
Exemple #9
0
        public void ThreeOfAKind(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall = this.rnd.Next(3, 7);
            int randomRaise = this.rnd.Next(4, 8);

            if (player.Type.Power <= 390 && player.Type.Power >= 330)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power <= 327 && player.Type.Power >= 321)
            {
                this.type.Smooth(player, randomCall, randomRaise,  call, pot, ref raise, ref raising);
            }

            if (player.Type.Power < 321 && player.Type.Power >= 303)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #10
0
        public void PairHand(IPlayer player, int call, IPot pot, ref double raise, ref bool raising, CommunityCardBoard rounds)
        {
            int randomCall  = this.rnd.Next(10, 16);
            int randomRaise = this.rnd.Next(10, 13);

            if (player.Type.Power <= 199 && player.Type.Power >= 140)
            {
                this.type.PH(player, randomCall, 6, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power <= 139 && player.Type.Power >= 128)
            {
                this.type.PH(player, randomCall, 7, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power < 128 && player.Type.Power >= 101)
            {
                this.type.PH(player, randomCall, 9, randomRaise, call, pot, ref raise, ref raising, rounds);
            }
        }
Exemple #11
0
        public void Straight(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall  = this.rnd.Next(3, 6);
            int randomRaise = this.rnd.Next(3, 8);

            if (player.Type.Power <= 480 && player.Type.Power >= 410)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power <= 409 && player.Type.Power >= 407)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power < 407 && player.Type.Power >= 404)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #12
0
        public void PairHand(IPlayer player, int call, IPot pot, ref double raise, ref bool raising, CommunityCardBoard rounds)
        {
            int randomCall = this.rnd.Next(10, 16);
            int randomRaise = this.rnd.Next(10, 13);

            if (player.Type.Power <= 199 && player.Type.Power >= 140)
            {
                this.type.PH(player, randomCall, 6, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power <= 139 && player.Type.Power >= 128)
            {
                this.type.PH(player, randomCall, 7, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power < 128 && player.Type.Power >= 101)
            {
                this.type.PH(player, randomCall, 9, randomRaise, call, pot, ref raise, ref raising, rounds);
            }
        }
Exemple #13
0
        public void ThreeOfAKind(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall  = this.rnd.Next(3, 7);
            int randomRaise = this.rnd.Next(4, 8);

            if (player.Type.Power <= 390 && player.Type.Power >= 330)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power <= 327 && player.Type.Power >= 321)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power < 321 && player.Type.Power >= 303)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #14
0
        public void TwoPair(IPlayer player, int call, IPot pot, ref double raise, ref bool raising, CommunityCardBoard rounds)
        {
            int randomCall = this.rnd.Next(6, 11);
            int randomRaise = this.rnd.Next(6, 11);

            if (player.Type.Power <= 290 && player.Type.Power >= 246)
            {
                this.type.PH(player, randomCall, 3, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power <= 244 && player.Type.Power >= 234)
            {
                this.type.PH(player, randomCall, 4, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power < 234 && player.Type.Power >= 201)
            {
                this.type.PH(player, randomCall, 4, randomRaise, call, pot, ref raise, ref raising, rounds);
            }
        }
Exemple #15
0
        public void Straight(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall = this.rnd.Next(3, 6);
            int randomRaise = this.rnd.Next(3, 8);

            if (player.Type.Power <= 480 && player.Type.Power >= 410)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power <= 409 && player.Type.Power >= 407)
            {
                this.type.Smooth(player, randomCall, randomRaise,  call, pot, ref raise, ref raising);
            }

            if (player.Type.Power < 407 && player.Type.Power >= 404)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #16
0
        public void TwoPair(IPlayer player, int call, IPot pot, ref double raise, ref bool raising, CommunityCardBoard rounds)
        {
            int randomCall  = this.rnd.Next(6, 11);
            int randomRaise = this.rnd.Next(6, 11);

            if (player.Type.Power <= 290 && player.Type.Power >= 246)
            {
                this.type.PH(player, randomCall, 3, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power <= 244 && player.Type.Power >= 234)
            {
                this.type.PH(player, randomCall, 4, randomRaise, call, pot, ref raise, ref raising, rounds);
            }

            if (player.Type.Power < 234 && player.Type.Power >= 201)
            {
                this.type.PH(player, randomCall, 4, randomRaise, call, pot, ref raise, ref raising, rounds);
            }
        }
Exemple #17
0
        public void Flush(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall = this.rnd.Next(2, 6);
            int randomRaise = this.rnd.Next(3, 7);

            this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
        }
Exemple #18
0
 public SimpleDemo(IPot<Tea> teapot)
 {
     _teapot = teapot;
 }
Exemple #19
0
        public void PH(IPlayer player, int n, int n1, int r, int call, IPot pot, ref double raise, ref bool raising, CommunityCardBoard rounds)
        {
            int rnd = this.random.Next(1, 3);

            if (rounds < CommunityCardBoard.Turn)
            {
                if (call <= 0)
                {
                    this.playerActions.Check(player, ref raising);
                }

                if (call > 0)
                {
                    if (call >= RoundN(player.Chips, n1))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (raise > RoundN(player.Chips, n))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (!player.FoldedTurn)
                    {
                        if (call >= RoundN(player.Chips, n) && call <= RoundN(player.Chips, n1))
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n) && raise >= RoundN(player.Chips, n) / 2)
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n) / 2)
                        {
                            if (raise > 0)
                            {
                                raise = RoundN(player.Chips, n);
                                this.playerActions.Call(player, ref raising, call, pot);
                            }
                            else
                            {
                                raise = call * 2;
                                this.playerActions.Call(player, ref raising, call, pot);
                            }
                        }
                    }
                }
            }

            if (rounds >= CommunityCardBoard.Turn)
            {
                if (call > 0)
                {
                    if (call >= RoundN(player.Chips, n1 - rnd))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (raise > RoundN(player.Chips, n - rnd))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (!player.FoldedTurn)
                    {
                        if (call >= RoundN(player.Chips, n - rnd) && call <= RoundN(player.Chips, n1 - rnd))
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n - rnd) && raise >= RoundN(player.Chips, n - rnd) / 2)
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n - rnd) / 2)
                        {
                            if (raise > 0)
                            {
                                raise = RoundN(player.Chips, n - rnd);
                                this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                            }
                            else
                            {
                                raise = call * 2;
                                this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                            }
                        }
                    }
                }

                if (call <= 0)
                {
                    raise = RoundN(player.Chips, r - rnd);
                    this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                }
            }

            if (player.Chips <= 0)
            {
                player.FoldedTurn = true;
            }
        }
Exemple #20
0
        public void HandleTurn(IPlayer player, int call, IPot Pot, ref double raise, ref bool isAnyPlayerRaise, CommunityCardBoard currentRound)
        {
            if (!player.FoldedTurn)
            {
                if (player.Type.Current == PokerHand.HighCard)
                {
                    this.handType.HighCard(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.PairTable)
                {
                    this.handType.PairTable(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.PairFromHand)
                {
                    this.handType.PairHand(player, call, Pot, ref raise, ref isAnyPlayerRaise, currentRound);
                }

                if (player.Type.Current == PokerHand.TwoPair)
                {
                    this.handType.TwoPair(player, call, Pot, ref raise, ref isAnyPlayerRaise, currentRound);
                }

                if (player.Type.Current == PokerHand.ThreeOfAKind)
                {
                    this.handType.ThreeOfAKind(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.Straigth)
                {
                    this.handType.Straight(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.Flush || player.Type.Current == PokerHand.FlushWithAce)
                {
                    this.handType.Flush(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.FullHouse)
                {
                    this.handType.FullHouse(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.FourOfAKind)
                {
                    this.handType.FourOfAKind(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.StraightFlush || player.Type.Current == PokerHand.RoyalFlush)
                {
                    this.handType.StraightFlush(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }
            }
            
            if (player.FoldedTurn)
            {
                foreach (var pictureBox in player.PictureBoxHolder)
                {
                    pictureBox.Visible = false;
                }
            }
        }
Exemple #21
0
        public void HP(IPlayer player, int n, int n1, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomInteger = this.random.Next(1, 4);

            if (call <= 0)
            {
                this.playerActions.Check(player, ref raising);
            }

            if (call > 0)
            {
                if (randomInteger == 1)
                {
                    if (call <= RoundN(player.Chips, n))
                    {
                        this.playerActions.Call(player, ref raising, call, pot);
                    }
                    else
                    {
                        this.playerActions.Fold(player, ref raising);
                    }
                }

                if (randomInteger == 2)
                {
                    if (call <= RoundN(player.Chips, n1))
                    {
                        this.playerActions.Call(player, ref raising, call, pot);
                    }
                    else
                    {
                        this.playerActions.Fold(player, ref raising);
                    }
                }
            }

            if (randomInteger == 3)
            {
                if (raise == 0)
                {
                    raise = call * 2;
                    this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                }
                else
                {
                    if (raise <= RoundN(player.Chips, n))
                    {
                        raise = call * 2;
                        this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                    }
                    else
                    {
                        this.playerActions.Fold(player, ref raising);
                    }
                }
            }

            if (player.Chips <= 0)
            {
                player.FoldedTurn = true;
            }
        }
Exemple #22
0
        public void HP(IPlayer player, int n, int n1, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomInteger = this.random.Next(1, 4);

            if (call <= 0)
            {
                this.playerActions.Check(player, ref raising);
            }

            if (call > 0)
            {
                if (randomInteger == 1)
                {
                    if (call <= RoundN(player.Chips, n))
                    {
                        this.playerActions.Call(player, ref raising, call, pot);
                    }
                    else
                    {
                        this.playerActions.Fold(player, ref raising);
                    }
                }

                if (randomInteger == 2)
                {
                    if (call <= RoundN(player.Chips, n1))
                    {
                        this.playerActions.Call(player, ref raising, call, pot);
                    }
                    else
                    {
                        this.playerActions.Fold(player, ref raising);
                    }
                }
            }

            if (randomInteger == 3)
            {
                if (raise == 0)
                {
                    raise = call * 2;
                    this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                }
                else
                {
                    if (raise <= RoundN(player.Chips, n))
                    {
                        raise = call * 2;
                        this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                    }
                    else
                    {
                        this.playerActions.Fold(player, ref raising);
                    }
                }
            }

            if (player.Chips <= 0)
            {
                player.FoldedTurn = true;
            }
        }
Exemple #23
0
        static void Main(string[] args)
        {
            Console.WriteLine("-----------Розы-------------");
            Rose rose = new Rose();

            rose.ToPlant();
            rose.GetPlants();
            rose.ToPlant();
            rose.ToPlant();
            rose.GetPlants();
            rose.Pour(3);
            if (rose is Plant)
            {
                Console.WriteLine($"{rose} is plant");
            }

            Console.WriteLine("-----------Кактусы-------------");
            Cactus cactus   = new Cactus();
            IPot   cactus_2 = cactus;

            cactus_2.ToPlant();
            cactus.ToPlant();
            cactus.GetPlants();
            cactus.Collect();
            cactus.PutInPot();

            Console.WriteLine("-----------Гладиолусы-------------");
            Gladiolus gladiolus = new Gladiolus();

            gladiolus.ToPlant();
            gladiolus.ToPlant();
            gladiolus.Pour(2);
            gladiolus.Collect();
            gladiolus.PackIn();

            Printer printer = new Printer();

            printer.iAmPrinting(cactus);

            CollectionType <string> obj1 = new CollectionType <string>();
            IGereric <string>       a;

            obj1.Add("bye ");
            obj1.Add("adyos ");
            obj1.Add("sayonara ");
            a = obj1;
            a.Show();

            CollectionType <Plant> plnt = new CollectionType <Plant>();

            plnt.Add(new Rose());
            plnt.Add(new Gladiolus());
            plnt.Add(new Bush());
            plnt.Show();

            Console.WriteLine("\n");
            CollectionType <Plant> obj2 = new CollectionType <Plant>();

            ParseFile(obj2);
            obj2.Show();

            obj2.WriteFile(obj2);
        }
Exemple #24
0
        public void FourOfAKind(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall = this.rnd.Next(1, 4);
            int randomRaise = this.rnd.Next(2, 5);

            if (player.Type.Power <= 752 && player.Type.Power >= 704)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #25
0
 public void ProccessNextTurn(int call, IPot pot, ref double raise, ref bool isAnyPlayerRaise, CommunityCardBoard currentRound)
 {
     this.aiLogicProvider.HandleTurn(this, call, pot, ref raise, ref isAnyPlayerRaise, currentRound);
 }
Exemple #26
0
 public void Raise(IPlayer player, ref bool raising, ref double raise, ref int call, IPot pot)
 {
     player.Raise(Convert.ToInt32(raise));
     pot.Add(Convert.ToInt32(raise));
     call    = Convert.ToInt32(raise);
     raising = true;
 }
Exemple #27
0
 public SimpleDemo(IPot <Tea> teapot)
 {
     _teapot = teapot;
 }
Exemple #28
0
 public void HighCard(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
 {
     this.type.HP(player, 20, 25, call, pot, ref raise, ref raising);
 }
Exemple #29
0
 public void PairTable(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
 {
     this.type.HP(player, 16, 25, call, pot, ref raise, ref raising);
 }
Exemple #30
0
        public void FullHouse(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomhCall = this.rnd.Next(1, 5);
            int randomRaise = this.rnd.Next(2, 6);

            if (player.Type.Power <= 626 && player.Type.Power >= 620)
            {
                this.type.Smooth(player, randomhCall, randomRaise, call, pot, ref raise, ref raising);
            }

            if (player.Type.Power < 620 && player.Type.Power >= 602)
            {
                this.type.Smooth(player, randomhCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #31
0
 public void HighCard(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
 {
     this.type.HP(player, 20, 25, call, pot, ref raise, ref raising);
 }
Exemple #32
0
        public void StraightFlush(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
        {
            int randomCall = this.rnd.Next(1, 3);
            int randomRaise = this.rnd.Next(1, 3);

            if (player.Type.Power <= 913 && player.Type.Power >= 804)
            {
                this.type.Smooth(player, randomCall, randomRaise, call, pot, ref raise, ref raising);
            }
        }
Exemple #33
0
 public void Call(IPlayer player, ref bool raising, int call, IPot pot)
 {
     raising = false;
     player.Call(call);
     pot.Add(call);
 }
Exemple #34
0
 public void Call(IPlayer player, ref bool raising, int call, IPot pot)
 {
     raising = false;
     player.Call(call);
     pot.Add(call);
 }
Exemple #35
0
        public void Smooth(IPlayer player, int n, int r, int call, IPot pot, ref double Raise, ref bool raising)
        {
            if (call <= 0)
            {
                this.playerActions.Check(player, ref raising);
            }
            else
            {
                if (call >= RoundN(player.Chips, n))
                {
                    if (player.Chips > call)
                    {
                        this.playerActions.Call(player, ref raising, call, pot);
                    }
                    else if (player.Chips <= call)
                    {
                        raising = false;
                        player.IsInTurn = false;
                        player.Chips = 0;
                        player.StatusLabel.Text = "Call " + player.Chips;
                        pot.Add(player.Chips);
                        //textboxPot.Text = (int.Parse(textboxPot.Text) + player.Chips).ToString();
                    }
                }
                else
                {
                    if (Raise > 0)
                    {
                        if (player.Chips >= Raise * 2)
                        {
                            Raise *= 2;
                            this.playerActions.Raise(player, ref raising, ref Raise, ref call, pot);
                        }
                        else
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }
                    }
                    else
                    {
                        Raise = call * 2;
                        this.playerActions.Raise(player, ref raising, ref Raise, ref call, pot);
                    }
                }
            }

            if (player.Chips <= 0)
            {
                player.FoldedTurn = true;
            }
        }
Exemple #36
0
 public void PairTable(IPlayer player, int call, IPot pot, ref double raise, ref bool raising)
 {
     this.type.HP(player, 16, 25, call, pot, ref raise, ref raising);
 }
Exemple #37
0
        public void PH(IPlayer player, int n, int n1, int r, int call, IPot pot, ref double raise, ref bool raising, CommunityCardBoard rounds)
        {
            int rnd = this.random.Next(1, 3);

            if (rounds < CommunityCardBoard.Turn)
            {
                if (call <= 0)
                {
                    this.playerActions.Check(player, ref raising);
                }

                if (call > 0)
                {
                    if (call >= RoundN(player.Chips, n1))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (raise > RoundN(player.Chips, n))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (!player.FoldedTurn)
                    {
                        if (call >= RoundN(player.Chips, n) && call <= RoundN(player.Chips, n1))
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n) && raise >= RoundN(player.Chips, n) / 2)
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n) / 2)
                        {
                            if (raise > 0)
                            {
                                raise = RoundN(player.Chips, n);
                                this.playerActions.Call(player, ref raising, call, pot);
                            }
                            else
                            {
                                raise = call * 2;
                                this.playerActions.Call(player, ref raising, call, pot);
                            }
                        }
                    }
                }
            }

            if (rounds >= CommunityCardBoard.Turn)
            {
                if (call > 0)
                {
                    if (call >= RoundN(player.Chips, n1 - rnd))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (raise > RoundN(player.Chips, n - rnd))
                    {
                        this.playerActions.Fold(player, ref raising);
                    }

                    if (!player.FoldedTurn)
                    {
                        if (call >= RoundN(player.Chips, n - rnd) && call <= RoundN(player.Chips, n1 - rnd))
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n - rnd) && raise >= RoundN(player.Chips, n - rnd) / 2)
                        {
                            this.playerActions.Call(player, ref raising, call, pot);
                        }

                        if (raise <= RoundN(player.Chips, n - rnd) / 2)
                        {
                            if (raise > 0)
                            {
                                raise = RoundN(player.Chips, n - rnd);
                                this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                            }
                            else
                            {
                                raise = call * 2;
                                this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                            }
                        }
                    }
                }

                if (call <= 0)
                {
                    raise = RoundN(player.Chips, r - rnd);
                    this.playerActions.Raise(player, ref raising, ref raise, ref call, pot);
                }
            }

            if (player.Chips <= 0)
            {
                player.FoldedTurn = true;
            }
        }
Exemple #38
0
        public void HandleTurn(IPlayer player, int call, IPot Pot, ref double raise, ref bool isAnyPlayerRaise, CommunityCardBoard currentRound)
        {
            if (!player.FoldedTurn)
            {
                if (player.Type.Current == PokerHand.HighCard)
                {
                    this.handType.HighCard(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.PairTable)
                {
                    this.handType.PairTable(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.PairFromHand)
                {
                    this.handType.PairHand(player, call, Pot, ref raise, ref isAnyPlayerRaise, currentRound);
                }

                if (player.Type.Current == PokerHand.TwoPair)
                {
                    this.handType.TwoPair(player, call, Pot, ref raise, ref isAnyPlayerRaise, currentRound);
                }

                if (player.Type.Current == PokerHand.ThreeOfAKind)
                {
                    this.handType.ThreeOfAKind(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.Straigth)
                {
                    this.handType.Straight(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.Flush || player.Type.Current == PokerHand.FlushWithAce)
                {
                    this.handType.Flush(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.FullHouse)
                {
                    this.handType.FullHouse(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.FourOfAKind)
                {
                    this.handType.FourOfAKind(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }

                if (player.Type.Current == PokerHand.StraightFlush || player.Type.Current == PokerHand.RoyalFlush)
                {
                    this.handType.StraightFlush(player, call, Pot, ref raise, ref isAnyPlayerRaise);
                }
            }

            if (player.FoldedTurn)
            {
                foreach (var pictureBox in player.PictureBoxHolder)
                {
                    pictureBox.Visible = false;
                }
            }
        }
Exemple #39
0
 public void ProccessNextTurn(int call, IPot pot, ref double raise, ref bool isAnyPlayerRaise, CommunityCardBoard currentRound)
 {
     this.aiLogicProvider.HandleTurn(this, call, pot, ref raise, ref isAnyPlayerRaise, currentRound);
 }