Example #1
0
        private Rover GenerateRover(int positionX, int positionY, FacingTypes facingTo)
        {
            var roverInitialState = new RoverState(positionX, positionY, facingTo);
            var roverContext      = new RoverContext(roverInitialState);

            return(new Rover(roverContext));
        }
Example #2
0
        public void ChangePosition(FacingTypes facing)
        {
            switch (facing)
            {
            case FacingTypes.East:
                PositionY++;
                break;

            case FacingTypes.South:
                PositionX++;
                break;

            case FacingTypes.West:
                PositionY--;
                break;

            case FacingTypes.North:
                PositionX--;
                break;
            }
        }
Example #3
0
 public RoverState(int positionX, int positionY, FacingTypes facingTo)
 {
     this.PositionX     = positionX;
     this.PositionY     = positionY;
     this.CurrentFacing = facingTo;
 }
Example #4
0
 private void ChangeCurrentFacing(FacingTypes facingTo)
 {
     CurrentFacing = facingTo;
 }
Example #5
0
 public RoverFacing(FacingTypes roverFacing)
 {
     ChangeCurrentFacing(roverFacing);
 }