| title | Yatzy AI Studio | |||||
|---|---|---|---|---|---|---|
| emoji | ๐ฒ | |||||
| colorFrom | blue | |||||
| colorTo | green | |||||
| sdk | gradio | |||||
| python_version | 3.12 | |||||
| app_file | app.py | |||||
| pinned | false | |||||
| license | mit | |||||
| short_description | Deep RL agent & interactive Web GUI for Yatzy | |||||
| tags |
|
๐ Live Demo: Try the trained AI agent live in your browser on Hugging Face Spaces (Grozby/yatzy)!
A Deep Reinforcement Learning (PPO) agent for Yatzy with an interactive Web GUI and real-time AI assistant.
This project implements a complete Yatzy game environment, a Proximal Policy Optimization (PPO) reinforcement learning agent, and an interactive Web GUI for human-AI play and agent visualization.
- ๐ฎ Interactive Web GUI: 3D styled dice, interactive scorecard, roll animations, and synthesized sound effects.
- ๐ก Real-Time AI Suggestions: Keep probabilities on dice, category ranking badges, and expected score estimations from the PPO Critic value head.
- ๐ค Autonomous Agent Mode: Watch the model play full 15-turn games end-to-end with adjustable speeds (Slow to Turbo) or advance step-by-step.
- ๐ Checkpoint Discovery: Auto-detects and switches between training checkpoints on the fly.
Using uv (recommended) or pip:
uv sync
# or
pip install -e .uv run python run_gui.pyOpen http://localhost:8000 in your browser.
To train the PPO model from scratch or resume training:
uv run python -m src.training.train_ppoTraining runs and checkpoints are automatically saved to experiments/run_<timestamp>/.
To run quick evaluation episodes:
uv run python -m src.training.run_episodesโโโ run_gui.py # Web GUI launcher script
โโโ ppo_yatzy.pt # Pre-trained baseline model weights
โโโ pyproject.toml # Project configuration and dependencies
โโโ experiments/ # Training runs, checkpoints, and metrics
โโโ src/
โโโ game/ # Game rules, scoring logic, and Gymnasium environment
โ โโโ environment.py # YatzyEnvironment with observation and action spaces
โ โโโ scoring.py # Category evaluation rules (Upper section, Yatzy, etc.)
โ โโโ state.py # Game state snapshot utilities
โโโ training/ # RL algorithm implementation
โ โโโ agent.py # PPO Agent logic & action selection
โ โโโ ppo_network.py # Actor-Critic neural network architecture
โ โโโ buffer.py # Rollout experience buffer
โ โโโ train_ppo.py # Training loop with Hydra configuration
โโโ gui/ # Web application backend and frontend
โโโ server.py # FastAPI application endpoints
โโโ service.py # Game session management & model analysis engine
โโโ static/ # Web UI assets (HTML, CSS, JS)
| Action | Shortcut |
|---|---|
| Roll Dice / Apply AI Move | Space |
| Toggle Dice 1 โ 5 | 1, 2, 3, 4, 5 |
| Toggle Auto Play | A |
| New Game | N |