Miniature attempt at making an AI train for Minesweeper on only CPU, since I only had my laptop with integrated GPU.
- Python 100%
Features: - Loads MineNet from a checkpoint - Console display (. hidden, F flagged, > highlighted) - Auto-flagging based on model probability - Zero-spread reveals connected zero regions - First click is forced to be a true zero (uses ground truth) - Prefers predicted zeros for subsequent clicks - Waits for user Enter before revealing next move (type 'q' then Enter to quit) |
||
|---|---|---|
| .idea | ||
| src | ||
| .gitignore | ||
| README.MD | ||
README - CPU-optimized Minesweeper trainer
How to run locally (recommended):
- Install PyTorch for CPU: e.g. pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- Copy both files into a directory and run: python train.py --board-size 9 --mines 10 --batch-size 32 --epochs 10 --threads 2
- The script will save a state dict to ./mines_model.pt
CPU optimization notes:
- Limit torch threads to avoid oversubscription (OMP_NUM_THREADS / MKL_NUM_THREADS env vars can also be set)
- Keep DataLoader num_workers=0 or small for low-memory / low-core systems
- Use small, efficient models (fewer channels/blocks)
- Use torch.jit.script optionally for CPU inference speedups
- Threading since well, GPU training is not on the CPU