
Minesweeper: Advanced Tactics (2005) - leni536
http://nothings.org/games/minesweeper/
======
ronilan
When someone says "minesweeper" I always shamelessly plug my js
implementation:
[http://www.ronilan.com/bugsweeper/](http://www.ronilan.com/bugsweeper/) Don't
ask me why.

~~~
tempestn
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.

~~~
ronilan
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](http://ronilan.com/bugsweeper/js/bugsweeper.js)
it is with jquery. Don't ask me why.

~~~
tempestn
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?

~~~
ronilan
Maybe it is a bug? Sweep it!

~~~
tempestn
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.

------
luckyt
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/](https://luckytoilet.wordpress.com/2012/12/23/2125/)

~~~
thomasahle
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.

~~~
luckyt
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.

------
heinrich5991
[https://sourceforge.net/projects/mines-
perfect/](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. :)

------
okamiueru
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.

------
jbrantly
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.

------
sandworm101
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.

~~~
speps
Copy the .exe from a friend and use Wine

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

------
chris_st
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](https://itunes.apple.com/us/app/psycard/id1078267846?mt=8)

------
Brainix
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...](https://www.ushmm.org/outreach/en/article.php?ModuleId=10007704)

------
dwpdwpdwpdwpdwp
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.

~~~
3131s
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](https://www.youtube.com/watch?v=GrZCWx0fnfc)
(flagging)

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

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

------
mikeash
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.

~~~
Groxx
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.

~~~
mikeash
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.

------
mvindahl
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.

------
tydok
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.

~~~
qiemem
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.

~~~
tydok
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.

~~~
Retr0spectrum
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](https://en.wikipedia.org/wiki/Monty_Hall_problem)

Or more likely, just the Gambler's fallacy:

[https://en.wikipedia.org/wiki/Gambler's_fallacy](https://en.wikipedia.org/wiki/Gambler's_fallacy)

~~~
tydok
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?

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

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

------
myfancypants
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](https://github.com/myfancypants/minesweeper)

------
Retr0spectrum
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).

~~~
rtpg
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

~~~
Retr0spectrum
I found this:
[http://www.chiark.greenend.org.uk/%7Esgtatham/puzzles/js/min...](http://www.chiark.greenend.org.uk/%7Esgtatham/puzzles/js/mines.html)

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

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

------
speps
Online
[https://archive.org/details/win3_Mineswee](https://archive.org/details/win3_Mineswee)

------
lonh
I have a free version on iOS
[http://apple.co/1r5mC3g](http://apple.co/1r5mC3g)

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

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

