예제 #1
0
        public void MoveBackwards(RoverHeadingDirection currentRoverHeadingDirection)
        {
            switch (currentRoverHeadingDirection.HeadingDirection)
            {
            default:
            case RoverHeadingDirection.HeadingDirections.N:
                if (Y == 0)
                {
                    Y = MaxY;
                }
                else
                {
                    Y -= 1;
                }
                break;

            case RoverHeadingDirection.HeadingDirections.E:
                if (X == 0)
                {
                    X = MaxX;
                }
                else
                {
                    X -= 1;
                }
                break;

            case RoverHeadingDirection.HeadingDirections.S:
                if (Y == MaxY)
                {
                    Y = 0;
                }
                else
                {
                    Y += 1;
                }
                break;

            case RoverHeadingDirection.HeadingDirections.W:
                if (X == MaxX)
                {
                    X = 0;
                }
                else
                {
                    X += 1;
                }
                break;
            }
        }
예제 #2
0
 public void MoveBackwards(RoverHeadingDirection currentRoverHeadingDirection)
 {
     switch (currentRoverHeadingDirection.HeadingDirection)
     {
         default:
         case RoverHeadingDirection.HeadingDirections.N:
             if (Y == 0)
             {
                 Y = MaxY;
             }
             else
             {
                 Y -= 1;
             }
             break;
         case RoverHeadingDirection.HeadingDirections.E:
             if (X == 0)
             {
                 X = MaxX;
             }
             else
             {
                 X -= 1;
             }
             break;
         case RoverHeadingDirection.HeadingDirections.S:
             if (Y == MaxY)
             {
                 Y = 0;
             }
             else
             {
                 Y += 1;
             }
             break;
         case RoverHeadingDirection.HeadingDirections.W:
             if (X == MaxX)
             {
                 X = 0;
             }
             else
             {
                 X += 1;
             }
             break;
     }
 }