Hacker News new | past | comments | ask | show | jobs | submit login
Minesweeper: Advanced Tactics (2005) (nothings.org)
131 points by leni536 on Feb 5, 2017 | hide | past | favorite | 50 comments



When someone says "minesweeper" I always shamelessly plug my js implementation: http://www.ronilan.com/bugsweeper/ Don't ask me why.


Because you know that after reading about minesweeper, a person naturally wants to play minesweeper. Thanks!

One thing I noticed though - in oldschool minesweeper, left click would test, and right would flag. Right seems to always flag here, but left sometimes tests, and sometimes toggles. Regardless, bookmarked.


Indeed.

A left click on a flagged cell will unflag it. Don't remember why I implemented it this way. Maybe for touch screens which don't have the right click functionality.

Btw, source is here: http://ronilan.com/bugsweeper/js/bugsweeper.js it is with jquery. Don't ask me why.


What I'm referring to though is the case where left-clicking on an UNflagged square flags it. Doesn't seem like that should happen. I'm not sure exactly when it was happening - perhaps the first left click after a right-click flag? Or the first one after a chord?


Maybe it is a bug? Sweep it!


On right click you set app.flagMode to true, but you don't unset it during or after the cellClicked call, so the first left click after a right is treated as another right.


It should have the same mouse usage. Now it's totally random: sometimes left mouse "opens" up a square, sometimes it puts a flag on it.


It has a bug. When I right click to add a flag, then right click to remove the flag, then left click to reveal it adds a flag instead of revealing.


System details:

Latest Chrome on windows 7.

Steps to reproduce:

1. Start a game.

2. Right-click to add a flag.

3. Right-click the same square again, to remove the flag just added.

4. Left-click to reveal the same square.

Expected behavior: the square turns into a bomb (you lose) or a number (you keep playing)

Actual behavior: square turns into a flag (as though right-clicking.)


you don't have the same behavior - when you click with both mouse buttons and it doesn't have the exact number of neighbors, it should depress the neighbor squares until you let go. like this -

http://i.imgur.com/843NK6H.png


(I middle-clicked or clicked both buttons on the 3 I scribbled in in red.)


I just had to play to see what your animation is when you win!


Thanks. Nice game.


I implemented a lot of these tactics, and my AI achieved about 50% success rate on expert mode.

https://luckytoilet.wordpress.com/2012/12/23/2125/


Cool! It's nice to know that 50% solvability is possible.

One note: In your example with the 11 configurations, are you sure that just clicking the squares with lowest counts, is the optimal way to go? It might be that while they are cheap, they also give little useful information on which configuration we are actually in? Perhaps some dynamic programming type solution could give the "clicking order" ensuring maximal winning probability.


Yea, that's a problem for sure. I don't know what's the best way to weigh being able to make progress in the future vs surviving the next click. For example, is it better to take a 50/50 chance and be guaranteed to make progress, or take a 80% chance of surviving but likely be stuck next turn? It's an interesting problem to be investigated someday.


Thanks for your post! I remember reading this sometime in 2013 and writing my own minesweeper AI based on it. It didn't get very far, but I sure had a lot of fun.


https://sourceforge.net/projects/mines-perfect/

It's awesome, it has Murphy's Law (if there is a possibility that the field you just clicked has a mine, then it will have one), always solvable levels and some variations of the board (think hexagonal, 3d). And it runs nicely in Wine.

Try it. :)


This analysis does not mention a implementation quirk for resolving hitting a mine on the first click. Shortly described: If the first cell clicked has a mine, move the mine to the first free cell starting from top left, and search row by row from left to right, top to bottom.

It did not trigger for the game in question, as there is no mine in the top left corner. However, in normal games, with all other things considered equal, top left corner would have a higher chance of having a mine than anywhere else.


I used to play minesweeper so much I would dream about it. I recently went looking for a replacement and found Hexcells Infinite which has really filled the gap. All puzzles are solvable and it even has nice music. Highly recommended.


Honestly, minesweeper is the one thing i really miss having on my home machines since dropping windows. There are some versions out there that are very similar but none have the feel and speed of the classic on xp or 3.1.


Copy the .exe from a friend and use Wine


Just dont tell microsoft. They dont much like people sharing thier games.


There's a pretty good iOS (and maybe Android?) game called PsyCard [1] that's a card-based variant of Minesweeper. It's from Ludosity, so the art is insane and the difficulty is substantial.

I'll be interested to see if these techniques help.

[1] https://itunes.apple.com/us/app/psycard/id1078267846?mt=8


Amazing article. I had underdeveloped but original (to me) ideas along these lines, as I'm sure that many Hacker News readers did.

Apologies in advance for bikeshedding, but "Final Solution" is a jarring phrase, and that section heading diverted my attention.

https://www.ushmm.org/outreach/en/article.php?ModuleId=10007...


One thing that got my minesweeper game times down was to never actually mark the mines as such, just click the unturned squares you know aren't mines.


