Пример #1
0
        public void DoAction(VacuumWorldState state, VacuumWorldAction action)
        {
            if (action != VacuumWorldAction.Suck)
            {
                throw new InvalidOperationException();
            }

            state.CleanSquare(state.VacuumPos);
        }
Пример #2
0
        private void CleanRandomDirtyNeighbour(VacuumWorldState state)
        {
            var adj = state.AdjacentSquares(state.VacuumPos).Where(state.SquareIsDirty).ToList();

            if (adj.Count == 0)
            {
                return;
            }

            var squareToClean = _random.Choice(adj);

            state.CleanSquare(squareToClean);
        }