Beispiel #1
0
        private void addRule(int hash, Rule rule)
        {
            // hash
            if (!rules.ContainsKey(hash))
            {
                rules.Add(hash, new MaxBetDictionary());
            }

            // bet
            MaxBetDictionary maxBetDict = rules[hash];
            MaxBet           maxBet     = new MaxBet(rule.MinMaxBet, rule.MaxMaxBet);

            if (!maxBetDict.ContainsKey(maxBet))
            {
                maxBetDict.Add(maxBet, new PotSizeDictionary());
            }

            // pot
            PotSizeDictionary potSizeDict = maxBetDict[maxBet];
            PotSize           potSize     = new PotSize(rule.MinPotSize, rule.MaxPotSize);

            if (!potSizeDict.ContainsKey(potSize))
            {
                potSizeDict.Add(potSize, rule);
            }
        }
Beispiel #2
0
        public Rule findRule(StreetTypes street, HandTypes hand,
                             ChanceTypes chance, int opponents,
                             OpponentActionTypes action,
                             PositionTypes position,
                             double maxBet, double potSize)
        {
            // hash
            int hash = getHashCode(street, hand, chance, opponents, action, position);

            if (!rules.ContainsKey(hash))
            {
                Log.Debug("cannot find rule for this constellation -> "
                          + describe(street, hand, chance, opponents, action));
                return(new Rule(street, hand, chance, opponents, opponents, action));
            }

            // intervals
            MaxBetDictionary  maxBetDict  = rules[hash];
            PotSizeDictionary potSizeDict = maxBetDict.getByInterval(maxBet);
            Rule rule = potSizeDict.getByInterval(potSize);

            return(rule);
        }