feat(walls): door refusals and secret/locked equivalence gate (#56)
- door.set: opening a secret or locked door is invalid; closing either is allowed; a fixed window/non-door still has no open state. - new tools/doors.test.mjs: two fresh servers, one identical script, three equivalence pairs (secret/wall, secret+locked/wall, locked/closed door), canonicalised frame + full per-player tile sweeps, an open-door positive control and a pinned zero-thickness close-push. - secretgap fault hook (sight-only) makes the pair fail as exactly SECRETGAP; the clean pair passes and the shipped binary carries no fault hook. - docs/TESTING.md T2/T17 and the door-equivalence/10.3 sections: built. Ref #56
This commit is contained in:
+8
-3
@@ -15,13 +15,18 @@
|
||||
## copies a token record before it applies an outcome, and a Nim seq assignment shares its buffer, so
|
||||
## in-place edits would reach the authoritative list before the transaction commits (4.2 step 6).
|
||||
import std/options
|
||||
import geometry, moverules, tokens, world
|
||||
import geometry, moverules, tokens, world, faults
|
||||
|
||||
proc geometryWalls*(sc: SceneRec): seq[Wall] =
|
||||
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).
|
||||
## `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:
|
||||
result.add Wall(a: w.a, b: w.b, door: w.door, open: w.open)
|
||||
var wall = Wall(a: w.a, b: w.b, door: w.door, open: w.open)
|
||||
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).
|
||||
|
||||
Reference in New Issue
Block a user