Beispiel #1
0
 public override void Execute(IRover rover, Instruction instruction)
 {
     switch(instruction.GetInstruction())
     {
         case Instruction.TurnLeft:
             rover.SetFacing(West);
             break;
         case Instruction.TurnRight:
             rover.SetFacing(East);
             break;
         case Instruction.MoveForward:
             rover.MoveNorth();
             break;
         default:
             throw new ArgumentException("Incorrect facing code.");
     }
 }
Beispiel #2
0
 public abstract void Execute(IRover rover, Instruction instruction);