From what I've observed top players flag mines very minimally, only so that they can strategically chord in certain situations. Lists of record scores typically make a distinction between flagging mines vs. not doing so. I never flag mines, but I'm also not that good compared to the best of the best.

For reference, the best of the best is Kamil Murański. There is only a 0.4 second difference between his NF (No Flag) time and his normal expert world record:

https://www.youtube.com/watch?v=GrZCWx0fnfc (flagging)

https://www.youtube.com/watch?v=8bsLwGf-vUE (no flagging)


Wow, and I was proud of myself years ago when I achieved my goal of completing expert at less than 99 seconds!


There are versions of Minesweeper which guarantee that you never have to guess. I find these to be a lot more fun. My understanding is that they work by using a solver on the generated field, and regenerating if the solver can't find a guaranteed solution. Search for "no guess minesweeper" on your favorite platform.


Which I vastly prefer :| It's not very enjoyable to spend a good amount of time on a minesweeper-like game, and then have the end succeed/fail result dictated by a dice-roll.


Exactly. It's nice to know that my success or failure is entirely up to me. It also lets you ramp up the difficulty to an absurd level and still have something you can solve with enough effort. Purely random boards become essentially impossible.


Back in the day, I spent a fair amount of time playing Minecraft at the hard level. I did OK but my sister consistently beat me by large margins, completing in about 2/3 of the time that I used. It was a bit frustrating to be beaten that thoroughly.

Her advice, as I recall, was to never pause to think. When running out of no-brainers around one area, immediately skip to another area. When running out of easy options, take a chance. It worked well for her but I never managed to make it work for me. I'd always stop at some point to ponder for ten seconds.


I use a simple but effective tactic.

50-50 chances on nearby/adjacent tiles aren't actually 50%. If one tile would reveal a 4 and the other a 2, pick the second, because 4s are more rare.


I don't follow. This would only work if the distribution of numbers was predetermined and influenced the distribution of mines. I was under the impression that the mines were uniformly distributed though. So in a "T" scenario, it really is 50-50. The fact that 4s are more rare doesn't matter at that point. Sort of like in a series of coin flips, of you've flipped 5 heads in a row, tails isn't more likely to come since 6 heads are rare: it's still just 50-60.


The mines are uniformly distributed, yes, but the numbers are not. In a relatively sparse minefield, how likely is to find a 4? Of course depending on the "shape" of a cluster, chances can be 50%. The mines influence the distribution of numbers, not the other way around.

Try to apply the tactic I mentioned to solve the minefield in the article.


Your logic is faulty, but it's hard to explain why. I think this might be variation of the Monty Hall Problem:

https://en.wikipedia.org/wiki/Monty_Hall_problem

Or more likely, just the Gambler's fallacy:

https://en.wikipedia.org/wiki/Gambler's_fallacy


It's not based on math, it's empirical. In practice seems to work.

I applied it on the minefield in the article and I solved it.

To put it another way, on two adjacent tiles where there's one mine, if you had the choice to reveal a 2 or a 6, which one would you choose?


Someone should build a little computer simulation to test this over a million minefields.


Better, have it actually learn from mistakes and see what logic it comes up with.


Good idea, I could do it.


I think the parent's argument could rewriten as:

The numbers induce a probability distribution in the adjacent tiles. But you also should take into account that the remaining mines are uniformily distributed.

In other words, consider the prior.

I couldn't write math neither in favor nor against this claim.

1. Maybe for uniformly distributed mines the numbers have all the information you need.

or

2. Maybe using the fact the the mines are uniformily distributed, in addition to the numbers, has impact on the probabilities distributions EDIT:

you play a 10x10 game with 20 mines.

your initial move in a non-border tile reveals a `1`.

you now know that around that `1` there is a 1/8=0.125 chance of hitting a mine.

ITOH there is a 19/91 = 0.20879 chance to find a mine in a tile not adjacent to the `1`


I'm a little late to this, but a while back I built a simple version of Minesweeper with an API to allow programmatic AI solvers for the game.

Would be great to hear any feedback on it!

https://github.com/myfancypants/minesweeper


It would be interesting to built a minesweeper implementation that calculates mine positions dynamically. That way, you could resolve "unsolvable" situations like this by always favouring the player (or the opposite, if you're feeling evil).


There is an OSS version of Minesweeper that does something like this! It would dynamically set the game grid so that you never need to guess.

Inversely, if you're guessing, it would make you lose ;)

It also included a hexagonal grid mode and other goodies, but I haven't touched it in 10 years and can't find it anymore. Might have been windows only, not sure


I found this: http://www.chiark.greenend.org.uk/%7Esgtatham/puzzles/js/min...

"you are guaranteed to be able to solve the whole grid by deduction rather than guesswork."


Yes, and Simon's version delays generation of the grid till your first click to guarantee this.



I have a free version on iOS http://apple.co/1r5mC3g


A friend of mine called himself an MCSE - Minesweeper consultant and Solitaire expert.


I wonder how good convolutional neural network could get at minesweeper.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: