public void Train(int numberOfHands)
        {
            for (int i = 0; i < numberOfHands; i++)
            {
                dealer.DealHoleCards(players);
                // deal board at the beginning of each hand already for training
                var board = new List <Card>();
                dealer.DealFlop(board);
                dealer.DealTurn(board);
                dealer.DealRiver(board);

                StartHandBucket startHandBucket1 = StartHandAbstracter.MapToBucket(dummyPlayer1.HoleCards[0], dummyPlayer1.HoleCards[1]);
                StartHandBucket startHandBucket2 = StartHandAbstracter.MapToBucket(dummyPlayer2.HoleCards[0], dummyPlayer2.HoleCards[1]);
                var             handBuckets      = new List <byte>()
                {
                    (byte)startHandBucket1, (byte)startHandBucket2
                }.ToArray();
                var initialState = new HeadsUpGameState()
                {
                    Phase            = GamePhase.PreFlop,
                    Board            = board,
                    Player1HoleCards = dummyPlayer1.HoleCards,
                    Player2HoleCards = dummyPlayer2.HoleCards,
                    PotSize          = HeadsupGame.BigBlindSize + HeadsupGame.SmallBlindSize,
                    AmountToCall     = HeadsupGame.SmallBlindSize
                };

                CalculateCounterFactualRegret(initialState, handBuckets, new List <ActionBucket>(), 1, 1);
            }
        }
예제 #2
0
        public override void DealHoleCards(Card card1, Card card2)
        {
            base.DealHoleCards(card1, card2);
            actionHistory           = new List <ActionBucket>();
            actionHistoriesPerPhase = new List <ActionHistoryPerPhase>();
            actionHistoriesPerPhase.Add(new ActionHistoryPerPhase()
            {
                Phase = GamePhase.PreFlop
            });

            startHandBucket    = StartHandAbstracter.MapToBucket(card1, card2);
            handStrengthBucket = HandStrengthBucket.None;

            opponent.StartNewhand();
        }
        public void FromStartHandTest()
        {
            var card1  = new Card(CardSuit.Clubs, CardValue.Ace);
            var card2  = new Card(CardSuit.Clubs, CardValue.King);
            var bucket = StartHandAbstracter.MapToBucket(card1, card2);

            Assert.AreEqual(bucket, StartHandBucket.VeryGood);

            card1  = new Card(CardSuit.Diamonds, CardValue.Ace);
            card2  = new Card(CardSuit.Clubs, CardValue.King);
            bucket = StartHandAbstracter.MapToBucket(card1, card2);
            Assert.AreEqual(bucket, StartHandBucket.VeryGood);

            card1  = new Card(CardSuit.Diamonds, CardValue.Two);
            card2  = new Card(CardSuit.Diamonds, CardValue.Eight);
            bucket = StartHandAbstracter.MapToBucket(card1, card2);
            Assert.AreEqual(bucket, StartHandBucket.VeryBad);

            card1  = new Card(CardSuit.Diamonds, CardValue.Two);
            card2  = new Card(CardSuit.Clubs, CardValue.Eight);
            bucket = StartHandAbstracter.MapToBucket(card1, card2);
            Assert.AreEqual(bucket, StartHandBucket.Worst);

            card1  = new Card(CardSuit.Diamonds, CardValue.Eight);
            card2  = new Card(CardSuit.Clubs, CardValue.Eight);
            bucket = StartHandAbstracter.MapToBucket(card1, card2);
            Assert.AreEqual(bucket, StartHandBucket.Best);

            card1  = new Card(CardSuit.Diamonds, CardValue.Jack);
            card2  = new Card(CardSuit.Clubs, CardValue.Two);
            bucket = StartHandAbstracter.MapToBucket(card1, card2);
            Assert.AreEqual(bucket, StartHandBucket.VeryBad);

            card1  = new Card(CardSuit.Diamonds, CardValue.Jack);
            card2  = new Card(CardSuit.Diamonds, CardValue.Two);
            bucket = StartHandAbstracter.MapToBucket(card1, card2);
            Assert.AreEqual(bucket, StartHandBucket.AverageBad);
        }
예제 #4
0
 public override void DealHoleCards(Card card1, Card card2)
 {
     base.DealHoleCards(card1, card2);
     actionHistory = new List <ActionBucket>();
     handBucket    = (byte)StartHandAbstracter.MapToBucket(card1, card2);
 }
 public override void DealHoleCards(Card card1, Card card2)
 {
     base.DealHoleCards(card1, card2);
     startHandBucket    = StartHandAbstracter.MapToBucket(card1, card2);
     handStrengthBucket = HandStrengthBucket.None;
 }