+17
-7
@@ -19,9 +19,10 @@
|
||||
// the subject, west of it, sees across to the sentry E2 (#58)
|
||||
// - markers a marked opening window in the room (seen: the positive control), the same
|
||||
// window's switch cleared and restored (the retraction/re-earn path, #60), a
|
||||
// marked solid wall in the room (switch on, no marker: MARKER_EXTRA control)
|
||||
// and a marked window far outside every scripted position (never seen:
|
||||
// MARKER_EARLY control)
|
||||
// marked solid wall in the room (switch on, no marker: MARKER_EXTRA control),
|
||||
// a marked window far outside every scripted position (never seen: MARKER_EARLY
|
||||
// control) and a marked window behind the far wall (occluded: "a wall behind a
|
||||
// sight blocker yields none", TESTING 5.8)
|
||||
// - the rest a token hidden behind the closed door and revealed by opening it, tokens
|
||||
// created/removed while watched, a `gm_only` token inside LOS, a controller
|
||||
// handed over and back, another player walking in and out, a wall added and
|
||||
@@ -33,10 +34,13 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { createPlayer, namePlayer, openWs, sleep, projectRoot } from './lib.mjs'
|
||||
import { createPlayer, namePlayer, openWs, sleep, projectRoot, isWindow, anchorOf } from './lib.mjs'
|
||||
import { signIn } from './withserver.mjs'
|
||||
|
||||
const QUIET_MS = 60
|
||||
// The far wall's x (the WORLD's `far-*` segments): east of it is behind a sight blocker at every
|
||||
// scripted subject position. Scenario coverage reads this to prove the occluded marker control.
|
||||
const FAR_WALL_X = 1400
|
||||
const nimblePkgs = () => path.join(process.env.NIMBLE_DIR ?? path.join(projectRoot, '.devbox', 'nimble'), 'pkgs2')
|
||||
|
||||
// The checker is compiled once per process (it imports server/geometry.nim through --path in nim.cfg).
|
||||
@@ -96,11 +100,13 @@ const WORLD = [
|
||||
// Marked window far outside every scripted position: never seen, so never a marker (the
|
||||
// MARKER_EARLY negative control, #60).
|
||||
{ role: 'marked-unseen', preset: 'window', a: [3500, 2000], b: [3500, 2200] },
|
||||
// A marked window behind the far wall (east of FAR_WALL_X): truly occluded, so it must yield no
|
||||
// marker at all — TESTING 5.8 "a wall behind a sight blocker yields none". Unlike `marked-unseen`
|
||||
// this is not merely out of range; a sight-blocking wall stands between it and every subject
|
||||
// position, so even walking the whole room never earns it.
|
||||
{ role: 'marked-occluded', preset: 'window', a: [1500, 700], b: [1500, 800] },
|
||||
]
|
||||
|
||||
const isWindow = w => w.blocks_sight === false && w.blocks_movement === true
|
||||
const anchorOf = w => [Math.round((w.a[0] + w.b[0]) / 2), Math.round((w.a[1] + w.b[1]) / 2)]
|
||||
|
||||
// The scenario's own coverage, read off the GM's wall frames and the subject's marker frames. The
|
||||
// acceptance contract of #61 is a world holding each of these elements, so the test proves the
|
||||
// scenario really has them instead of trusting the list above: a rewrite that silently drops the
|
||||
@@ -123,6 +129,7 @@ export function scenarioCoverage(gmMsgs, subjMsgs) {
|
||||
}
|
||||
const marked = all.filter(w => w.player_marker)
|
||||
const windows = marked.filter(isWindow)
|
||||
const occluded = windows.filter(w => anchorOf(w)[0] > FAR_WALL_X)
|
||||
return {
|
||||
walls: all.length,
|
||||
oneWay: all.filter(w => w.sight_dir !== 'both').length,
|
||||
@@ -133,6 +140,9 @@ export function scenarioCoverage(gmMsgs, subjMsgs) {
|
||||
// "both sides of the sight test": a marked window the subject earned and one it did not.
|
||||
markedWindowsSeen: windows.filter(w => received.has(anchorOf(w).join(','))).length,
|
||||
markedWindowsUnseen: windows.filter(w => !received.has(anchorOf(w).join(','))).length,
|
||||
// A marked window behind the far wall: occluded, never earned, however far the subject walks.
|
||||
markedWindowsOccluded: occluded.length,
|
||||
markedWindowsOccludedSeen: occluded.filter(w => received.has(anchorOf(w).join(','))).length,
|
||||
markers: received.size,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user