How bb182/chess-scramble works
minichess is a Gardner 5×5 chess engine with three user-facing workflows: play through a browser UI, run headless agent matches, and train/evaluate AlphaZero-style agents. The game engine supplies legal moves, notation, and outcomes; agents use it directly, while the Gymnasium environment provides the observation/action interface used by RL. The README documents the full training loop and UI capabilities; some links among unsampled RL modules are supported by the SOURCE INDEX rather than inspected implementation excerpts.
Main entry points: board.py Board and rules · server.py WebSocket game server · move.py Move encoding · cli.py Command line
Components 23
Chess engine
- Board and rules
src/minichess/core/board.py - Move encoding
src/minichess/core/move.py - Notation and FEN
src/minichess/core/notation.py - Board geometry
src/minichess/core/constants.py - Move generation check
src/minichess/core/perft.py
Play and agents
- Command line
src/minichess/cli.py - Agent protocol
src/minichess/agents/base.py - Agent registry
src/minichess/agents/registry.py - Minimax agent
src/minichess/agents/minimax.py - Random agent
src/minichess/agents/random_agent.py - Match arena
src/minichess/arena.py
RL training
- RL environment
src/minichess/env.py - Policy value network
src/minichess/rl/network.py - Batched MCTS
src/minichess/rl/mcts.py - Self-play generation
src/minichess/rl/selfplay.py - Replay buffer
src/minichess/rl/replay.py - Board symmetry
src/minichess/rl/symmetry.py - Training orchestration
src/minichess/rl/train.py - AlphaZero agent
src/minichess/rl/agent.py
Browser UI
- WebSocket game server
src/minichess/web/server.py - Browser board
src/minichess/web/static/app.js
Other components
- User
- Browser player
Connections 41
- User → Command line: runs commands
README.md - Command line → WebSocket game server: starts play UI
src/minichess/cli.py - Command line → Match arena: runs matches
src/minichess/cli.py - Command line → Training orchestration: starts training
src/minichess/cli.py - Command line → Move generation check: runs perft
src/minichess/cli.py - Board and rules → Notation and FEN: parses and formats
src/minichess/core/board.py - Board and rules → Board geometry: uses geometry
src/minichess/core/board.py - Board and rules → Move encoding: encodes moves
src/minichess/core/board.py - Notation and FEN → Move encoding: converts moves
src/minichess/core/notation.py - Move generation check → Board and rules: counts positions
src/minichess/core/perft.py - Minimax agent → Board and rules: searches positions
src/minichess/agents/minimax.py - Minimax agent → Board geometry: scores pieces
src/minichess/agents/minimax.py - Minimax agent → Move encoding: selects moves
src/minichess/agents/minimax.py - Random agent → Board and rules: gets legal moves
src/minichess/agents/random_agent.py - Random agent → Move encoding: returns move
src/minichess/agents/random_agent.py - Agent registry → Minimax agent: creates agent
src/minichess/agents/registry.py - Agent registry → Random agent: creates agent
src/minichess/agents/registry.py - Agent registry → AlphaZero agent: creates agent
src/minichess/agents/registry.py - Match arena → Agent registry: resolves agent specs
src/minichess/arena.py - Match arena → Board and rules: plays game
src/minichess/arena.py - Match arena → Agent protocol: invokes agents
src/minichess/arena.py - RL environment → Board and rules: steps game state
src/minichess/env.py - RL environment → Move encoding: maps actions
src/minichess/env.py - Policy value network → RL environment: uses observation shape
src/minichess/rl/network.py - Policy value network → Move encoding: uses action count
src/minichess/rl/network.py - Batched MCTS → Board and rules: searches positions
src/minichess/rl/mcts.py - Self-play generation → Batched MCTS: runs search
src/minichess/rl/selfplay.py - Self-play generation → Policy value network: evaluates leaves
src/minichess/rl/selfplay.py - Self-play generation → Board and rules: plays games
src/minichess/rl/selfplay.py - Replay buffer → Board symmetry: augments samples
src/minichess/rl/replay.py - Training orchestration → Self-play generation: generates games
src/minichess/rl/train.py - Training orchestration → Replay buffer: stores samples
src/minichess/rl/train.py - Training orchestration → Policy value network: trains network
src/minichess/rl/train.py - Training orchestration → Match arena: evaluates agents
src/minichess/rl/train.py - AlphaZero agent → Batched MCTS: searches moves
src/minichess/rl/agent.py - AlphaZero agent → Policy value network: loads checkpoint
src/minichess/rl/agent.py - Browser player → WebSocket game server: sends game intents
src/minichess/web/server.py - WebSocket game server → Browser board: serves board assets
src/minichess/web/server.py - WebSocket game server → Board and rules: owns game state
src/minichess/web/server.py - WebSocket game server → Agent registry: resolves opponents
src/minichess/web/server.py - WebSocket game server → AlphaZero agent: discovers checkpoints
src/minichess/web/server.py