Esempio n. 1
0
        // Clone
        protected HoldemPlayer(HoldemPlayer other)
            : base(other)
        {
            this.blindType = other.blindType;
            this.limps = (ValueCounter)other.limps.Clone();
            this.limpsDetails = (MultipleValueCounter)other.limpsDetails.Clone();
            this.voluntaryPutMoneyPreflop = (ValueCounter)other.limps.Clone();
            this.raises = (MultipleValueCounter)other.raises.Clone();
            this.raisesRatings = (MultipleValueCounter)other.raisesRatings.Clone();
            this.bets = (MultipleValueCounter)other.bets.Clone();
            this.betsRatings = (MultipleValueCounter)other.betsRatings.Clone();
            this.calls = (MultipleValueCounter)other.calls.Clone();
            this.callsRatings = (MultipleValueCounter)other.callsRatings.Clone();
            this.folds = (MultipleValueCounter)other.folds.Clone();
            this.opportunitiesToCBet = other.opportunitiesToCBet;
            this.cbets = (ValueCounter)other.cbets.Clone();
            this.foldsToACBet = other.foldsToACBet;
            this.callsToACBet = other.callsToACBet;
            this.raisesToACBet = other.raisesToACBet;
            this.checks = (MultipleValueCounter)other.checks.Clone();
            this.checksRatings = (MultipleValueCounter)other.checksRatings.Clone();
            this.checkRaises = (MultipleValueCounter)other.checkRaises.Clone();
            this.checksRaisesRatings = (MultipleValueCounter)other.checksRaisesRatings.Clone();
            this.checkFolds = (MultipleValueCounter)other.checkFolds.Clone();
            this.checkCalls = (MultipleValueCounter)other.checkCalls.Clone();
            this.checksCallsRatings = (MultipleValueCounter)other.checksCallsRatings.Clone();
            this.sawStreet = (MultipleValueCounter)other.sawStreet.Clone();
            this.totalCalls = (Hashtable)other.totalCalls.Clone();
            this.totalBets = (Hashtable)other.totalBets.Clone();
            this.totalFolds = (Hashtable)other.totalFolds.Clone();
            this.totalRaises = (Hashtable)other.totalRaises.Clone();
            this.totalChecks = (Hashtable)other.totalChecks.Clone();
            this.IsBigBlind = other.IsBigBlind;
            this.IsSmallBlind = other.IsSmallBlind;
            this.IsButton = other.IsButton;
            this.stealRaises = (ValueCounter)other.stealRaises.Clone();
            this.opportunitiesToStealRaise = other.opportunitiesToStealRaise;
            this.foldsToAStealRaise = (MultipleValueCounter)other.foldsToAStealRaise.Clone();
            this.callsToAStealRaise = (MultipleValueCounter)other.callsToAStealRaise.Clone();
            this.raisesToAStealRaise = (MultipleValueCounter)other.raisesToAStealRaise.Clone();
            this.wentToShowdown = (ValueCounter)other.wentToShowdown.Clone();
            this.wonAtShowdown = (ValueCounter)other.wonAtShowdown.Clone();
            this.pushedAllIn = (MultipleValueCounter)other.pushedAllIn.Clone();
            this.totalAllIns = (ValueCounter)other.totalAllIns.Clone();
            this.foldsBlindToAPreflopRaise = (MultipleValueCounter)other.foldsBlindToAPreflopRaise.Clone();
            this.callsBlindToAPreflopRaise = (MultipleValueCounter)other.callsBlindToAPreflopRaise.Clone();
            this.raisesBlindToAPreflopRaise = (MultipleValueCounter)other.raisesBlindToAPreflopRaise.Clone();
            this.draws = (MultipleValueCounter)other.draws.Clone();

            // Deep copy lists
            startingHandsWithPreflopCall = new List<HoldemHand>();
            foreach (HoldemHand h in other.startingHandsWithPreflopCall) startingHandsWithPreflopCall.Add((HoldemHand)h.Clone());

            startingHandsWithPreflopRaise = new List<HoldemHand>();
            foreach (HoldemHand h in other.startingHandsWithPreflopRaise) startingHandsWithPreflopRaise.Add((HoldemHand)h.Clone());

            startingHandsWithPreflopAllIn = new List<HoldemHand>();
            foreach (HoldemHand h in other.startingHandsWithPreflopAllIn) startingHandsWithPreflopAllIn.Add((HoldemHand)h.Clone());
        }
