[SOLVED] CECS451-Homework 6

15.99 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

Develop a minesweeper solver using a logical agent.

  1. Find py, and please do not modify it.
  2. 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).
  1. 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.
  2. 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               1

1               0

0               1

1               0

1           1

0 0

0

0

1

1 1

0

0

1

0

0

1

1

1

T

T

T

T

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)).
Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.