Files
chess-project/public/openings
Stefan 8ed402bbe0 feat: improve opening trainer flow and add deviation dialog
- Add tutor message guardrail to prevent rapid-fire messages
  - Track last message by move index
  - Wait for both player and opponent moves before speaking
  - Speak immediately when player deviates from theory

- Add deviation dialog with three options:
  - Continue Playing (Start Game) - transitions to game mode
  - Undo & Return to Opening - returns to theory
  - Explore This Variation - continues off-book practice

- Implement smooth game mode transition:
  - Pass opening context from trainer to game
  - Tutor welcomes player with context about their study
  - Computer makes first move if needed in starting position

- Fix generate-test-fixtures script:
  - Add safety check to prevent overwriting real data
  - Restore full opening database (12,379 openings)
  - Rebuild move index (12,377 sequences)
  - Add clear warnings about test fixtures

- Update ChessGame to accept openingContext prop
- Update Tutor to display contextual greeting in game mode

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 15:05:05 +01:00
..

Opening Database

This directory contains the ECO (Encyclopedia of Chess Openings) database files.

Required Files

The following files are required for opening training:

  • ecoA.json - ECO codes A00-A99
  • ecoB.json - ECO codes B00-B99
  • ecoC.json - ECO codes C00-C99
  • ecoD.json - ECO codes D00-D99
  • ecoE.json - ECO codes E00-E99
  • moveIndex.json - Generated move sequence index

File Format

Each ECO file (ecoA-E.json) should be a JSON object mapping FEN positions to opening metadata:

{
  "fen_position": {
    "eco": "A00",
    "name": "Opening Name",
    "moves": "e4 e5 Nf3 Nc6",
    "wikipediaSlug": "opening-name" // optional
  }
}

Setup

Option 1: Docker (Automatic)

When running via Docker, these files should be provided as a volume mount:

docker run -v ./openings:/app/public/openings ghcr.io/stefan-kp/chess-tutor

Option 2: Local Development

  1. Obtain ECO database files (ecoA-E.json)
  2. Place them in this directory
  3. Generate the move index:
npm run build:opening-index

This will create moveIndex.json from the ECO files.

Option 3: Generate from PGN

If you have a PGN database, you can extract ECO codes using chess tools like:

  • pgn-extract
  • Custom scripts

Notes

  • These files are not included in git (too large, ~4MB total)
  • Users must provide their own opening database
  • Wikipedia integration is optional (see public/wikipedia/README.md)
  • The move index is automatically generated during Docker startup