1. Develop a minesweeper solver using a logical agent.
- Find py, and please do not modify it.
- You can use the methods, checkcell(), showcurrent(), isfail(), checkmines() methods and the variable, flags.
- You should use 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).
- 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.
- showcurrent(): It shows your current grid. vi. isfail(): It returns whether the game is over.
- checkmines(): It checks your flags is identical to the actual locations of mines.
- Please report the total running time to solve a game of 16×16 grid with 40 mines. ix. Submit your solver, ipynb.
Suggested Strategy
0 1 2 3
—————–
- | 0 | 1 | | |
—————–
- | 1 | 2 | | |
—————–
- | | | | |
—————–
- | | | | |
—————–
- 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
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 11 00 11 01 1 | 0 000…1 | 1 1001 | 00111 | TTTTF |
CECS 451 Assignment 6 – Page 2 of 2
- 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)).
Reviews
There are no reviews yet.