From 0e0b1a60523fb2f00f54e70f39e6c8395674802e Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sun, 8 Nov 2026 18:33:12 +0100 Subject: [PATCH] mutation: run all test files, add mutations e-j (scanline fill, escape crossing, GM bypass, capsule, step cap, blocked trigger); header limitations updated Control passes; a-d still caught (1,2,2,1,1 expected tests), new e-j each caught. Logs regenerated. Co-Authored-By: Claude Sonnet 5.5 --- results/mutation.log | 977 +++++++++++++++++++++++++++++++++++++++---- server/geometry.nim | 19 +- tools/mutation.sh | 34 +- 3 files changed, 938 insertions(+), 92 deletions(-) diff --git a/results/mutation.log b/results/mutation.log index f6bd11b..855a92e 100644 --- a/results/mutation.log +++ b/results/mutation.log @@ -17,6 +17,21 @@ [OK] long thin corridor [OK] wall endpoints behind the viewer: fan stays angularly ordered [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell [OK] crossing blocked, parallel ok [OK] grazing an endpoint is blocked [OK] no leak through shared vertex @@ -24,23 +39,53 @@ [OK] moving along a collinear wall is blocked [OK] doors [OK] zero-length move - [OK] square polygon - [OK] tiny polygon inside one cell - [OK] polygon spanning a cell with no vertex in it - [OK] big polygon includes fully covered interior cells - [OK] every token in seed sees itself and is not walled in - [OK] near pillar: circle overlapping blocked, clear ok - [OK] near closed door blocks, open door passes - [OK] 64px corridor and doorway passable on centerline - [OK] legacy overlap can escape, not stay overlapped - [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict - [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length # test exit=0; expected tests failed: 0 control: exit=0 expected_failed=0 ok ## a: remove the +-RayEps rays # diff server/geometry.nim -> mutated copy: -# 59,60d58 +# 62,63d61 # < angles.add ang - RayEps # < angles.add ang + RayEps [OK] open space is a circle @@ -61,6 +106,22 @@ control: exit=0 expected_failed=0 ok [OK] long thin corridor [OK] wall endpoints behind the viewer: fan stays angularly ordered [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [FAILED] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [FAILED] prototype scene, all tokens, doors closed and opened + [FAILED] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tgeometry' [OK] crossing blocked, parallel ok [OK] grazing an endpoint is blocked [OK] no leak through shared vertex @@ -68,25 +129,54 @@ control: exit=0 expected_failed=0 ok [OK] moving along a collinear wall is blocked [OK] doors [OK] zero-length move - [OK] square polygon - [OK] tiny polygon inside one cell - [OK] polygon spanning a cell with no vertex in it - [OK] big polygon includes fully covered interior cells - [OK] every token in seed sees itself and is not walled in - [OK] near pillar: circle overlapping blocked, clear ok - [OK] near closed door blocks, open door passes - [OK] 64px corridor and doorway passable on centerline - [OK] legacy overlap can escape, not stay overlapped - [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict - [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it -Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tgeometry' + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length # test exit=1; expected tests failed: 1 [FAILED] rays nudged past a corner: area just beyond a wall end is visible a: exit=1 expected_failed=1 ok ## b: upper segment end exclusive # diff server/geometry.nim -> mutated copy: -# 36c36 +# 39c39 # < if t > Eps and u >= -Eps and u <= 1 + Eps: t else: Inf # --- # > if t > Eps and u >= -Eps and u < 1 - Eps: t else: Inf @@ -108,6 +198,22 @@ a: exit=1 expected_failed=1 ok [OK] long thin corridor [OK] wall endpoints behind the viewer: fan stays angularly ordered [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [FAILED] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [FAILED] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tgeometry' [OK] crossing blocked, parallel ok [OK] grazing an endpoint is blocked [OK] no leak through shared vertex @@ -115,18 +221,47 @@ a: exit=1 expected_failed=1 ok [OK] moving along a collinear wall is blocked [OK] doors [OK] zero-length move - [OK] square polygon - [OK] tiny polygon inside one cell - [OK] polygon spanning a cell with no vertex in it - [OK] big polygon includes fully covered interior cells - [OK] every token in seed sees itself and is not walled in - [OK] near pillar: circle overlapping blocked, clear ok - [OK] near closed door blocks, open door passes - [OK] 64px corridor and doorway passable on centerline - [OK] legacy overlap can escape, not stay overlapped - [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict - [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it -Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tgeometry' + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length # test exit=1; expected tests failed: 2 [FAILED] '<' apex: ray through the shared tip must not leak [FAILED] every segment endpoint is a polygon vertex (lower and upper end inclusive) @@ -134,7 +269,7 @@ Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tge b: exit=1 expected_failed=2 ok ## c: lower segment end exclusive # diff server/geometry.nim -> mutated copy: -# 36c36 +# 39c39 # < if t > Eps and u >= -Eps and u <= 1 + Eps: t else: Inf # --- # > if t > Eps and u > Eps and u <= 1 + Eps: t else: Inf @@ -156,6 +291,22 @@ b: exit=1 expected_failed=2 ok [OK] long thin corridor [OK] wall endpoints behind the viewer: fan stays angularly ordered [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [FAILED] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [FAILED] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tgeometry' [OK] crossing blocked, parallel ok [OK] grazing an endpoint is blocked [OK] no leak through shared vertex @@ -163,18 +314,47 @@ b: exit=1 expected_failed=2 ok [OK] moving along a collinear wall is blocked [OK] doors [OK] zero-length move - [OK] square polygon - [OK] tiny polygon inside one cell - [OK] polygon spanning a cell with no vertex in it - [OK] big polygon includes fully covered interior cells - [OK] every token in seed sees itself and is not walled in - [OK] near pillar: circle overlapping blocked, clear ok - [OK] near closed door blocks, open door passes - [OK] 64px corridor and doorway passable on centerline - [OK] legacy overlap can escape, not stay overlapped - [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict - [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it -Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tgeometry' + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length # test exit=1; expected tests failed: 2 [FAILED] '<' apex: ray through the shared tip must not leak [FAILED] every segment endpoint is a polygon vertex (lower and upper end inclusive) @@ -182,7 +362,7 @@ Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tge c: exit=1 expected_failed=2 ok ## d1: shared-vertex fixture without arm 1 # diff tests/tgeometry.nim -> mutated copy: -# 48c48 +# 42c42 # < let w = @[arm1, arm2] # SHARED-VERTEX # --- # > let w = @[arm2] @@ -204,6 +384,22 @@ c: exit=1 expected_failed=2 ok [OK] long thin corridor [OK] wall endpoints behind the viewer: fan stays angularly ordered [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tgeometry' [OK] crossing blocked, parallel ok [OK] grazing an endpoint is blocked [OK] no leak through shared vertex @@ -211,25 +407,54 @@ c: exit=1 expected_failed=2 ok [OK] moving along a collinear wall is blocked [OK] doors [OK] zero-length move - [OK] square polygon - [OK] tiny polygon inside one cell - [OK] polygon spanning a cell with no vertex in it - [OK] big polygon includes fully covered interior cells - [OK] every token in seed sees itself and is not walled in - [OK] near pillar: circle overlapping blocked, clear ok - [OK] near closed door blocks, open door passes - [OK] 64px corridor and doorway passable on centerline - [OK] legacy overlap can escape, not stay overlapped - [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict - [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it -Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tgeometry' + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length # test exit=1; expected tests failed: 1 [FAILED] shared vertex: both arms required (mutation d1/d2) d1: exit=1 expected_failed=1 ok ## d2: shared-vertex fixture without arm 2 # diff tests/tgeometry.nim -> mutated copy: -# 48c48 +# 42c42 # < let w = @[arm1, arm2] # SHARED-VERTEX # --- # > let w = @[arm1] @@ -251,6 +476,22 @@ d1: exit=1 expected_failed=1 ok [OK] long thin corridor [OK] wall endpoints behind the viewer: fan stays angularly ordered [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tgeometry' [OK] crossing blocked, parallel ok [OK] grazing an endpoint is blocked [OK] no leak through shared vertex @@ -258,20 +499,604 @@ d1: exit=1 expected_failed=1 ok [OK] moving along a collinear wall is blocked [OK] doors [OK] zero-length move - [OK] square polygon - [OK] tiny polygon inside one cell - [OK] polygon spanning a cell with no vertex in it - [OK] big polygon includes fully covered interior cells - [OK] every token in seed sees itself and is not walled in - [OK] near pillar: circle overlapping blocked, clear ok - [OK] near closed door blocks, open door passes - [OK] 64px corridor and doorway passable on centerline - [OK] legacy overlap can escape, not stay overlapped - [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict - [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it -Error: execution of an external program failed: '/tmp/tmp.RdwDCq2CQL/w/tests/tgeometry' + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length # test exit=1; expected tests failed: 1 [FAILED] shared vertex: both arms required (mutation d1/d2) d2: exit=1 expected_failed=1 ok +## e: cellsTouched without fill spans +# diff server/geometry.nim -> mutated copy: +# 138d137 +# < for k in countup(0, xs[row].len - 2, 2): mark(row, xs[row][k], xs[row][k + 1]) + [OK] open space is a circle + [OK] wall blocks + [OK] shared endpoint: no leak at the vertex + [OK] shared vertex: both arms required (mutation d1/d2) + [OK] '<' apex: ray through the shared tip must not leak + [OK] every segment endpoint is a polygon vertex (lower and upper end inclusive) + [OK] rays nudged past a corner: area just beyond a wall end is visible + [OK] shared endpoint: closed corner of box has no crack + [OK] collinear walls act as one + [OK] collinear walls with a gap let light through + [OK] T-junction: no leak and correct shadow + [OK] pillar mid-room casts a shadow, sides visible + [OK] closed door blocks, open door passes + [OK] token exactly at wall endpoint + [OK] token at endpoint of free-standing wall sees along it + [OK] long thin corridor + [OK] wall endpoints behind the viewer: fan stays angularly ordered + [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [FAILED] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [FAILED] visibilityPolygon and cellsTouched equal the prototype results + [FAILED] random visibility polygons: identical cell lists + [FAILED] random simple polygons (star-shaped, concave): identical cell lists + [FAILED] grid-aligned integer polygons (edges on cell lines): identical cell lists + [FAILED] prototype scene, all tokens, doors closed and opened + [FAILED] random wall fields, cell 32 and 25 + [FAILED] negative control: the oracle notices a missing and an invented cell +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tgeometry' + [OK] crossing blocked, parallel ok + [OK] grazing an endpoint is blocked + [OK] no leak through shared vertex + [OK] diagonal squeeze through corner vertex of L + [OK] moving along a collinear wall is blocked + [OK] doors + [OK] zero-length move + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length +# test exit=1; expected tests failed: 4 + [FAILED] random visibility polygons: identical cell lists + [FAILED] random simple polygons (star-shaped, concave): identical cell lists + [FAILED] prototype scene, all tokens, doors closed and opened + [FAILED] random wall fields, cell 32 and 25 + +e: exit=1 expected_failed=4 ok +## f: escape rule without the crossing check +# diff server/moverules.nim -> mutated copy: +# 90c90 +# < if pathCrosses(s, d, w.a, w.b) or segDist(d, w.a, w.b) < r: return false +# --- +# > if segDist(d, w.a, w.b) < r: return false + [OK] open space is a circle + [OK] wall blocks + [OK] shared endpoint: no leak at the vertex + [OK] shared vertex: both arms required (mutation d1/d2) + [OK] '<' apex: ray through the shared tip must not leak + [OK] every segment endpoint is a polygon vertex (lower and upper end inclusive) + [OK] rays nudged past a corner: area just beyond a wall end is visible + [OK] shared endpoint: closed corner of box has no crack + [OK] collinear walls act as one + [OK] collinear walls with a gap let light through + [OK] T-junction: no leak and correct shadow + [OK] pillar mid-room casts a shadow, sides visible + [OK] closed door blocks, open door passes + [OK] token exactly at wall endpoint + [OK] token at endpoint of free-standing wall sees along it + [OK] long thin corridor + [OK] wall endpoints behind the viewer: fan stays angularly ordered + [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell + [OK] crossing blocked, parallel ok + [OK] grazing an endpoint is blocked + [OK] no leak through shared vertex + [OK] diagonal squeeze through corner vertex of L + [OK] moving along a collinear wall is blocked + [OK] doors + [OK] zero-length move + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [FAILED] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [FAILED] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tmoverules' + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length +# test exit=1; expected tests failed: 1 + [FAILED] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + +f: exit=1 expected_failed=1 ok +## g: GM moves checked against walls +# diff server/moverules.nim -> mutated copy: +# 108c108 +# < if not inBounds(sc, d): return nack(s) +# --- +# > if not inBounds(sc, d) or not pathClear(sc.walls, s, d, sc.tokenRadius): return nack(s) + [OK] open space is a circle + [OK] wall blocks + [OK] shared endpoint: no leak at the vertex + [OK] shared vertex: both arms required (mutation d1/d2) + [OK] '<' apex: ray through the shared tip must not leak + [OK] every segment endpoint is a polygon vertex (lower and upper end inclusive) + [OK] rays nudged past a corner: area just beyond a wall end is visible + [OK] shared endpoint: closed corner of box has no crack + [OK] collinear walls act as one + [OK] collinear walls with a gap let light through + [OK] T-junction: no leak and correct shadow + [OK] pillar mid-room casts a shadow, sides visible + [OK] closed door blocks, open door passes + [OK] token exactly at wall endpoint + [OK] token at endpoint of free-standing wall sees along it + [OK] long thin corridor + [OK] wall endpoints behind the viewer: fan stays angularly ordered + [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell + [OK] crossing blocked, parallel ok + [OK] grazing an endpoint is blocked + [OK] no leak through shared vertex + [OK] diagonal squeeze through corner vertex of L + [OK] moving along a collinear wall is blocked + [OK] doors + [OK] zero-length move + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [FAILED] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [FAILED] GM placement and GM move onto a wall never set blocked, and the token can escape + [FAILED] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tmoverules' + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length +# test exit=1; expected tests failed: 1 + [FAILED] GM: ignores walls, step cap and blocked; bounds still apply + +g: exit=1 expected_failed=1 ok +## h: capsule = centre path + destination circle (prototype) +# diff server/moverules.nim -> mutated copy: +# 91c91 +# < elif segsCross(s, d, w.a, w.b) or segSegDist(s, d, w.a, w.b) < r: return false +# --- +# > elif segsCross(s, d, w.a, w.b) or segDist(d, w.a, w.b) < r: return false + [OK] open space is a circle + [OK] wall blocks + [OK] shared endpoint: no leak at the vertex + [OK] shared vertex: both arms required (mutation d1/d2) + [OK] '<' apex: ray through the shared tip must not leak + [OK] every segment endpoint is a polygon vertex (lower and upper end inclusive) + [OK] rays nudged past a corner: area just beyond a wall end is visible + [OK] shared endpoint: closed corner of box has no crack + [OK] collinear walls act as one + [OK] collinear walls with a gap let light through + [OK] T-junction: no leak and correct shadow + [OK] pillar mid-room casts a shadow, sides visible + [OK] closed door blocks, open door passes + [OK] token exactly at wall endpoint + [OK] token at endpoint of free-standing wall sees along it + [OK] long thin corridor + [OK] wall endpoints behind the viewer: fan stays angularly ordered + [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell + [OK] crossing blocked, parallel ok + [OK] grazing an endpoint is blocked + [OK] no leak through shared vertex + [OK] diagonal squeeze through corner vertex of L + [OK] moving along a collinear wall is blocked + [OK] doors + [OK] zero-length move + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [FAILED] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [FAILED] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tmoverules' + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length +# test exit=1; expected tests failed: 2 + [FAILED] corner clipping: path passes the wall end closer than r though both ends are clear + [FAILED] leg of the path inside r of a non-start wall blocks even if start and end are clear + +h: exit=1 expected_failed=2 ok +## i: no step cap +# diff server/moverules.nim -> mutated copy: +# 113d112 +# < if hypot(dd.x, dd.y) > stepCap(sc, sc.tokens[ti]): return nack(s) + [OK] open space is a circle + [OK] wall blocks + [OK] shared endpoint: no leak at the vertex + [OK] shared vertex: both arms required (mutation d1/d2) + [OK] '<' apex: ray through the shared tip must not leak + [OK] every segment endpoint is a polygon vertex (lower and upper end inclusive) + [OK] rays nudged past a corner: area just beyond a wall end is visible + [OK] shared endpoint: closed corner of box has no crack + [OK] collinear walls act as one + [OK] collinear walls with a gap let light through + [OK] T-junction: no leak and correct shadow + [OK] pillar mid-room casts a shadow, sides visible + [OK] closed door blocks, open door passes + [OK] token exactly at wall endpoint + [OK] token at endpoint of free-standing wall sees along it + [OK] long thin corridor + [OK] wall endpoints behind the viewer: fan stays angularly ordered + [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell + [OK] crossing blocked, parallel ok + [OK] grazing an endpoint is blocked + [OK] no leak through shared vertex + [OK] diagonal squeeze through corner vertex of L + [OK] moving along a collinear wall is blocked + [OK] doors + [OK] zero-length move + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [FAILED] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [OK] blocked token: player moves refused, GM move allowed and does not clear + [OK] cleared by removing the wall; unrelated removals keep it + [OK] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [OK] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tmoverules' + [FAILED] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tprobing' + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length +# test exit=1; expected tests failed: 2 + [FAILED] step cap = scene default without vision, token vision radius with it + [FAILED] P1: probes longer than the cap get one fixed nack regardless of the scene + +i: exit=1 expected_failed=2 ok +## j: blocked trigger needs the centre on the wall +# diff server/moverules.nim -> mutated copy: +# 120c120 +# < proc overlaps(sc: Scene, t: Token, w: Wall): bool = segDist(t.pos, w.a, w.b) < sc.tokenRadius +# --- +# > proc overlaps(sc: Scene, t: Token, w: Wall): bool = segDist(t.pos, w.a, w.b) < 1e-9 + [OK] open space is a circle + [OK] wall blocks + [OK] shared endpoint: no leak at the vertex + [OK] shared vertex: both arms required (mutation d1/d2) + [OK] '<' apex: ray through the shared tip must not leak + [OK] every segment endpoint is a polygon vertex (lower and upper end inclusive) + [OK] rays nudged past a corner: area just beyond a wall end is visible + [OK] shared endpoint: closed corner of box has no crack + [OK] collinear walls act as one + [OK] collinear walls with a gap let light through + [OK] T-junction: no leak and correct shadow + [OK] pillar mid-room casts a shadow, sides visible + [OK] closed door blocks, open door passes + [OK] token exactly at wall endpoint + [OK] token at endpoint of free-standing wall sees along it + [OK] long thin corridor + [OK] wall endpoints behind the viewer: fan stays angularly ordered + [OK] radius clips + [OK] square polygon + [OK] tiny polygon inside one cell + [OK] polygon spanning a cell with no vertex in it + [OK] big polygon includes fully covered interior cells + [OK] degenerate input: fewer than 3 vertices + [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side + [OK] concave polygon: a notch cell is not filled + [OK] every token in seed sees itself and is not walled in + [OK] visibilityPolygon and cellsTouched equal the prototype results + [OK] random visibility polygons: identical cell lists + [OK] random simple polygons (star-shaped, concave): identical cell lists + [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists + [OK] prototype scene, all tokens, doors closed and opened + [OK] random wall fields, cell 32 and 25 + [OK] negative control: the oracle notices a missing and an invented cell + [OK] crossing blocked, parallel ok + [OK] grazing an endpoint is blocked + [OK] no leak through shared vertex + [OK] diagonal squeeze through corner vertex of L + [OK] moving along a collinear wall is blocked + [OK] doors + [OK] zero-length move + [OK] near pillar: circle overlapping blocked, clear ok (ported) + [OK] closed door blocks near, open door passes (ported) + [OK] 64px corridor and doorway passable on the centreline (ported) + [OK] corner clipping: path passes the wall end closer than r though both ends are clear + [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear) + [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked + [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear + [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot + [OK] exactly on a wall: still refused when it would stay overlapped or run along/through + [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype + [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped + [OK] escaping one wall does not excuse another + [OK] escape from a closed door; an open door never needed an escape + [OK] overlapping at a wall end: leave past the end without crossing + [OK] owner check: not yours is mkError, no position + [OK] GM-controlled token (no owner): players get mkError + [OK] step cap = scene default without vision, token vision radius with it + [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical + [OK] an accepted move applies and echoes the destination + [OK] player move honours walls (capsule) via moveToken + [OK] GM: ignores walls, step cap and blocked; bounds still apply + [FAILED] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [FAILED] GM-controlled tokens get the flag too; wall bbox does not matter, distance does + [OK] open door added or opened never sets; closing a door on a token does + [FAILED] blocked token: player moves refused, GM move allowed and does not clear + [FAILED] cleared by removing the wall; unrelated removals keep it + [FAILED] cleared by opening the door; a second open is a no-op + [OK] cleared by the GM; not re-set by itself + [FAILED] wall update = remove then add + [OK] GM placement and GM move onto a wall never set blocked, and the token can escape + [FAILED] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps + [OK] no escape hatch: a player cannot walk through any wall of a boxed room +Error: execution of an external program failed: '/tmp/tmp.jVgrCYYy0I/w/tests/tmoverules' + [OK] P1: probes longer than the cap get one fixed nack regardless of the scene + [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes + [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) + [OK] P4: probing cannot unflag or move a blocked token + [OK] doors beyond the bound: opening or closing them changes no reply + [OK] exactly n walls, deterministic per seed, seeds differ + [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) + [OK] walls are non-degenerate and axis-ish segments of room-edge length +# test exit=1; expected tests failed: 2 + [FAILED] wall added within r of the circle (centre not on it) sets blocked; exactly r does not + [FAILED] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it + +j: exit=1 expected_failed=2 ok exit=0 diff --git a/server/geometry.nim b/server/geometry.nim index b57ba56..9e9b2b3 100644 --- a/server/geometry.nim +++ b/server/geometry.nim @@ -1,12 +1,15 @@ -## 2D vision geometry. Pure, stdlib only. Ported from prototype-server-vision/src/geometry.nim. -## Known limitations (see prototype-server-vision/HANDOFF.md, docs/DESIGN.md 5.4 / 12): -## - token exactly on a wall cannot move off it (inclusive segsCross); pinned by a KNOWN LIMITATION test. -## - closing a door on a token: policy open, DESIGN Q14 (5.4 vs H2 conflict); behaviour pinned in tests. +## 2D vision geometry. Pure, stdlib only. Ported from prototype-server-vision/src/geometry.nim (M1), revised in M2. +## Move rules (swept circle, token-on-wall escape, step cap, `blocked`) live in server/moverules.nim, not here. +## Fixed in M2 (DESIGN 5.5): token exactly on a wall can move off it (moverules escape rule); the move check is the +## swept circle, not centre path + destination only; `moveBlocked` is gone from this module; cellsTouched is a scanline +## (prototype per-cell version kept test-only in tests/refold.nim, differential-tested). +## Known limitations (DESIGN 5.4 / 12): ## - boundary epsilon ambiguity: RayEps 1e-4 rad, inclusive tests; token on a vision boundary is ambiguous -## (leak checker uses a 0.5 px neighbourhood). -## - move collision = centre path a->b + destination circle only, NOT the swept circle (corner clipping possible). -## - vision is O(rays x walls) per token, bbox cull only. -## - cellsTouched costs ~12x a polygon (results/bench.log in the prototype). +## (leak checker and explored oracle use a 0.5 px neighbourhood). +## - cellsTouched keeps a prototype quirk on purpose: a cell touching the polygon only along its bbox minimum x / y line +## is not marked (every other touch is). The regression corpus has such polygons (walls on x = 256). +## - vision is O(rays x walls in bbox): bbox cull, no spatial grid (H3: not built, 5k bench met target; results/bench.log). +## A dense 5k layout (4096 px world, ~200 walls per vision box) costs ~1.3 ms per polygon. ## - circle range limit is an inscribed 64-gon: error <= ~0.12% of R. import std/[math, algorithm] diff --git a/tools/mutation.sh b/tools/mutation.sh index d099066..9f5d215 100755 --- a/tools/mutation.sh +++ b/tools/mutation.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash # usage: devbox run mutation (or tools/mutation.sh inside devbox shell) -# Mutation check on a TEMP COPY of server/ + tests/ (the tree is never touched). One mutation per run. -# Control must pass; every mutation must fail >=1 expected test; a sed that changes nothing is an error. -# a: no +-RayEps rays | b: upper segment end exclusive | c: lower segment end exclusive (rayHit only; -# moveBlocked's segsCross is a separate, intentionally inclusive test) | d1/d2: drop arm 1/2 of the shared-vertex fixture. +# Mutation check on a TEMP COPY of server/ + tests/ + tools/ (the tree is never touched). One mutation per run, ALL +# tests/t*.nim are run. Control must pass; every mutation must fail >=1 expected test; a sed that changes nothing is an error. +# a: no +-RayEps rays | b: upper segment end exclusive | c: lower segment end exclusive (rayHit only) +# d1/d2: drop arm 1/2 of the shared-vertex fixture +# e: cellsTouched without the fill spans | f: escape rule without the crossing check | g: GM moves checked against walls +# h: capsule reduced to centre path + destination circle (prototype H10) | i: no step cap | j: blocked trigger needs centre-on-wall # Log: results/mutation.log cd "$(dirname "$0")/.." || exit 1 mkdir -p results @@ -11,11 +13,17 @@ LOG=$PWD/results/mutation.log T=$(mktemp -d); trap 'rm -rf "$T"' EXIT NEW="shared endpoint: no leak at the vertex|'<' apex|every segment endpoint|rays nudged past a corner" D="shared vertex: both arms required" +E="random visibility polygons|random simple polygons|corpus|prototype scene, all tokens|random wall fields|concave polygon|square polygon" +F="exactly on a wall: can step off|overlapping 10 px off|escape from a closed door|GM placement and GM move onto a wall" +G="GM: ignores walls, step cap and blocked" +H="corner clipping|leg of the path|diagonal squeeze past" +I="step cap|over-cap, blocked-by-wall|P1:|P2:" +J="wall added within r of the circle|Q14: a door closed" rc=0 : > "$LOG" -run() { # $1 id $2 title $3 file (server/geometry.nim | tests/tgeometry.nim) $4 sed script ("" = control) $5 expected-failure regex +run() { # $1 id $2 title $3 file to mutate $4 sed script ("" = control) $5 expected-failure regex local id=$1 title=$2 file=$3 sedscr=$4 expect=$5 w=$T/w - rm -rf "$w"; mkdir -p "$w"; cp -r server tests nim.cfg "$w"/ + rm -rf "$w"; mkdir -p "$w"; cp -r server tests tools nim.cfg "$w"/ find "$w/tests" -maxdepth 1 -type f ! -name '*.nim' -delete { echo "## $id: $title" if [ -n "$sedscr" ]; then @@ -24,8 +32,12 @@ run() { # $1 id $2 title $3 file (server/geometry.nim | tests/tgeometry.nim) echo "# diff $file -> mutated copy:"; diff "$file" "$w/$file" | sed 's/^/# /' fi } >> "$LOG" - local out="$T/out-$id.txt" r F - (cd "$w" && nim c -r --hints:off --nimcache:"$T/nc" tests/tgeometry.nim) > "$out" 2>&1; r=$? + local out="$T/out-$id.txt" r=0 rr tf F + : > "$out" + for tf in tests/t*.nim; do + (cd "$w" && nim c -r --hints:off --nimcache:"$T/nc-$(basename "$tf" .nim)" "$tf") >> "$out" 2>&1; rr=$? + [ $rr -eq 0 ] || r=$rr + done grep -E '\[(OK|FAILED)\]|Success|Failure|Error' "$out" | sed 's/^ *\.* */ /' >> "$LOG" F=$(grep '\[FAILED\]' "$out" | grep -E "$expect") { echo "# test exit=$r; expected tests failed: $(printf '%s' "$F" | grep -c .)"; [ -n "$F" ] && echo "$F"; echo; } >> "$LOG" @@ -40,5 +52,11 @@ run b "upper segment end exclusive" server/geometry.nim 's/u <= 1 + Eps/u < 1 - run c "lower segment end exclusive" server/geometry.nim 's/u >= -Eps/u > Eps/' "$NEW" run d1 "shared-vertex fixture without arm 1" tests/tgeometry.nim 's/@\[arm1, arm2\] *# SHARED-VERTEX/@[arm2]/' "$D" run d2 "shared-vertex fixture without arm 2" tests/tgeometry.nim 's/@\[arm1, arm2\] *# SHARED-VERTEX/@[arm1]/' "$D" +run e "cellsTouched without fill spans" server/geometry.nim '/for k in countup(0, xs\[row\].len - 2, 2)/d' "$E" +run f "escape rule without the crossing check" server/moverules.nim 's/if pathCrosses(s, d, w.a, w.b) or segDist(d, w.a, w.b) < r: return false/if segDist(d, w.a, w.b) < r: return false/' "$F" +run g "GM moves checked against walls" server/moverules.nim 's/^ if not inBounds(sc, d): return nack(s)$/ if not inBounds(sc, d) or not pathClear(sc.walls, s, d, sc.tokenRadius): return nack(s)/' "$G" +run h "capsule = centre path + destination circle (prototype)" server/moverules.nim 's/elif segsCross(s, d, w.a, w.b) or segSegDist(s, d, w.a, w.b) < r: return false/elif segsCross(s, d, w.a, w.b) or segDist(d, w.a, w.b) < r: return false/' "$H" +run i "no step cap" server/moverules.nim '/if hypot(dd.x, dd.y) > stepCap(sc, sc.tokens\[ti\]): return nack(s)/d' "$I" +run j "blocked trigger needs the centre on the wall" server/moverules.nim 's/segDist(t.pos, w.a, w.b) < sc.tokenRadius/segDist(t.pos, w.a, w.b) < 1e-9/' "$J" echo "exit=$rc" | tee -a "$LOG" exit $rc