Esempio n. 1
0
        private int WhatDirectionAfterTurn(Turn turn)
        {
            if (currentDirection == 0)
            {
                return((turn.Direction == Direction.Left) ? 270 : 90);
            }

            if (currentDirection == 180)
            {
                return((turn.Direction == Direction.Left) ? 90 : 270);
            }

            if (currentDirection == 90)
            {
                return((turn.Direction == Direction.Left) ? 0 : 180);
            }

            if (currentDirection == 270)
            {
                return((turn.Direction == Direction.Left) ? 180 : 0);
            }

            throw new ArgumentException("No idea which way to turn");
        }
Esempio n. 2
0
 public void Move(Turn turn)
 {
     this.currentDirection = WhatDirectionAfterTurn(turn);
     MoveInCurrentDirection(turn.Blocks);
 }