public int StepsToExit(JumpAdjustment jumpAdjustment) { int current = 0; int steps = 0; do { int jump = jumpOffsets[current]; jumpOffsets[current] += jumpAdjustment(jump); current += jump; steps++; }while (current >= 0 && current < jumpOffsets.Length); return(steps); }
private int PerformJumps(JumpAdjustment jumpAdjustment) => new JumpMaze(maze).StepsToExit(jumpAdjustment);