No description
Phase A.3 of the rule-variants epic — preset-controlled turn flip gating. Enables double-move (white plays 2, then black plays 2) and monster (scope-aware: white plays 2, black plays 1) without engine changes at the preset layer. - Adds HalfMovesThisTurn: number to ChessAttrMap. Seeded to 0 in applyLayout. Distinct from HalfmoveClock (FIDE 50-move rule) — this counter is within-turn and resets on flip. - Adds TurnAdvanceContext + shouldAdvanceTurn hook to PresetDef. Hook receives post-increment count via ctx.halfMovesThisTurn so 'play N half-moves before flipping' reads as the predicate 'halfMovesThisTurn < N -> false'. - engine.applyMove: increments HalfMovesThisTurn BEFORE polling shouldAdvanceTurn; first false wins; on flip resets to 0 and increments FullmoveNumber after black; onTurnStart is gated on shouldAdvance (vetoed flips don't fire turn-start hooks, so mid-turn stamina regen bugs are prevented by construction). - starting-position.test.ts updated with HalfMovesThisTurn=0 seed assertion. - New turn-advance.test.ts (7 tests): seeding, baseline unchanged, never-flip veto, flip-after-two (double-move surface), onTurnStart gating across vetoed + non-vetoed flips, FullmoveNumber increments only on actual flips after black. Tests: 1441 passing (was 1434, +7 new). Blocks: unblocks B.2 (double-move), B.3 (monster-rules), B.4 (first-promotion-wins). |
||
|---|---|---|
| .github/workflows | ||
| .sisyphus | ||
| docs | ||
| packages | ||
| scripts | ||
| .gitignore | ||
| eslint.config.js | ||
| lefthook.yml | ||
| LICENSE | ||
| package.json | ||
| playwright.config.ts | ||
| README.md | ||
| tsconfig.base.json | ||
| tsconfig.json | ||
| vitest.workspace.ts | ||
@paratype
A Doorenbos-style Rete II rules engine for TypeScript games, with an authoritative WebSocket chess demo.
Packages
packages/rete— Rete II engine corepackages/chess— Browser chess demo (React + Vite)packages/server— Authoritative Bun WebSocket server
Docs
- SPEC.md — Engine specification
- PHASES.md — Development phases & perf budgets
- RULES.md — Chess rule presets
- PROTOCOL.md — WebSocket message protocol
Getting Started
bun install && bun run check