# NetHack's Gnomish Mines grow their caves with cellular automata

Original title: Dungeon Generation in the Gnomish Mines of NetHack

> Hacker News story 50154109 · language: en · submitted 2026-10-19
> Web version: https://zeli.app/story/50154109
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 151 · by [ibobev](<https://news.ycombinator.com/user?id=ibobev>) · 💬 19
[original](<https://www.boristhebrave.com/2026/10/18/dungeon-generation-in-the-gnomish-mines-of-nethack/>) · [HN discussion](<https://news.ycombinator.com/item?id=50154109>)

## Summary

Most of NetHack unfolds in square rooms, but the Gnomish Mines generate organic caves: seed 40% of the grid as floor, then run four passes of cellular automata. Pass 1 clusters tiles in place, passes 3 and 4 erode corners and tiny islands, and the author still can't work out what pass 2 — which turns a cell to rock when exactly five neighbors are floor — is meant to accomplish.

## Key quote

> Pass 2 though… It turns cells to rock if they have exactly 5 floor neighbors (i.e. 3 rock neighbors). I'm still struggling to understand what purpose this is intended to achieve. Any ideas?

## HN discussion (19 comments)

### [OkayPhysicist](<https://news.ycombinator.com/item?id=50198362>)

> I think pass two is intended to introduce additional regions of concavity (mostly by replacing straight lines), which in effect introduces a bunch of inflection points, helping creating the organic "spiny" feel, as opposed to a "bubbly" feel. Without it, the resulting caves look a bit more like if you spilled liquid on a waxy surface, and less like thorns.
>
> If you go into the javascript and replace "for(let p=0;p<3;p++)" with "for(let p=1;p<3;p++)", and then re-execute the block in the console, you can generate run through a bunch of generations without step 2

### [ImJasonH](<https://news.ycombinator.com/item?id=50200297>)

> All that work for some miscreant dwarf archeologist with a pick-axe (me) to show up and dig it to hell for a bunch of worthless glass.

### [Rooster61](<https://news.ycombinator.com/item?id=50197711>)

> Oh wow. I had no idea this was based on cellular automata. It really does give a totally different feel versus the other sections of the dungeon.

---

## Cite

- Page: https://zeli.app/story/50154109
- Date: 2026-10-19
- Source: boristhebrave.com (https://www.boristhebrave.com/2026/10/18/dungeon-generation-in-the-gnomish-mines-of-nethack/)
- Hacker News: https://news.ycombinator.com/item?id=50154109

## Other languages

- zh: https://zeli.app/zh/story/50154109 · markdown: https://zeli.app/zh/story/50154109.md
- ja: https://zeli.app/ja/story/50154109 · markdown: https://zeli.app/ja/story/50154109.md
- ko: https://zeli.app/ko/story/50154109 · markdown: https://zeli.app/ko/story/50154109.md
- de: https://zeli.app/de/story/50154109 · markdown: https://zeli.app/de/story/50154109.md
- es: https://zeli.app/es/story/50154109 · markdown: https://zeli.app/es/story/50154109.md
- ru: https://zeli.app/ru/story/50154109 · markdown: https://zeli.app/ru/story/50154109.md
