minesweeper solver marina maznikova artificial intelligence ii fall 2011

Post on 19-Jan-2016

220 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Minesweeper Solver

Marina Maznikova

Artificial Intelligence II Fall 2011

2

Agenda

1. The Minesweeper Game

2. Theoretical Background

3. Solving Agents

4. Evaluation

5. Extension

6. Summary

3

1. The Minesweeper Game

4

1. The Minesweeper Game

5

2. Theoretical Background

NP-completeness (8-SAT)

Solving approaches: ConstraintsReinforcement learning

6

3. Solving Agents

Random agent (RA)

7

3. Solving Agents

Random agent (RA)

Simple agent (SA)Only mines remain around

a square => mark as mineAll mines around a square

are marked => open neighbors

8

3. Solving Agents

Greedy agent (GA)Start with (0, 0)Search for mine and safe squares If nothing found

Calculate for each square the density of mines on the squares around it

For each square, take the maximum of the densities calculated for this

If no opened neighbors => ½ Open the square with the minimum

“probability” of mine

2/3

2/3

1/5

9

3. Solving Agents

Constraints agent (CA)Start with (0, 0)Consider only the relevant squaresModel the problem as constraints problem

Mine square => 1; opened square => 0 Sum of mines around opened squares Number of mines in the game

10

3. Solving Agents

Constraints agent (CA)Backtracking for 3000 resultsCalculate how many times

each square is mineMark mine squares and open

safe squares If no such squares found,

open the square with the lowest sum of mines

0 0 1 0 0 0 0 0

0 1 1 1 1 1 0 1

1 1 1 1 1 1 0 1

1 2 3 2 2 2 0 2

11

3. Solving Agents

Constraints agent (CA)Problem: Exponential algorithm

Impossible to generate always all the solutions Time

12

3. Solving Agents

Constraints agent (CA)Problem: Exponential algorithm

Impossible to generate always all the solutions Time

“Simple” constraints agent (SCA)Start with (0, 0)Search for mine and safe squares If nothing found, use constraints

13

4. Evaluation

Observed variablesOverall resultAverage squares revealed per gameTime

Tests (20.000 games)Agent comparison on standard boardVariation of board sizeVariation of mine density

14

4. Evaluation: Standard Game

Problem of too many solution possibilities

15

4. Evaluation: Standard GameBacktracking is expensive

16

4. Evaluation: Board SizeBetter performance

on larger and smaller boards

Exception: backtracking

17

4. Evaluation: Board SizeLarger boards require more time, especially when backtracking is

used

18

4. Evaluation: Mine DensityThe higher the mine density, the worse the performance

Greedy strategy is not good for

few mines

19

4. Evaluation: Mine Density

RA, SA, and GA: More mines

require less time

CA and SCA: More mines

require more time

20

5. Extension

Possibility to open 5% of the squares as jokerRA: At the beginning of the gameSA: In case no mine/safe squares are foundGA: In case of two squares with the same

mine “probability”CA and SCA: On start, in case of too many

solutions of the problem, and when two squares are “safest”

21

5. Extension: EvaluationJokers improve the performance

… and make unsafe strategies inefficient

22

5. Extension: EvaluationTime increases because of the more moves

23

6. Summary Backtracking is expensive

and for many solution possibilities inefficient Solution: Sets

The Greedy strategy is not a good strategy

The higher the mine density, the difficult the game

Jokers help and make unsafe move strategies inefficient

top related