Single-page chess app with a Python backend and a canvas-based UI. The server validates moves, returns notation and FEN, and provides a simple engine for black moves and analysis.
- Pixi to manage the Python environment and project commands.
- Port
8000available on your machine. - Internet access in your browser (Tailwind CSS is loaded via CDN).
pixi install
pixi run uvicornOpen: http://127.0.0.1:8000
The engine uses a basic minimax search with alpha-beta pruning: it generates legal moves, applies each move to a cloned game state, then recursively searches to a fixed depth, alternating between maximizing (black) and minimizing (white) scores. At the leaf depth (or terminal positions like checkmate/stalemate), it returns a static evaluation score, and the root move with the best score is chosen as the engine move. There are no major improvements yet (no move ordering or transposition tables).
The evaluation is a straightforward material-and-position heuristic that totals piece values plus simple positional bonuses. It does not account for advanced concepts like king safety, pawn structure, or tactical threats; the score is meant to be a quick, readable signal for the minimax search rather than a strong chess engine assessment.
app/chess/rules, notation, and engineapp/api/API routes and schemasapp/static/frontend assets (HTML/CSS/JS + piece SVGs)tests/pytest test suite
GET /api/healthhealth checkPOST /api/fenreturn FEN for a given board/statePOST /api/validatevalidate and apply a movePOST /api/movereturn an engine move with analysis metadataPOST /api/win-probabilityreturn win probabilities from static evaluation
Pixi manages the Python environment from pixi.toml and pixi.lock.
pixi run uvicorn # run the FastAPI app via Uvicorn on port 8000
pixi run test # run pytest
pixi run lint # run pylint with the repo's CI policy
pixi shell # open a shell in the Pixi environmentCommands are available as VS Code tasks in .vscode/tasks.json.
