ludus

Maze Solving

ld-0013 · 8 › ████████░░ · graphs, algorithms · requires: arrays, lambda, algorithmic · oner generalized golfed

You find yourself stuck in a maze! You have to find the shortest way out.

INPUT is a 19-by-19 grid: a cell containing 1 is a wall, an empty cell is open. You start at the top-left corner and must reach the bottom-right corner, moving up, down, left, or right through open cells; you cannot leave the grid.

Give your answer as a list of coordinates of the form <row>|<column>, one per row of OUTPUT, from the start (1|1) to the exit (19|19). Rows count from the top, columns from the left. The corners are always open, and there is exactly one shortest path.

Work on it

  1. Make a copy of the template — it becomes your private sheet.
  2. Solve it however you like — helper columns and extra tabs are fair game. The one rule: the grader swaps INPUT for other datasets, so never put your own content inside INPUT.
  3. Check yourself against the expected sample output shown in your copy (and below).
  4. Submit below — Share → "anyone with the link, Viewer", paste the link. Your sheet is graded against 2 hidden datasets, so hardcoded answers won't survive.

Sample

Input (Input!B2:T20)

11
11111111111111
1111
11111111111111
111111
111111111111
111111
111111111111
111111
1111111111
111111
1111111111111111
11
111111111111111
11111
11111111111
1111111
1111111111
1111

Expected output (Answer!B3:B62)

Path
1|1
2|1
3|1
3|2
3|3
4|3
5|3
6|3
7|3
7|4
7|5
8|5
9|5
10|5
11|5
12|5
13|5
13|6
13|7
13|8
13|9
13|10
13|11
13|12
13|13
13|14
13|15
14|15
15|15
16|15
17|15
17|14
17|13
18|13
19|13
19|14
19|15
19|16
19|17
18|17
17|17
17|18
17|19
18|19
19|19

Adapted from "Maze Solving" in the astral.cafe Community Practice Problems sheet.