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"); }
public void Move(Turn turn) { this.currentDirection = WhatDirectionAfterTurn(turn); MoveInCurrentDirection(turn.Blocks); }