Labs · Randomness

Self-Avoiding Walk

Self-Avoiding Walk simulation

A random walker on a grid with one extra rule: it may never visit the same spot twice. That small constraint changes the statistics completely. Self-avoiding walks are used to model polymer chains, which cannot pass through themselves.

Sooner or later the walker traps itself. It can then restart, or backtrack along its path to the last spot that still had a free neighbour. Backtracking is depth-first search, and it eventually fills the whole grid, carving a random maze (the faint lines).

Switch to "Restart" and watch how short the walks usually are before they get stuck.

Controls

Evolved from Random Walkers.

Evolved into Maze Generation & Solving.