Gridwalk

Worked examples

See what each obstacle changes

Copy any grid below into the calculator. Each period is an open cell and each # is a block. Moves go right and down only.

An open 3 × 3 grid: six routes

...
...
...

Every route makes two right moves and two down moves. Choosing where the two down moves occur among four moves gives 6 routes. The deterministic right-first example is RRDD, visiting (1,1), (1,2), (1,3), (2,3), (3,3). Its counts-to-cell table ends in 6.

Block the centre: two routes

...
.#.
...

The centre's count becomes zero. Only the route around the top and right edge, and the route around the left and bottom edge, remain. The exact count is 2. The right-first example remains RRDD. Its mirror, DDRR, is the other route.

Counts to each cell:
1  1  1
1  0  1
1  1  2

A wider pair of blocks

....
.##.
....

This 3 × 4 grid also has 2 routes. The two middle blocks force a valid route to stay along either the top or the bottom edge while crossing the middle columns. Each complete route needs five moves. The right-first example is RRRDD.

Two separated obstacles: eighteen routes

.....
.#...
...#.
.....
.....

The counts-to-cell table is:

1  1  1   1   1
1  0  1   2   3
1  1  2   0   3
1  2  4   4   7
1  3  7  11  18

The answer is 18. In the final cell, 7 routes arrive from above and 11 from the left. The deterministic example uses RRRRDDDD, along the open top and right edges. Showing one example does not mean the other seventeen routes are missing from the count.

A barrier can make the count zero

.#.

There is only one row, so moving down is impossible. The block stops the only possible rightward sequence. This is a valid grid with 0 routes; the table can still be inspected and exported. The fixed move count would be two for a complete route, but no such route exists here.

One cell is an important edge case

.

The open start is already the destination. There is 1 empty route and 0 moves. Its cell list is (1,1), and the SVG shows a single route point. Change the cell to # and the count is 0. A blocked endpoint does not make the grid syntax invalid.

Check your assumptions

Gridwalk treats the characters as cells, not intersections of grid lines. It does not allow diagonal moves, backtracking, jumping blocks or leaving the rectangle. If your puzzle uses a different rule, these counts describe a different model.

Try an example · Read the method and bounds