Exemplo n.º 1
0
        private static IRover GetRoverFromArray(string[] array)
        {
            IRover rover;

            try
            {
                int x = Convert.ToInt32(array[0]);
                int y = Convert.ToInt32(array[1]);
                CardinalType c = (CardinalType)Enum.Parse(typeof(CardinalType), (array[2]).ToUpper());
                rover = new Rover { X = x, Y = y, Cardinal = c };
            }
            catch (Exception e)
            {
                throw new InvalidCastException("Could not interpret Rover input");
            }

            return rover;
        }
Exemplo n.º 2
0
 /// <summary>
 ///  Assigns a new <c>Rover</c> to this <c>Controller</c>
 /// </summary>
 /// <param name="rover">The new <c>Rover</c> to control</param>
 public void AssignRover(Rover rover)
 {
     this.rover = rover;
 }