예제 #1
0
        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);
            }
        }
예제 #2
0
 public Rover(Plateau plateau, RoverPosition roverPosition)
 {
     _plateau             = plateau;
     _roverPosition       = roverPosition.ValidateCoordinate(plateau);
     _roverPosition.Rover = this;
 }
예제 #3
0
 public Rover(Plateau plateau, Location position, string command)
 {
     map             = plateau;
     currentLocation = position;
     roverCommand    = command;
 }
예제 #4
0
 private bool ValidPositionOnPlateau(Position newPosition, Plateau map)
 {
     return(newPosition.X >= 0 && newPosition.X <= map.BoundaryX && newPosition.Y >= 0 && newPosition.Y <= map.BoundaryY);
 }
예제 #5
0
파일: Rover.cs 프로젝트: gktnkrdg/MarsRover
 public Rover(Plateau Plateau, Position position)
 {
     this.Plateau  = Plateau;
     this.Position = position;
 }