public static bool SolveMaze(IMazeWalker entity, Point mazeFinish) { bool endOfMazeReached = false; while (!endOfMazeReached) { bool couldMoveForward = entity.MoveForward(); if (!couldMoveForward) { entity.TurnRight(); } else { if (entity.CanSeeLeftTurning()) { entity.TurnLeft(); } } endOfMazeReached = Equals(entity.CurrentPosition, mazeFinish); entity.DumpState(); } return(true); }
public void Step() => _impl.MoveForward();