Esempio n. 2
0
        public HoldemPlayer(String playerName)
            : base(playerName)
        {
            blindType = BlindType.NoBlind;

            totalCalls = new Hashtable(5);
            totalBets = new Hashtable(5);
            totalFolds = new Hashtable(5);
            totalRaises = new Hashtable(5);
            totalChecks = new Hashtable(5);

            limps = new ValueCounter();
            limpsDetails = new MultipleValueCounter(HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster);

            voluntaryPutMoneyPreflop = new ValueCounter();

            raises = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            raisesRatings = new MultipleValueCounter(new object[] { HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River },
                new object[] { HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster });
            checkRaises = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            checksRaisesRatings = new MultipleValueCounter(new object[] { HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River },
                new object[] { HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster });
            checkFolds = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            checkCalls = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            checksCallsRatings = new MultipleValueCounter(new object[] { HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River },
                new object[] { HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster });
            checks = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            checksRatings = new MultipleValueCounter(new object[] { HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River },
                new object[] { HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster });
            sawStreet = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River, HoldemGamePhase.Showdown);
            bets = new MultipleValueCounter(HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            betsRatings = new MultipleValueCounter(new object[] { HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River },
                new object[] { HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster });
            folds = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            calls = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            callsRatings = new MultipleValueCounter(new object[] { HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River },
                new object[] { HoldemHand.Rating.Nothing, HoldemHand.Rating.Weak, HoldemHand.Rating.Mediocre, HoldemHand.Rating.Strong, HoldemHand.Rating.Monster });

            draws = new MultipleValueCounter(new object[] { HoldemGamePhase.Flop, HoldemGamePhase.Turn },
                new object[] { HoldemPlayerAction.Bet, HoldemPlayerAction.Call, HoldemPlayerAction.Check, HoldemPlayerAction.CheckCall, HoldemPlayerAction.CheckFold, HoldemPlayerAction.CheckRaise, HoldemPlayerAction.Fold, HoldemPlayerAction.Raise });

            cbets = new ValueCounter();
            stealRaises = new ValueCounter();
            foldsToAStealRaise = new MultipleValueCounter(BlindType.BigBlind, BlindType.SmallBlind);
            callsToAStealRaise = new MultipleValueCounter(BlindType.BigBlind, BlindType.SmallBlind);
            raisesToAStealRaise = new MultipleValueCounter(BlindType.BigBlind, BlindType.SmallBlind);

            wentToShowdown = new ValueCounter();
            wonAtShowdown = new ValueCounter();

            pushedAllIn = new MultipleValueCounter(HoldemGamePhase.Preflop, HoldemGamePhase.Flop, HoldemGamePhase.Turn, HoldemGamePhase.River);
            totalAllIns = new ValueCounter();

            foldsBlindToAPreflopRaise = new MultipleValueCounter(BlindType.BigBlind, BlindType.SmallBlind);
            callsBlindToAPreflopRaise = new MultipleValueCounter(BlindType.BigBlind, BlindType.SmallBlind);
            raisesBlindToAPreflopRaise = new MultipleValueCounter(BlindType.BigBlind, BlindType.SmallBlind);

            startingHandsWithPreflopCall = new List<HoldemHand>();
            startingHandsWithPreflopRaise = new List<HoldemHand>();
            startingHandsWithPreflopAllIn = new List<HoldemHand>();

            ResetAllStatistics();
        }
Esempio n. 3
0
        private void AppendActionsSubstatistics(HoldemGamePhase phase, Statistic statistic, MultipleValueCounter ratings)
        {
            float sum = (float)ratings.GetSumOfAllValuesIn(phase);

            foreach (HoldemHand.Rating rating in Enum.GetValues(typeof(HoldemHand.Rating)))
            {
                if (sum == 0) statistic.AddSubStatistic(new StatisticsUnknownData(rating.ToString()));
                else
                {
                    float ratio = (float)ratings[phase, rating].Value / sum;
                    statistic.AddSubStatistic(new StatisticsPercentageData(rating.ToString(), ratio));
                }
            }
        }
Esempio n. 4
0
        /* @param ratings the multiple value counter object containing the ratings how a check action, can be null if no ratings are available */
        private Statistic GetCheckActionStats(HoldemGamePhase phase, String name, String category, MultipleValueCounter values, MultipleValueCounter ratings)
        {
            int checkActions = (int)checkRaises[phase].Value + (int)checkCalls[phase].Value + (int)checkFolds[phase].Value;

            if (checkActions == 0)
            {
                if (ratings != null) return CreateUnknownActionStatistic(name, category);
                else return Statistic.CreateUnknown(name, category);
            }
            else
            {
                float ratio = (float)values[phase].Value / (float)checkActions;
                Statistic ret = new Statistic(new StatisticsPercentageData(name, ratio), category);

                if (ratings != null) AppendActionsSubstatistics(phase, ret, ratings);

                return ret;
            }
        }
        /* Deep copy required */
        public object Clone()
        {
            MultipleValueCounter copy = new MultipleValueCounter();
            copy.table = new Hashtable(this.table.Keys.Count);

            // Clone all members of the table
            foreach (int domain in this.table.Keys)
            {
                copy.table[domain] = ((ValueCounter)this.table[domain]).Clone();
            }

            // Copy a reference of the subdomains (if available)
            if (this.subdomains != null) copy.subdomains = this.subdomains;

            return copy;
        }