Esempio n. 1
0
        public void Navigate(char instruction)
        {
            if (instruction == 'L')
            {
                _robot.Heading--;
            }
            else if (instruction == 'R')
            {
                _robot.Heading++;
            }
            else if (instruction == 'M')
            {
                IMover mover = MoverFactory.Create(_battleArena.Boundary.Locations, _robot.Heading.Value, _robot.Location);

                Location currentLocation = new Location(_robot.Location.X, _robot.Location.Y);
                _robot.Location = mover.Move();

                if (currentLocation == _robot.Location)
                {
                    _robot.Penalties++;
                }
            }
        }
Esempio n. 2
0
        public void Navigate()
        {
            IMover mover = MoverFactory.Create(_mower);

            mover.Move();
        }