feat(offline): DAWG cursor + move generator in TS (parity-pinned) #188

Merged
developer merged 1 commits from feature/offline-movegen into development 2026-07-05 23:42:58 +00:00
Owner

Phase A (1/2) of PWA offline mode — the client-side move generator (the local vs_ai "robot brain"), not yet wired into the app (Phase B).

  • dawg.ts: step-by-step cursor (root/final/next/arcs), a faithful port of dafsa traverse.go over the reader's bitstream.
  • generate.ts: Appel–Jacobson generator + cross-sets + counts-rack + board transpose + moveKey ranking, reusing the cursor and validate.ts evaluate/connected. A cross-set LetterSet is a Uint8Array, so the 33-letter Russian alphabet (index 32) is exact under JS bit ops.
  • validate.ts: export connected for the generator's connectivity filter.
  • backend/cmd/movegen: dev tool building small sample dictionaries + emitting golden move-generation fixtures from the real Go solver (EN + RU).
  • tests: dawg.cursor.test.ts (enumeration bijection) + generate.parity.test.ts (7/7 vs the Go solver: empty board, mid-game, blank, single-word rule, Russian index-32).

Pure additive library code; no runtime behavior change. Local verification green: backend build/vet/gofmt/test; UI check + test:unit (430 passed) + build.

Phase A (1/2) of PWA offline mode — the client-side move generator (the local vs_ai "robot brain"), not yet wired into the app (Phase B). - `dawg.ts`: step-by-step cursor (root/final/next/arcs), a faithful port of dafsa `traverse.go` over the reader's bitstream. - `generate.ts`: Appel–Jacobson generator + cross-sets + counts-rack + board transpose + moveKey ranking, reusing the cursor and `validate.ts` `evaluate`/`connected`. A cross-set LetterSet is a Uint8Array, so the 33-letter Russian alphabet (index 32) is exact under JS bit ops. - `validate.ts`: export `connected` for the generator's connectivity filter. - `backend/cmd/movegen`: dev tool building small sample dictionaries + emitting golden move-generation fixtures from the real Go solver (EN + RU). - tests: `dawg.cursor.test.ts` (enumeration bijection) + `generate.parity.test.ts` (7/7 vs the Go solver: empty board, mid-game, blank, single-word rule, Russian index-32). Pure additive library code; no runtime behavior change. Local verification green: backend build/vet/gofmt/test; UI check + test:unit (430 passed) + build.
developer added 1 commit 2026-07-05 23:37:24 +00:00
feat(offline): port DAWG cursor + move generator to TS (parity-pinned)
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Successful in 1m8s
CI / conformance (pull_request) Successful in 9s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m38s
c334a9d7b7
First engine-first step of PWA offline mode (Phase A): the client-side move
generator — the "robot brain" a local vs_ai game will run on-device — with no
runtime wiring yet (Phase B).

- dawg.ts: add the step-by-step cursor (root/final/next/arcs), a faithful port
  of dafsa traverse.go over the reader's existing bitstream.
- generate.ts: the Appel-Jacobson generator (leftPart/extendRight + cross-sets +
  counts-rack + board transpose + moveKey ranking), reusing the cursor and
  validate.ts evaluate/connected. A cross-set LetterSet is a Uint8Array, so the
  33-letter Russian alphabet (index 32) is exact under JS bit ops.
- validate.ts: export connected for the generator's connectivity filter.
- backend/cmd/movegen: dev tool building small sample dictionaries and emitting
  golden move-generation fixtures from the real Go solver (EN + RU).
- tests: dawg.cursor.test.ts (enumeration bijection vs indexOf) and
  generate.parity.test.ts (7/7 vs the Go solver: empty board, mid-game, blank,
  single-word rule, Russian index-32 cross-set). The committed EN sample also
  unblocks the existing skipped dawg.parity.test.ts once wired with DICT_* in CI.

Pure additive library code; no runtime behavior change.
owner approved these changes 2026-07-05 23:42:25 +00:00
developer merged commit cedc9ffae1 into development 2026-07-05 23:42:58 +00:00
developer deleted branch feature/offline-movegen 2026-07-05 23:42:58 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: developer/scrabble-game#188