Coder Social home page Coder Social logo

Comments (4)

DavidNHill avatar DavidNHill commented on July 17, 2024 1

In Chrome to access the console try Shift-Control-J. If that doesn't work

  1. Right click in an open area to get the context menu... select "Inspect" (should open dev tools)
  2. Select "Console" from the menu bar
  3. Look at the Dev tools menu, top right (3 vertical dots) to undock the window so you can see both the console and the browser at the same time

You're right about the solver not understanding if this is the first move or not. It doesn't really affect safe-on-start games, where (for expert) you can divide by 0.79 and get the correct answer. Both for safety and progress.

For open-on-start games starting in the corner is wrong, but knowing the correct answer is beyond the scope of this solver.

I don't intend to 'fix' this.

from jsminesweeper.

DavidNHill avatar DavidNHill commented on July 17, 2024

Thanks for taking the time to write this. I'll try and answer your questions.

It is the probability none of the adjacent tiles are mines, which should be approx 79^3=50% ?
Yes, but these three tiles aren't independent so you can't calculate like that. The corner has to be a '0' and the chance of that is 39.57%

The engine recommends I play (0,5) which is insane considering the engine thinks it has worse safety, secondary safety and progress than (1,2).

I can't show everything on the tooltip. If you look in the console you'll find a lot of detail about what the solver is thinking...

-------- Tile (1,2) --------
Tile (1,2) has 0 linked living tiles and dominated=false
Tile (1,2) with value 1 Probability 0.421088 ==> Safest 1, Blended safety 1, Single safest tile: none, living clears 3
Tile (1,2) with value 2 Probability 0.323646 ==> Safest 0.8, Blended safety 0.8, Single safest tile: none, living clears 0
Tile (1,2) with value 3 Probability 0.0818 ==> Safest 0.8, Blended safety 0.8, Single safest tile: none, living clears 0
Tile (1,2) with value 4 Probability 0.006798 ==> Safest 0.80219781, Blended safety 0.80219781, Single safest tile: none, living clears 0
Tile (1,2), secondary safety = 0.75089814071238, 50/50 influence = 1, blended safety = 0.75089814071238, progress = 0.421088, expected clears = 1.263264, always clear = 0, final score = 0.7512143349086563
Tile (1,2) is now the best with score 0.7512143349086563
-------- Tile (0,5) --------
Tile (0,5) has 0 linked living tiles and dominated=false
Possible 50/50 - (0,5) (1,5) probability 0.129%
Possible 50/50 - (0,5) (0,6) (1,5) (1,6) probability 0.104%
Possible 50/50 - (0,4) (0,5) (1,4) (1,5) probability 0.218%
Tile (0,5) best 4-tile 50/50 has percentage 0.218%
Tile (0,5) with value 0 Probability 0.134007 ==> Safest 1, Blended safety 1, Single safest tile: none, living clears 7
Tile (0,5) with value 1 Probability 0.371298 ==> Safest 0.90727817, Blended safety 0.90727817, Single safest tile: none, living clears 0
Tile (0,5) with value 2 Probability 0.23274 ==> Safest 0.94376529, Blended safety 0.94376529, Single safest tile: none, living clears 0
Tile (0,5) with value 3 Probability 0.054533 ==> Safest 0.98, Blended safety 0.9800000000000001, Single safest tile: none, living clears 0
Tile (0,5) with value 4 Probability 0.004362 ==> Safest 1, Blended safety 1, Single safest tile: none, living clears 3
Tile (0,5), secondary safety = 0.74833384355926, 50/50 influence = 1.0039276, blended safety = 0.7512729995632234, progress = 0.13837, expected clears = 0.951143, always clear = 0, final score = 0.7513769532081729
Tile (0,5) is now the best with score 0.7513769532081729

These moves are virtually identical, but what pushes (0,5) to be better (in the solver's opinion) is that there is a tiny chance that there could be a 50/50 at this location.

I should say, I don't claim that every move the solver recommends is the best possible move, If that was true I'd have solved Minesweeper. I haven't. What I claim is that after running many millions of games, this heuristic results in more wins than any other I've tried.

If you for example replace the bottom left corner's 2 by a 1, the engine will stop calculating the secondary safety and progress of (0,5)

-------- Tile (0,5) --------
Tile (0,5) has 0 linked living tiles and dominated=false
Possible 50/50 - (0,5) (1,5) probability 0.135%
Possible 50/50 - (0,5) (0,6) (1,5) (1,6) probability 0.108%
Possible 50/50 - (0,4) (0,5) (1,4) (1,5) probability 0.224%
Tile (0,5) best 4-tile 50/50 has percentage 0.224%
Tile (0,5) with value 0 Probability 0.132539 ==> Safest 1, Blended safety 1, Single safest tile: none, living clears 7
Tile (0,5) with value 1 Probability 0.368613 ==> Safest 0.90637451, Blended safety 0.90637451, Single safest tile: none, living clears 0
Tile (0,5) with value 2 Probability 0.233668 ==> Safest 0.94308446, Blended safety 0.94308446, Single safest tile: none, living clears 0
Tile (0,5) is being pruned,  50/50 influence = 1.0040743, max score possible is 0.7501365684490969

In this case I've stopped the analysis of that tile early because it can't beat the current best score even under the most favourable conditions. you can see this by Tile (0,5) is being pruned.

You can prevent this by starting the solver with the nopruning parameter.

https://davidnhill.github.io/JSMinesweeper/index.html?board=30x16x99&nopruning=&analysis=aEaqaabLlTZlURlT0lUW0lTZl

Thank you for using my analyser and I hope this answers your questions.

from jsminesweeper.

SchazzGuy avatar SchazzGuy commented on July 17, 2024

Thanks a lot !

I didn't know this many calculations were going on under the hood.
I still have one questions : how could I get access myself to the console ? (Sorry if this is obvious)
And about the opening chance on first click, the fact the tiles are not independant was not the issue (since if I take that into account in the math we get 380/479*379/478*378/476=0.499) but simply to the fact the engine doesn't consider the first move being always safe so the approximated calculation is 0.79^4 which is indeed around 0.39.

from jsminesweeper.

SchazzGuy avatar SchazzGuy commented on July 17, 2024

Thank you :)

from jsminesweeper.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.