Пример #1
0
        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();
        }