Example #1
0
        /// <summary>
        /// Method to set profitable coefficient to this ChipNode.
        /// </summary>
        public void SetCoefficient()
        {
            if (NextChips.Count == 0)
            {
                Coefficient = BotService.Evaluate(Board, Chip);
            }
            else
            {
                // Level that divides without modulo - bot`s chips.
                // Others - opponent`s chips.
                Coefficient = Level % 2 == 0 ?
                              NextChips.Max(chipNode => chipNode.Coefficient) :
                              NextChips.Min(chipNode => chipNode.Coefficient);

                MostProfitableChip = NextChips
                                     .Where(chipNode => chipNode.Coefficient == Coefficient)
                                     .Select(chipNode => chipNode.Chip).FirstOrDefault();
            }
        }
Example #2
0
 public virtual void AddChip(int chip)
 {
     NextChips.Add(chip);
 }