Пример #1
0
        public void parseCommand(String command)
        {
            String[] parts     = command.Split(" ");
            String   direction = parts[0];
            int      amount    = int.Parse(parts[1]);

            Instruction instruction = null;

            if (direction.Equals("foward"))
            {
                instruction = new MoveInstruction(amount);
            }
            if (direction.Equals("left"))
            {
                instruction = new TurnInstruction(amount);
            }
            if (direction.Equals("right"))
            {
                instruction = new TurnInstruction(-1 * amount);
            }

            instructions.Add(instruction);
        }
Пример #2
0
 protected override void SetMyBlockInternalArg()
 {
     myBlockInternalArg = new TurnInstruction(this);
 }