private void ConvertToChips(decimal value) { Chips.Clear(); if (value == 0) { return; } foreach (var key in ChipRates.Keys.Reverse()) { int chipAmount = (int)(value / key); if (chipAmount > 0) { Chips.Add(new ChipModel() { ChipColor = ChipRates[key], Count = chipAmount }); value %= key; if (value == 0) { break; } } } }
public void Give(ref Bot low, ref Bot high) { low.Assign(Chips.First()); high.Assign(Chips.Last()); Chips.Clear(); Chips.Add(int.MaxValue); Chips.Add(int.MaxValue); }
public void ApplyInstruction(Instruction instruction) { if (instruction == null) { throw new ArgumentNullException(nameof(instruction)); } if (instruction.Bot != this) { throw new InvalidOperationException($"Чужая инструкция"); } if (!Ready) { throw new InvalidOperationException($"Bot {Id} еще не готов"); } var orderedChips = Chips.OrderBy(x => x).ToArray(); instruction.LowDestination.AddChip(orderedChips[0]); instruction.HighDestination.AddChip(orderedChips[1]); Chips.Clear(); }
/// <summary> /// The CombineChips method is called to clean up the stack of chips. /// Collection of smaller value chips are combined into larger value chips. /// </summary> public void CombineChips() { Chips.Clear(); // Clear the current stack of chips. int quotient = BetAmount / Chip.GetChipValue(ChipType.FiveHundredThousand); int remainder = BetAmount % Chip.GetChipValue(ChipType.FiveHundredThousand); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new FiveHundredThousand(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.OneHundredThousand); remainder = remainder % Chip.GetChipValue(ChipType.OneHundredThousand); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new OneHundredThousand(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.TwentyFiveThousand); remainder = remainder % Chip.GetChipValue(ChipType.TwentyFiveThousand); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new TwentyFiveThousand(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.FiveThousand); remainder = remainder % Chip.GetChipValue(ChipType.FiveThousand); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new FiveThousand(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.OneThousand); remainder = remainder % Chip.GetChipValue(ChipType.OneThousand); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new OneThousand(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.FiveHundred); remainder = remainder % Chip.GetChipValue(ChipType.FiveHundred); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new FiveHundred(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.OneHundred); remainder = remainder % Chip.GetChipValue(ChipType.OneHundred); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new OneHundred(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.TwentyFive); remainder = remainder % Chip.GetChipValue(ChipType.TwentyFive); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new TwentyFive(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.Five); remainder = remainder % Chip.GetChipValue(ChipType.Five); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new Five(Chips.Count)); } } quotient = remainder / Chip.GetChipValue(ChipType.One); remainder = remainder % Chip.GetChipValue(ChipType.One); if (quotient > 0) { for (int i = 0; i < quotient; i++) { Chips.Add(new One(Chips.Count)); } } }
/// <summary> /// The ClearBet method is called to clear the bet amount. /// </summary> public void ClearBet() { BetAmount = 0; Chips.Clear(); }
public void Remove() { Chips.Clear(); }
public void Restart() { Game = new Game(); Chips.Clear(); Preview = null; }