owenrees e0b446bbfb Weight puzzle selection and stop repeats inside a session (#183)
Selection took a hard rating band (medium = user rating ± 100), removed
everything attempted in the last 30 days, and drew uniformly from what was
left. Because the bulk importer gives every endgame in a batch the same
rating, the band held either the whole library or — once a user's rating
drifted past it — only the endgames that user had already played. With
`fresh` empty, the fallback re-drew from the same band ignoring recency, so
recently played puzzles came straight back. An empty band used a
deterministic nearest-match, alternating between the same two puzzles.

Difficulty is now a bias rather than a filter: candidates are weighted by
`exp(-|rating - target| / spread)` and drawn with an exponential race, so
the whole library stays reachable and a thin region around the user's rating
can never empty the pool. `easy` and `hard` keep one-sided guards so the
labels stay honest. When every candidate is excluded, selection serves the
least recently attempted endgame instead of a random recent one.

Sessions now carry the ids they have served, which fixes the observed
in-session repeat (only the current puzzle used to be excluded), and guest
training gets the same treatment. The 30-day window is configurable as the
repeat window and is now named in GLOSSARY.md, distinct from the rating
window and from the tablebase cooldown.

Difficulty copy is qualitative, since the band numbers no longer describe
how selection works.
2026-11-17 14:28:24 +01:00
2026-06-20 19:08:18 +02:00

Chesstrainer

To start your Phoenix server:

  • Run docker compose up -d to run the development database
  • Run mix setup to install and setup dependencies
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Local tablebases (optional)

Positions with five or fewer pieces are answered locally from Syzygy tablebases when TABLEBASE_PATH points at a directory of .rtbw/.rtbz files; otherwise lookups fall back to Lichess.

mix tablebase.fetch --path /path/to/syzygy/3-4-5   # once per host (~939 MB)
export TABLEBASE_PATH=/path/to/syzygy/3-4-5        # set per environment

On the production VPS the directory is /opt/chesstrainer/tablebases, owned by the chesstrainer user. Set TABLEBASE_PATH in /etc/chesstrainer/env and restart the service; the value is read at boot.

See docs/tablebases.md for the full reference — dev vs VPS paths, mix tablebase.check, and boot logging.

Logging

Production logs are one JSON object per line so they can be filtered with journalctl and jq; development and test keep the readable formatter. See docs/logging.md for the line shape, redaction rules and the background-work audit, and deploy/README.md for the VPS runbook.

Learn more

S
Description
No description provided
Readme
1.7 MiB
Languages
Elixir 83.4%
HTML 7%
Shell 3.6%
CSS 3%
JavaScript 2%
Other 0.9%