Пример #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="table">The table upon which the players for this scenario are seated</param>
 /// <param name="round">The current round of betting</param>
 /// <param name="policy">Policy information dictating what the player can and can't do</param>
 public PreflopBetModel(PlayerModel player, HoldemHandRound round, BetTypeModel betType)
     : base(betType)
 {
     Player = player;
     Round = round;
     Icon = Utilities.LoadBitmap(Properties.Resources.PreflopBetIcon);
     Range = new HandRangeModel();
     InfoDisplayType = typeof(BetTreeNodeInfo);
 }
Пример #2
0
 protected void SetModel(object sender, DependencyPropertyChangedEventArgs e)
 {
     _model = DataContext as HandRangeModel;
     Initialise();
 }
Пример #3
0
        public void Distribute(List<CompiledCondition> conditions, HandRangeModel range, int numIterations)
        {
            RangeCalculatorService service = new RangeCalculatorService();
            HandMask[][][] masks = service.Calculate(new HandRange[] { range.Range }, new Card[] { null, null, null, null, null },
                numIterations, new bool[] { true, false, false });

            int[] hits = new int[conditions.Count];
            for (int i = 0; i < numIterations; i++)
            {
                HandMask mask = masks[i][0][0];
                int index = 0;
                foreach (CompiledCondition container in conditions)
                {
                    if (container.Matches(mask))
                    {
                        hits[index]++;
                        break;
                    }
                    index++;
                }
            }

            for (int i = 0; i < this.Definition.ConfiguredConditions.Count; i++)
            {
                this.Definition.ConfiguredConditions[i].ExpectedProbability = 0;
            }

            for (int i = 0; i < hits.Length; i++)
            {
                conditions[i].Container.ExpectedProbability = (float)hits[i] / numIterations;
            }
        }
Пример #4
0
        public void Distribute(float rangeFactor, float variationFactor)
        {
            HandRangeModel range = new HandRangeModel();
            range.RangePercentage = rangeFactor;
            range.VariationFactor = variationFactor;

            List<CompiledCondition> conditions = Service.GetCompiledConditions(
                this.Conditions.Where(x => x.IsSelected).Select(x => x.Condition).ToList());
            Service.Distribute(conditions, range, 5000);

            foreach (AvailableConditionListingModel listing in this.Conditions)
                listing.Probability = String.Format("{0:0.00}%", listing.Condition.ExpectedProbability * 100);
        }