fix: limit trainer jumps and exit positions

This commit is contained in:
nyan404 committed 2026-11-22 16:33:30 +03:00
1 parent 27b3e0aaae
commit cc6bcb23c8
12 files changed
+174 -79

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ Authorization: the owner requested implementation of root `LU_TRAINER_PROJECT.md
contract: standalone `/trainer` and `/trainer/`, shared HTML/CSS/ES-module assets served by Python and Nginx. No new runtime dependency or storage. Gateway serves the page with `try_files`; assets use the existing static serving.
convention: native buttons/radios/dialogs, CSS tokens, Verdana/Georgia, Russian copy, DOM-independent ES-module engine, no upstream code or asset copying.
state: engine owns 60 cells, per-attempt start/exit identities, hazards, opened set, marks set, last successful position, ready/playing/won/lost status and action log. A public snapshot omits hidden hazards/values. UI owns selection, action mode, map visibility and mark projection.
invariant: 6x10, entrance x1 y1 (top-left, index 0), exit selected per attempt from any of the other 59 cells; transition cells do not count toward victory and cannot be opened/marked. The first 5/3 top-row non-transition cells are safe and initially available; any other cell requires an opened neighbor. Eight-neighbor counts; safe path connects entrance, base and exit. Preserve documented hazard formula and 0/10/20/30% hint probabilities. Win by all non-transition safe cells or all and only hazards marked; loss ends actions. Repeat safe visits produce feedback and may hint. The character tracks the last successful non-transition visit.
invariant: 6x10, entrance x1 y1 (top-left, index 0), exit selected per attempt from x10 y2–y6 or y6 x6–x10; transition cells do not count toward victory and cannot be opened/marked. The first 5/3 top-row cells to the right of the entrance are safe, but there is no special jump permission for them. A jump must target one of the current position’s eight neighbors, even for previously opened cells. Eight-neighbor counts; safe path connects entrance, base and exit. Preserve documented hazard formula and 0/10/20/30% hint probabilities. Win by all non-transition safe cells or all and only hazards marked; loss ends actions. Repeat safe visits produce feedback and may hint. The character tracks the last successful non-transition visit.
invariant: one click produces one action; map selection never jumps; marks are separate from facts. Projection only changes scene rendering. Confirm clear marks and restart, including settings restart. Ending/restarting cancels hint and timer callbacks. At completion reveal the whole board, including incorrect notes.
contract: desktop direct cell action; compact/coarse-pointer overview selects only and uses >=44px confirm controls. Arrow/Home/End navigation and Enter/Space work. Screen-reader live status excludes timer ticks. Map/history mobile panels restore focus. Native dialogs support Escape/cancel. Failed images leave cells and character fallback usable.
test: deterministic Node tests for generator safety/reachability/counts, all settings combinations, adjacency, transition exclusion, notes, win/loss, hints and public snapshots. HTTP test for aliases and asset MIME/containment. Browser checks at 1920x1080,1366x768,768x1024,390x844; two grids, logs, marks, confirmations, focus, keyboard/touch, reduced motion, 200% layout and image failures. Review real screenshots. Nginx syntax/serving check in isolated container if Docker available; no deployment.
@@ -13,4 +13,4 @@ deferred: verification of real CatWar rules, multiple saved maps, audio, server
Review: spec-compliance/consistency review closed the hint and terminal-action gaps. Hints intentionally return a temporary hazard ID in action results only (not hidden snapshot values), last 2000 ms and retain their coordinate in the readable message log. Only unmarked neighboring hazards are candidates. At completion marking/clearing are disabled; selection remains available for inspection. Defaults: height 1, LU 5, growth 12, season 0; growth accepts 12/15/18/22/25 and season -3/0/5.
Owner correction 2026-11-17: entrance fixed x1 y1, exit variable. Uniform random placement is an implementation choice, not a verified game distribution. Coordinates are one-based X right/Y down. Tests cover every possible exit position, safe-route connectivity and matching transition labels on both grids after regeneration.
Owner corrections: entrance fixed x1 y1 and exit variable (2026-11-17); limit exits to the specified edges and jumps to immediate neighbors (2026-11-22). Uniform random placement among permitted sites is an implementation choice, not a verified game distribution. Coordinates are one-based X right/Y down. Tests cover every allowed exit position, safe-route connectivity and matching transition labels on both grids after regeneration.