Esempio n. 1
0
        private bool Move()
        {
            if (!_rover.IsOutOfBorder())
            {
                return(false);
            }

            switch (_rover.GetRotation())
            {
            case Rotation.N:
                _rover.GetLocation().PointY += 1;
                break;

            case Rotation.E:
                _rover.GetLocation().PointX += 1;
                break;

            case Rotation.S:
                _rover.GetLocation().PointY -= 1;
                break;

            case Rotation.W:
                _rover.GetLocation().PointX -= 1;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(true);
        }