Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
Launches the run solver script with the given optional arguments.
automatically solves the 10 * 10 puzzle with 10 mines 100,000 times (each time is a randomly generated puzzle)
Go to Solver and set the flag below to true.
const printSteps = false; // set this to true
This solver implements a Double-Set-Single-Point (DSSP) strategy. For more information, check here in Chapter 5.3.
Solving a 10 by 10 puzzle with 10 mines 100,000 times (each time is a different puzzle), the chance of winning is around 72%, which is similar to what's been obtained in the paper. The run time is within 35 seconds.
The pseudo-code is illustrated below:
firstStep = firstMove()
S = new Set() // "safe" cells to explore
Q = new Set() // cells that need more information about neighbors
S.add(firstStep)
while game is not over:
if S is empty:
x = selectRandomSquare()
S.add(x)
while S is not empty:
x = S.remove()
probe(x) // probe means uncover
if x is mine:
return failure
if AFN(x): // all-free-neighbor: # neighbor mines - marked cells == 0
S.add(unmarkedNeighbors(x))
else:
Q.add(x)
for q in Q:
if AMN(q): // all-mines-neighbor: # neighbor mines - marked cells == # of unmarked cells
for y in unmarkedNeighbors(q):
mark(y) // mark cell y as mine
Q.remove(q)
for q in Q:
if AFN(q):
S.add(unmarkedNeighbors(q))
Q.remove(q)
return success