Prolog Minesweeper with some AI assistance
To start a preset game mode, type ‘play(mini).’, ‘play(easy).’, ‘play(normal).’ or ‘play(hard).’. Instructions will follow. To start a custom game, type play(H,W,N) where H, W, N are the Height, Width, and Number of mines respectively. For example, play(easy) is equivalent to play(8,8,10).
I recommend you run this in SICStus Prolog, as SWI-Prolog seems to run out of stack. May be due to default stack size or superior pruning in SICStus.
AI finds the only guaranteed safe move
Later, the game is cleared.
Example of an ambiguous state. In this case, the AI finds (one of) the safest moves and executes it.