Skip to content

Stop shut doors turning interior rooms into solid rock - #5

Merged
Justrada merged 1 commit into
mainfrom
fix/interior-rooms-turned-to-rock
Jul 29, 2026
Merged

Stop shut doors turning interior rooms into solid rock#5
Justrada merged 1 commit into
mainfrom
fix/interior-rooms-turned-to-rock

Conversation

@Justrada

Copy link
Copy Markdown
Owner

Caught by driving the deployed build — an interior came back as 56 rock and 64 floor. Interiors should have zero solid hexes; walls are edges specifically so a room costs no standable ground.

Cause

reachableFrom — the generator's connectivity check — treated a shut door as a barrier. So any room the spanning tree happened to gate with a closed door was judged unreachable, and the prune pass filled it with stone.

A closed door is a door. Someone opens it. Structural reachability blocks on walls and solid terrain only. Moment-to-moment passability is a different question, and the engine already answers it correctly through compileTerrain + reachableHexes, which do respect door state.

Why the tests missed it

Two reasons, both worth noting:

  1. The existing "leaves no stranded hexes" test called the same helper, so it was self-consistent with the bug — it agreed that the walled-off rooms were unreachable, and the prune had already turned them to rock so they were no longer "open".
  2. Doors are closed 25% of the time; with ~6 spanning-tree doors, roughly 1 seed in 5 rolls all-open. The seed the interior suite used was one of them.

New tests

  • interior produces no solid hexes across 60 seeds
  • every room stays reachable across 30 seeds with every door forced locked

Both fail against the old code and pass against this one — verified by reverting just the source and re-running.

440 tests green, typecheck and build clean.

🤖 Generated with Claude Code

Connectivity pruning treated a closed door as a barrier, so any room the
spanning tree happened to gate with one was declared unreachable and filled
with stone. On the live build a 12x10 tavern came back as 56 rock and 64
floor — walls are edges precisely so an interior costs zero standable
ground, and this was quietly undoing that.

A closed door is a door; someone opens it. Structural reachability now
blocks on walls and solid terrain only. Moment-to-moment passability is a
different question and the engine already answers it through compileTerrain
+ reachableHexes, which do respect door state.

The existing "no stranded hexes" test could not catch this: it called the
same helper, so it was self-consistent with the bug. The seed it ran on also
happened to roll all-open doors. Both new tests fail against the old code.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Justrada
Justrada merged commit affb533 into main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant