How therealnightmare/playerkoi works
Player Koi tracks a physical chessboard: calibrated camera frames pass through motion gating and occupancy classification, then legal-move resolution updates a software chess position. The web UI exposes ordinary play, engine opponent, guided coaching, puzzles, and manual correction; an optional gantry executes moves. The graph emphasizes the documented runtime flow and major modes. Some mode and integration links rely on README or web_ui.py references; unsampled implementation details are not inferred.
Main entry points: web_ui.py Web UI server · tracking_loop.py Board tracking · robot.py Robot controller · engine.py Chess engine
Components 22
Vision and tracking
- Camera capture
src/capture.py - Board calibration
src/calibrate.py - Square geometry
src/square_geometry.py - Occupancy classifier
src/square_classifier.py - Motion gate
src/roi_diff.py - Board tracking
src/tracking_loop.py - Legal move resolver
src/move_resolver.py - Board state
src/board_state.py
Game modes
- Chess engine
src/engine.py - Guided coach
src/coach.py - Move policy
src/move_policy.py - Puzzle mode
src/puzzles.py
Robot gantry
- Robot controller
src/robot.py - Move planner
src/robot_moves.py - Rig geometry
src/rig.py
Web interface
- Web UI server
src/web_ui.py - Mode session
src/session.py - Browser controls
src/ui/app.js - Manual administration
src/admin_moves.py
Other components
- Player
- Stockfish
- Gantry hardware
Connections 23
- Player → Browser controls: operates
- Browser controls → Web UI server: sends controls
- Web UI server → Mode session: manages modes
src/web_ui.py - Web UI server → Board tracking: serves tracking
src/web_ui.py - Camera capture → Board tracking: supplies frames
src/main.py - Board calibration → Square geometry: sets board mapping
- Board tracking → Motion gate: gates detection
src/tracking_loop.py - Board tracking → Occupancy classifier: classifies squares
src/tracking_loop.py - Board tracking → Square geometry: uses square boxes
src/tracking_loop.py - Board tracking → Legal move resolver: resolves deltas
src/tracking_loop.py - Legal move resolver → Board state: updates position
src/board_state.py - Web UI server → Chess engine: creates opponent
src/web_ui.py - Chess engine → Stockfish: uses UCI
src/engine.py - Web UI server → Guided coach: provides guided mode
src/web_ui.py - Guided coach → Chess engine: requests analysis
src/coach.py - Web UI server → Puzzle mode: provides puzzles
src/web_ui.py - Web UI server → Move policy: selects move policy
src/web_ui.py - Web UI server → Robot controller: dispatches moves
src/web_ui.py - Robot controller → Move planner: plans motion
src/robot.py - Move planner → Rig geometry: uses measured geometry
src/robot_moves.py - Robot controller → Gantry hardware: sends commands
- Web UI server → Manual administration: offers corrections
src/web_ui.py - Manual administration → Robot controller: controls arm
src/admin_moves.py