feat(walls): one-way sight per-viewer filter and ONEWAY fault (#58)

The vision fan blocks a sight-blocking one-way wall only for a viewer on
its blind side (sight_dir names it; left is the (-dy,dx) normal of a->b),
one sign test inline after the radius cull, so the hoisted wall list stays
viewer-independent. Movement never reads the direction: one-way walls block
both ways. Explored and tiles therefore differ by side and only ever grow.

- geometry: WallDir + Wall.sightDir + blindTo, filter in visibilityPolygon.
- worldmap: sight_dir mapping (movement mapping unchanged).
- vision: the ONEWAY leak-fault build drops sight_dir player-side.
- leakcheck: own side test for the fan and the clear-segment oracle; ONEWAY
  class detected against the sight_dir-dropped fan.
- leak scenario gains a one-way wall the subject sees across; fault test
  asserts exactly ONEWAY.
- oneway.test.mjs: both sides, tile sweep with its own oracle, flip with
  fixed endpoints, monotone explored/tiles, restart, two-way movement.
- docs: DESIGN 5.8 mechanism sentence corrected; TESTING #58 markers built.
- nginx harness: temp dirs created recursively (restart on one state dir).
This commit is contained in:
2026-11-19 22:57:39 +01:00
parent 0f3aa2300f
commit 9fcbe885c1
14 changed files with 649 additions and 78 deletions
+10 -3
View File
@@ -18,18 +18,25 @@ import std/options
import geometry, moverules, tokens, world, faults
proc geometryWalls*(sc: SceneRec, forSight = false): seq[Wall] =
## The scene's walls as the vision code sees them: an open door does not block (5.1).
## The scene's walls as the vision code sees them: an open door does not block (5.1), and a
## one-way wall carries the side that is blind (5.8, #58). Movement gets the same mapping and
## ignores `sightDir` (two-way).
## `forSight` is only the sight computation; `LEAK_FAULT=secretgap` (a -d:leakfault build only)
## opens a secret door there, the negative control for the door-equivalence group (#56).
result = newSeqOfCap[Wall](sc.walls.len)
for w in sc.walls:
var wall = Wall(a: w.a, b: w.b, door: w.door, open: w.open)
let dir = case w.sightDir
of sdBoth: wdBoth
of sdLeft: wdLeft
of sdRight: wdRight
var wall = Wall(a: w.a, b: w.b, door: w.door, open: w.open, sightDir: dir)
if forSight and w.secret and faultActive("secretgap"):
wall.open = true
result.add wall
proc ruleWall*(w: WallRec): Wall =
## The same wall as the move rules see it (they need `door`/`open` to know what blocks).
## The same wall as the move rules see it (they need `door`/`open` to know what blocks; the
## one-way direction is sight-only and never read by the move rules, so it is not mapped).
Wall(a: w.a, b: w.b, door: w.door, open: w.open)
proc ruleToken*(sc: SceneRec, t: TokenRec): moverules.Token =