Implement Scrabble move generator (DAWG) #1

Merged
owner merged 6 commits from feat/scrabble-solver into master 2026-06-01 22:02:56 +00:00
Owner

A Go Scrabble solver: generates every legal play ranked by score, and scores/validates plays, using the Appel-Jacobson DAWG over github.com/iliadenisov/dafsa v1.1.0.

Highlights

  • DAWG move generator (across/down/both) + full tournament scoring with a per-tile breakdown.
  • Public Solver: GenerateMoves (ranked), ScorePlay, ValidatePlay.
  • Rulesets: English Scrabble, Russian Scrabble, Эрудит (parameterizable).
  • cmd/builddict, cmd/stress (self-play benchmark), selfplay engine; brute-force test oracle.
  • A GADDAG was implemented, benchmarked and removed (the DAWG was smaller and faster for a scoring solver) — see RESULTS.md.

Verification

go test ./... green, go vet / gofmt clean. cmd/builddict builds a ~732 KB DAWG from SOWPODS; cmd/stress ~180k moves/s.

Docs: ALGORITHM.md (algorithm source of truth), PLAN.md, RESULTS.md, README.md. The dictionaries submodule references kamilmielnik/scrabble-dictionaries on GitHub.

A Go Scrabble solver: generates every legal play ranked by score, and scores/validates plays, using the Appel-Jacobson DAWG over github.com/iliadenisov/dafsa v1.1.0. ## Highlights - DAWG move generator (across/down/both) + full tournament scoring with a per-tile breakdown. - Public `Solver`: `GenerateMoves` (ranked), `ScorePlay`, `ValidatePlay`. - Rulesets: English Scrabble, Russian Scrabble, Эрудит (parameterizable). - `cmd/builddict`, `cmd/stress` (self-play benchmark), `selfplay` engine; brute-force test oracle. - A GADDAG was implemented, benchmarked and removed (the DAWG was smaller and faster for a scoring solver) — see `RESULTS.md`. ## Verification `go test ./...` green, `go vet` / `gofmt` clean. `cmd/builddict` builds a ~732 KB DAWG from SOWPODS; `cmd/stress` ~180k moves/s. Docs: `ALGORITHM.md` (algorithm source of truth), `PLAN.md`, `RESULTS.md`, `README.md`. The `dictionaries` submodule references kamilmielnik/scrabble-dictionaries on GitHub.
developer added 1 commit 2026-06-01 14:08:01 +00:00
A Go library that returns every legal play ranked by score and scores or
validates plays, using the Appel-Jacobson DAWG algorithm over
github.com/iliadenisov/dafsa v1.1.0.

- DAWG move generation (across / down / both), full tournament scoring with a
  per-tile breakdown; public Solver: GenerateMoves (ranked), ScorePlay,
  ValidatePlay.
- Rulesets: English Scrabble, Russian Scrabble, Эрудит (parameterizable Ruleset).
- cmd/builddict (build the DAWG from the dictionaries submodule), cmd/stress
  (self-play benchmark), selfplay engine; brute-force test oracle.
- A GADDAG was implemented, benchmarked and removed (the DAWG was smaller and
  faster for a scoring solver); see RESULTS.md and ALGORITHM.md.
owner approved these changes 2026-06-01 14:08:29 +00:00
Dismissed
developer added 1 commit 2026-06-01 21:27:42 +00:00
Build a committed Russian common-noun word list (dictprep/russian/scrabble.txt)
from the RAN orthographic dictionary, for the Эрудит ruleset.

- Stage 1 (Go, dictprep/ruwords): orfo_dict_2025.txt -> all.txt; extracts
  headwords, reconstructs "ед." singulars (suppressing plurals), pairs "и" variants.
- Stage 2 (Python brain, dictprep/ru_stage2.py): OpenCorpora (mawo-pymorphy3) +
  libmorph + orthographic notes select common nouns (nom. sing.); --trace explains
  a word's fate, --dump writes the in-memory buckets.
- libmorph C++ bridge (libmorph_check.cpp); manual_confirm.txt is merged in.
- orfo_dict_2025.txt is the committed pdftotext source of truth.
- See dictprep/README.md for methodology and reproducibility.
developer added 1 commit 2026-06-01 21:35:40 +00:00
- cmd/builddict: add -alphabet latin|russian (russian = alphabet.Embedded(LangRu)).
- dictprep/fold_yo.py: fold Ё→Е and de-dup, the Эрудит dictionary prep.
- Makefile: `make dawg` rebuilds dawg/{en_sowpods,ru_scrabble,ru_erudit}.dawg.
- dawg/: committed DAWGs verified by enumeration — 267752 / 83385 / 83343 words.
developer added 1 commit 2026-06-01 21:37:57 +00:00
developer added 1 commit 2026-06-01 21:56:40 +00:00
Replay 17 real tournament games (cross-tables.com, including the 700+ club) and
check, move for move, that:
  - ScorePlay reproduces the protocol score and running total exactly;
  - the move generator produces every dictionary-valid played move with that score.

The GCG parser handles coordinates (across/down), blanks (lowercase), played-through
tiles ("."), passes/exchanges, challenge bonuses, end-game rack adjustments and phony
withdrawals ("--", un-applied). Uses the committed dawg/en_sowpods.dawg.
developer added 1 commit 2026-06-01 22:00:54 +00:00
owner approved these changes 2026-06-01 22:02:45 +00:00
owner merged commit 63a7c663bf into master 2026-06-01 22:02:56 +00:00
owner deleted branch feat/scrabble-solver 2026-06-01 22:03:03 +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-solver#1