~piotr-machura/sweep-ai

Minesweeper with AI-powered hints.
08977605 — Piotr Machura 2 years ago
Create cache directory if it does not exist
a45396ea — Piotr Machura 2 years ago
Update README

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~piotr-machura/sweep-ai
read/write
git@git.sr.ht:~piotr-machura/sweep-ai

You can also use your local clone with git send-email.

#Sweep AI

Sweep AI is a minesweeper clone enhanced with deep learning capabilities. While minesweeper may not exactly be NP-complete and multiple strategies that make the game easier exist, why not make the neural network solve the problem for us?

Warning: this doesn't work so well.

#Installation

The safest way to clone the repo and install the game within a virtual environment

# In the project's directory
python3 -m venv .venv
source .venv/bin/activate
pip install .
python3 -m sweep-ai # Play the game

For development, use poetry:

# In the project's directory
poetry install
poetry run pytest # Run unit tests
poetry run sweep-ai # Play the game

#Usage

The players' brains and training data are cached and looked for in the following order:

  1. $SWEEP_CACHE/sweep
  2. $XDG_CACHE_HOME/sweep
  3. $CWD/sweep

Run the game with --clean-cache flag to remove the cache directory. Use --no-cache if you don't want to use the cached models (cached training data is still used). To generate a plot of player's loss after training add the --plot flag.

The AI is built using keras. The interface uses pygame and pygame-menu.