A reinforcement-learning experiment for Block Blast-style puzzle gameplay with a playable board and DQN training script.
Chinese · Quickstart · Features · Tech Stack
Block placement games reward planning, board-space management, and long-horizon tradeoffs. This repo explores how a DQN-style agent can learn placement choices that keep the grid playable longer.
The project includes both a playable Pygame board and a deeper training script. The training script imports PyTorch and psutil, so install those separately if your environment only uses requirements.txt.
- Playable Block Blast-style local game.
- DQN-style training script with convolutional grid features.
- Replay, n-step learning, attention-style scoring, and checkpoint logic in
train_ai.py. - Alternate harder game variant for experimentation.
- MIT-licensed code for study and modification.
- Run
game.pyto understand the puzzle environment. - Encode the grid, preview pieces, and game state as model inputs.
- Train the DQN-style model with replay and exploration.
- Watch behavior through the Pygame display and tune hyperparameters.
Run the project locally with the commands below.
git clone https://github.com/Ha22yX/Block-Blast-GridMind-AI.git
cd Block-Blast-GridMind-AI
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python game.py
# Training path: install the extra libraries used by train_ai.py
pip install torch psutil
python train_ai.pyThe current requirements.txt covers the playable game path; training needs PyTorch and psutil as shown above.
| Item | Purpose |
|---|---|
| Display speed | Use the training script controls to slow down or speed up visual observation. |
| Training output | Keep checkpoints/logs out of source control for longer runs. |
| CPU/GPU | The script can run on CPU, but training speed depends heavily on hardware. |
| Game variant | Use game_hard.py when testing a harder environment. |
| Layer | Technology | Role |
|---|---|---|
| Game | Pygame | Interactive board and training display. |
| Learning | PyTorch | DQN/CNN model and optimizer in train_ai.py. |
| Runtime | NumPy, psutil | State arrays and CPU/resource monitoring. |
| License | MIT | Permissive reuse with attribution. |
game.py playable Block Blast-style game
game_hard.py alternate/harder variant
train_ai.py reinforcement-learning trainer
requirements.txt base Python dependencies
LICENSE MIT license
RL playground for studying puzzle-game agents. The training code is experimental and should be treated as a research sandbox.
MIT License. See LICENSE.