public int Add(RoverMachine rover) { rover.Id = _rovers.Count; _rovers.Add(rover); return(_rovers.Count - 1); }
private RoverMachine rotateLeft(RoverMachine rover) { if (rover.Heading == 'N') { rover.Heading = 'W'; } else if (rover.Heading == 'W') { rover.Heading = 'S'; } else if (rover.Heading == 'S') { rover.Heading = 'E'; } else if (rover.Heading == 'E') { rover.Heading = 'N'; } return(rover); }
private RoverMachine advance(RoverMachine rover) { if (rover.Heading == 'S') { rover.YPos -= 1; } if (rover.Heading == 'N') { rover.YPos += 1; } if (rover.Heading == 'W') { rover.XPos -= 1; } if (rover.Heading == 'E') { rover.XPos += 1; } return(rover); }