NetHack's Gnomish Mines level generation uses a simple procedural pipeline to produce organic cave-like levels: start by randomly marking 40% of cells as floor, run four cellular automata passes, then add corridors to reconnect any isolated caves. The cellular automata operate on a binary floor/rock grid and use 8-neighbour counts. Pass 1: 0-2 → rock, 3-4 → unchanged, 5-8 → floor and is applied in-place (unbuffered). Pass 2: 0-4 → unchanged, exactly 5 → rock, 6-8 → unchanged. Passes 3 and 4: 0-2 → rock, 3-8 → unchanged; these three later passes are buffered and applied synchronously. A visualiser makes the process and resulting cave geometry easy to inspect.
Functionally, pass 1 serves as a clustering step, pushing the random noise toward larger open regions while its unbuffered update avoids flip-flopping that would undo local changes. Passes 3 and 4 act as erosion, smoothing corners and removing tiny islands to produce more natural cave contours. Pass 2 is the curious element: it flips cells with exactly five floor neighbours (three rock neighbours) to rock, a selective pruning rule whose intended design effect is left unexplained. The write-up highlights that pass 2’s role is unclear and invites interpretation of how that exact-5 rule changes topology or passage widths beyond the more typical clustering-and-erosion pattern.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.