How rivorx/play_with_ai_games works
Play With AI Games is a collection of three game-agent projects. The chess workflow trains a CNN first from master games, then through MCTS self-play; models are evaluated by Elo and can be played through a GUI or UCI adapter. Snake and Solitaire provide separate RL-agent training and demonstration workflows. The graph preserves documented capabilities even where their implementations were not sampled; dashed, uncited links mark relationships that the available excerpts do not establish. Chess module relationships are limited to source-index references and the provided excerpts.
Main entry points: backend.py Board rules · uci_engine.py UCI adapter · central.py Batched inference · search.py Gumbel MCTS
Components 29
Chess play and inference
- Chess GUI
chess/src/ui/game_setup.py - UCI adapter
chess/src/ui/uci_engine.py - Board rules
chess/src/game/backend.py - Gumbel MCTS
chess/src/mcts/search.py - Model loading
chess/src/model.py - SE-CNN v9
chess/src/models/architecture/se_cnn_v9.py - Batched inference
chess/src/inference/central.py - Inference transport
chess/src/inference/shared_memory.py
Chess training and evaluation
- Master-game data
chess/src/models/data/se_cnn_v9/preprocessing.py - Training dataset
chess/src/models/data/se_cnn_v9/dataset.py - Imitation training
chess/src/training/il/trainer.py - Self-play engine
chess/src/selfplay/engine.py - Self-play workers
chess/src/selfplay/workers.py - RL replay
chess/src/training/rl/replay.py - Reinforcement training
chess/src/training/rl/trainer.py - Elo evaluation
chess/src/evaluation/elo_estimator.py
Snake agent
- PPO training
snake/scripts/train.py - Snake CNN
snake/scripts/model.py - Model analysis
snake/scripts/debug/analyze_model.py - GIF generation
snake/scripts/debug/make_gif.py
Solitaire agent
- MaskablePPO training
solitaire/scripts/train.py - Solitaire model
solitaire/scripts/model.py - CNN component
solitaire/scripts/cnn.py - GIF generation
solitaire/scripts/debug/make_gif.py
Other components
- Player or operator
- UCI client
- Stockfish
- Snake player or operator
- Solitaire player or operator
Connections 30
- Player or operator → Chess GUI: plays through
- Chess GUI → Board rules: uses rules
- UCI client → UCI adapter: sends commands
chess/src/ui/uci_engine.py - UCI adapter → Board rules: uses boards
chess/src/ui/uci_engine.py - UCI adapter → Model loading: loads model
chess/src/ui/uci_engine.py - UCI adapter → Gumbel MCTS: runs search
chess/src/ui/uci_engine.py - Gumbel MCTS → Board rules: queries positions
chess/src/mcts/search.py - Model loading → SE-CNN v9: creates model
chess/src/model.py - Batched inference → SE-CNN v9: runs inference
chess/src/inference/central.py - Batched inference → Gumbel MCTS: serves requests
chess/src/inference/central.py - Batched inference → Inference transport: transfers batches
chess/src/inference/central.py - Master-game data → Board rules: decodes positions
- Training dataset → Board rules: uses board data
chess/src/models/data/se_cnn_v9/dataset.py - Imitation training → Training dataset: loads datasets
- Self-play workers → Self-play engine: runs games
chess/src/selfplay/workers.py - Self-play engine → Gumbel MCTS: searches moves
chess/src/selfplay/engine.py - Self-play engine → Board rules: plays positions
chess/src/selfplay/engine.py - Self-play workers → Batched inference: requests inference
chess/src/selfplay/workers.py - Reinforcement training → RL replay: uses replay
- Reinforcement training → Self-play workers: starts self-play
- Elo evaluation → Stockfish: plays matches
- Player or operator → UCI client: connects engine
- Snake player or operator → PPO training: trains agent
- PPO training → Snake CNN: uses network
- Snake player or operator → Model analysis: analyzes model
- Snake player or operator → GIF generation: generates demo
- Solitaire player or operator → MaskablePPO training: trains agent
- MaskablePPO training → Solitaire model: uses model
- Solitaire model → CNN component: uses CNN
- Solitaire player or operator → GIF generation: records demo