$29.99
CECS 451
Assignment 6
Total: 50 Points
General Instruction
• Submit uncompressed file(s) in the Dropbox folder via BeachBoard (Not email).
1. (50 points) Develop a minesweeper solver using a logical agent.
i. Find mines.py, and please do not modify it.
ii. You can use the methods, checkcell(), showcurrent(), isfail(), checkmines()
methods and the variable, self.flags.
iii. You should use self.flags variable to keep track of the candidate locations of the
mines. It is a list of tuples which are the coordinates of the mines. i.e., (row, col).
iv. checkcell(): you can check whether a cell contains a mine or not. Please be
careful of using this method. If you query the locations of mines, you can’t proceed
the game. It always return your current grid which is 2d array of integers.
v. showcurrent(): It shows your current grid.
vi. isfail(): It returns whether the game is over.
vii. checkmines(): It checks your self.flags is identical to the actual locations of
mines.
viii. Please report the total running time to solve a game of 16 × 16 grid with 40 mines.
ix. Submit your solver, minefinder.ipynb.
Suggested Strategy
0 1 2 3
-----------------
0 | 0 | 1 | | |
-----------------
1 | 1 | 2 | | |
-----------------
2 | | | | |
-----------------
3 | | | | |
-----------------
• Build equations from given information.
X2,0 + X2,1 = 1
X0,2 + X1,2 = 1
X2,0 + X2,1 + X2,2 + X0,2 + X1,2 = 2
CECS 451 Assignment 6 - Page 2 of 2
X2,0 X2,1 X2,2 X0,2 X1,2 T/F
0 0 0 0 0 F
0 0 0 0 1 F
0 0 0 1 0 F
.
.
.
0 1 0 1 0 T
1 0 0 1 0 T
0 1 0 0 1 T
1 0 0 0 1 T
.
.
.
1 1 1 1 1 F
• Enumerate all combinations of 0 or 1 for given variables, then check whether they
satisfy all the equations.
• Now you know X2,2 = 0, then try checkcell((2,2)).