public IEnumerable <Rover> Parse(string input) { var inputLines = SplitOn(input, Environment.NewLine); if (inputLines.Any() == false) { yield break; } Plateau plateau = new Plateau(inputLines.Dequeue()); while (inputLines.Count > 0) { Rover rover = new Rover(inputLines.Dequeue()); rover.Move(inputLines.Dequeue()); yield return(rover); } }
public Rover(Plateau plateau, RoverPosition roverPosition) { _plateau = plateau; _roverPosition = roverPosition.ValidateCoordinate(plateau); _roverPosition.Rover = this; }
public Rover(Plateau plateau, Location position, string command) { map = plateau; currentLocation = position; roverCommand = command; }
private bool ValidPositionOnPlateau(Position newPosition, Plateau map) { return(newPosition.X >= 0 && newPosition.X <= map.BoundaryX && newPosition.Y >= 0 && newPosition.Y <= map.BoundaryY); }
public Rover(Plateau Plateau, Position position) { this.Plateau = Plateau; this.Position = position; }