moverules: swept-circle move check, token-on-wall escape, blocked flag, step cap, GM bypass

Pure in-process module (server/moverules.nim, plain data, no IO) per DESIGN 5.5. Replaces moveBlocked tests
(ported at r=0), the KNOWN LIMITATION pin and the Q14 pin with positive escape/capsule assertions and
blocked-policy tests. tests/tprobing.nim: in-process T8 probing test with a concrete bound (stepCap + r).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 12:11:49 +01:00
co-authored by Claude Sonnet 5.5
parent 67fa96e23d
commit afe84f2add
5 changed files with 601 additions and 21 deletions
+1 -21
View File
@@ -1,11 +1,5 @@
import std/[unittest, json, os, math]
import geometry, refold
proc W(ax, ay, bx, by: float, door = false, open = false): Wall =
Wall(a: (ax, ay), b: (bx, by), door: door, open: open)
proc box(x0, y0, x1, y1: float): seq[Wall] =
@[W(x0, y0, x1, y0), W(x1, y0, x1, y1), W(x1, y1, x0, y1), W(x0, y1, x0, y0)]
import geometry, refold, testutil
proc sees(walls: openArray[Wall], o, p: Vec, r = 500.0): bool =
visibilityPolygon(o, walls, r).inside(p)
@@ -257,20 +251,6 @@ suite "corpus (prototype leak transcripts)":
check doorsSeen > 0 # and exercises opened doors
# ---- differential: scanline vs prototype per-cell ---------------------------------------------------------------
# Tiny deterministic PRNG so the tests do not depend on std/random version behaviour.
type Rng = object
s: uint64
proc next(r: var Rng): uint64 =
r.s = r.s xor (r.s shl 13); r.s = r.s xor (r.s shr 7); r.s = r.s xor (r.s shl 17); r.s
proc uni(r: var Rng, lo, hi: float): float = lo + (hi - lo) * float(r.next shr 11) / float(1'u64 shl 53)
proc randomWalls(r: var Rng, n: int, span: float): seq[Wall] =
for i in 0 ..< n:
let a: Vec = (r.uni(0, span), r.uni(0, span))
let ang = r.uni(0, 2 * PI)
let l = r.uni(10, 300)
result.add Wall(a: a, b: (a.x + l * cos ang, a.y + l * sin ang), door: i mod 7 == 0, open: i mod 14 == 0)
suite "cellsTouched differential vs prototype":
test "random visibility polygons: identical cell lists":
var r = Rng(s: 0x9E3779B97F4A7C15'u64)