Function visitFor

Runs the provided visitor for steps, returning the cell we end at

// Get a cell 10 steps away (row-wise) from start
const cell = visitFor(grid, start, 10, visitorRow);
  • Parameters

    • grid: Grid

      Grid to traverse

    • start: Cell

      Start point

    • steps: number

      Number of steps

    • visitor: Visitor

      Visitor function

    Returns Cell