Algorithmic solution for Minesweeper

I'm trying to make a minesweeper solver. As you know, there are two ways to determine which fields in a minefield are safe to open, or to determine which fields are mined, and you need to mark it. The first way of defining is trivial, and we have something like this:

if (the number of mines around X is the current number of mines discovered around X) = the number of undiscovered fields around X, then all undiscovered fields around X are mined

if (number of mines around X == current number of mines discovered around X), then All undiscovered fields around X are NOT mined

But my question is: how about a situation where we cannot find any mined or safe field, and we need to see more than one field?

http://img541.imageshack.us/img541/4339/10299095.png

For example, such a situation. We cannot determine anything using the previous method. So I need help with an algorithm for these cases.

I need to use the A * algorithm for this. That is why I need all the possible safe states for the next step in the algorithm. When I find all possible safe states, I will add them to the current shortest path, and depending on the heuristic function, I will sort the list of paths and select the next field to open.

+5
source share
2 answers

, , , NP Completeness and Minesweeper, , . , , , , .

: . . (.. , ), , - sudoku. . .

+8

@tigger, , . Minesweeper - , , DPLL. - , , . , . , " - " . DPLL , " " Google.

+1

All Articles