Miniature attempt at making an AI train for Minesweeper on only CPU, since I only had my laptop with integrated GPU.
Find a file
Schimeltuer144 0294e56a0b Interactive Minesweeper inference using the improved MineNet model (depthwise/residual/groupnorm).
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)
2025-11-11 16:41:15 +01:00
.idea Improved CPU-oriented training for Minesweeper (fixed version). 2025-11-11 16:14:03 +01:00
src Interactive Minesweeper inference using the improved MineNet model (depthwise/residual/groupnorm). 2025-11-11 16:41:15 +01:00
.gitignore Improved CPU-oriented training for Minesweeper (fixed version). 2025-11-11 16:14:03 +01:00
README.MD Improved CPU-oriented training for Minesweeper (fixed version). 2025-11-11 16:14:03 +01:00

README - CPU-optimized Minesweeper trainer

How to run locally (recommended):

  1. Install PyTorch for CPU: e.g. pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
  2. Copy both files into a directory and run: python train.py --board-size 9 --mines 10 --batch-size 32 --epochs 10 --threads 2
  3. 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