IT lexicon › Programming › Drunkard's walk

Drunkard's walk

Programming På svenska → Updated: 2026-10-25

A level-carving method where a random-walking "digger" tunnels floor out of solid rock until enough is open — the lazy route to an organic, always-connected cave.

Fill a grid with wall, drop in a digger, let it step in a random direction and carve out each cell it passes. When a set fraction of the map is open, you stop. Because the digger always moves from already-open ground, the result is guaranteed connected — no isolated pockets — and looks naturally cave-like, without the straight walls that room-and-corridor methods produce.

The method is a roguelike classic precisely because it is a few lines of code and still never produces an unplayable map. Several diggers, or a bias in the direction, shape the cave's character.

← Back to the lexicon