
Pure Skill Minesweeper - ColinWright
https://github.andrewt.net/mines/
======
ericfrederich
I had a co-worker who played minesweeper all day long on his Linux workstation
which I had remote access to. I grabbed the source code for the exact version
of gnome-mines he was using and compiled my own version with some back doors.
I would also launch an xvnc server so I could see him playing from my desk.
Sometimes I'd have people over at my desk watching him play. It was hilarious.

I could enable various features while the game was playing. Features included:
* Always lose on first click * Always win on first click * Force a guess in
all 4 corners... so even if played perfectly he'd have to make 4 guesses. *
Load custom designs from text file. For instance I had some that spelled
things out. * Every click would be completely surrounded by mines (i.e. the
number 8) until half the mines were exhausted. This one was fun because I
remember him not believing it and actually clicking on a mine. * Ridiculous
sounds when he won or lost

~~~
lofties
It sounds to me like you installed spyware on your coworkers computer. What
kind of company were you working at where people see this as a joke instead of
a security breach? And let's not forget the trust coworkers have in you not to
fuck with their machines.

~~~
eckza
Sometimes, it's okay to play practical jokes on your friends.

~~~
lofties
Spyware is not a prank. Let's not come up with vague definitions of what is,
and isn't acceptable.

Coworker has remote access to other coworkers machine and is abusing this
trust to install spyware, setting a president for other "jokes".

Sorry man, I don't see anything funny here.

~~~
jpendry
You must be fun at parties.

~~~
loriverkutya
He is probably fun at parties and not undermining his colleagues trust at
work.

------
xamuel
Eliminating guesswork from minesweeper kills a subtle metagame. The
minesweeper metagame is not about how best to win a particular playthrough,
but rather, how to proceed so as to achieve the fastest record time after many
playthroughs.

Thus, the metagame includes knowing when to guess (since, for time-beating
purposes, it is optimal to instantly guess as soon as you identify that a
guess is necessary, not just to speed up that particular playthrough, but more
importantly because it will allow more playthroughs to be performed in less
time).

Similarly, part of the metagame includes figuring out how best to make initial
guesses. Is it better to always initially make 1 guess, or 2, or 3, or does it
depend on how much of the board the first guess opens up? Etc.

~~~
lojack
> for time-beating purposes, it is optimal to instantly guess as soon as you
> identify that a guess is necessary

Often that is the case, but sometimes you reach a point where you ultimately
need to guess, but you can make an informed guess based on the number of mines
remaining. Then the question becomes, is it worth guessing and potentially
losing faster, or are you having a really good game and want to risk losing
late in the game?

~~~
mikewarot
Wait, there's a timer involved? I always ignore those.

~~~
rendall
Me too.

------
texan
Does not take all manners of deduction into account.

For instance if there are a 10 unknown spots left on the board, and only two
mines left with an unknown location, so there I can limit the the spots that
potentially have a mine to the two sets of two spots adjacent to specific
numbers, and thus deduce that the uncovered spot adjacent to only uncovered
spots must not be a mine.

In such a scenario, the game penalized for me a deduction that it though was a
guess. Causing the game to end, but it was impossible for that spot to be a
mine!

~~~
oneepic
+1. I lost the game by clicking on a space that could not have possibly been a
mine, based on the # of mines left. If there were a mine there, then the total
number of mines would have had to be N+1, not N.

~~~
cbsks
Mines from Simon Tatham's Portable Puzzle Collection also doesn’t require
guessing and does take that case into account:

> you are guaranteed to be able to solve the whole grid by deduction rather
> than guesswork. (Deductions may require you to think about the total number
> of mines.)

[https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mine...](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mines.html)

------
9nGQluzmnq3M
One thing I rarely see mentioned is that it's pretty common to have situations
in Minesweeper where you need to guess, but the probability of each square
being a mine is _not_ the same. While each individual square has the same
probability of being a mine _in isolation_ , the numbers leak information: eg.
if you have a set of numbers that could be fulfilled by one or two mines, it's
statistically more likely that the one-mine solution is correct.

One example: [https://math.stackexchange.com/questions/2511421/correct-
pro...](https://math.stackexchange.com/questions/2511421/correct-probability-
calculation-for-minesweeper)

~~~
woofie11
I liked the metagame here of guessing the guess which would make the rest of
the puzzle as solveable as possible.

P.S. Document how to flag mines in the text (ctrl-click)

~~~
bmn__
The game follows standard 'sweeper conventions. The user is expected to
already know them. LMB to reveal, RMB to mark, chord LRMB to complete from a
reveal.

~~~
woofie11
Assuming you're not on e.g. Mac with one mouse button. Or mobile, with touch.

~~~
wutbrodo
It extends pretty naturally, as both of those have left- and right-click
analogues. Long-press works fine on mobile.

~~~
woofie11
... and if you get to the very end of the map, with everything clear, and find
you need to flag the bombs, do you take the risk?

That's the user experience.

------
crb
See also:
[https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mine...](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mines.html)
\- no guessing ever required

[https://pwmarcz.pl/kaboom/](https://pwmarcz.pl/kaboom/) \- if you guess and
you could have deduced, you always die; if you can't deduce, you're always
safe.

------
okabat
Cool concept, matches how I want to play Mindsweeper (though others are
pointing out some interesting parts of the game that this approach removes).

Played through it once and was confused by why a bomb exploded. Can somebody
help me interpret? I'm especially having trouble figuring out what the dashes
are in this end-of-game explainer text. Take the space diagonally top-right
from the one flagged bomb (the asterix). This had a visible "1" on the board,
but is marked as a dash here.

Made a mine because the user clicked it when there was a safe space at 6, 2.
Can't be a mine because

    
    
      011--1?????????
      12*101?????????
      ??2211?????????
      ???????????????
      [6 rows clipped]
      + 29 mines left to find becomes
    
      011--1-????????
      12*101-????????
      ??2211*????????
      ????---????????
      [6 rows clipped]
      + 28 mines left to find)

~~~
inimino
Dashes seem to be places that might be a mine but also might not (because the
game has to reserve the right to move mines around depending on where you
click).

In this case it's telling you that 6 over (zero indexed) and 2 down (the spot
is marked with an asterisk in the second diagram) is safe, because of the
pattern of "ones" on the left edge.

------
k_sze
If you like this kind of game, you'll probably like the Hexcells series
([https://en.wikipedia.org/wiki/Hexcells](https://en.wikipedia.org/wiki/Hexcells)).

Every game is guaranteed to be solvable without guesswork. The deductions can
get a _lot_ more complicated than minesweeper. And it has some nice relaxing
background music.

I have all 3 games in the series and I beat all of them in campaign mode
without cheating (i.e. without watching other people do it on YouTube or
Twitch).

The third and last game in the series, "Hexcells Infinite", has an "infinite"
mode where it can generate 100,000,000 different starting boards.

~~~
schwammy
Hexcells Infinite is currently being updated, if you opt in to the beta
program on Steam you can try out the new puzzle generation algorithm. Infinite
mode is much more challenging now.

~~~
k_sze
I didn't know about that. Thanks for the heads-up!

------
miki123211
Fun fact. This game is accessible to screen reader users.

It's just a table we can navigate with standard table-navigation commands,
which advanced screen reader users are familiar with.

Unmarked fields are announced as "blank", the rest have either numbers or
emoji on them, which is read properly.

The hardest action is flagging a mine, but routing the mouse to where the
screen reader is, and then performing an actual right click seems to work.

------
justinnhli
I prefer the version by Magnus Hovland Hoff [1], which makes the guessing
explicit. There is a "Request Help" button that will let you reveal any square
you want - but only if there is no other way to progress without guessing
(otherwise you lose). This turns Minesweeper into a neat little puzzle game.

[1]:
[https://magnushoff.com/articles/minesweeper/](https://magnushoff.com/articles/minesweeper/)

------
loufe
I really enjoy this game. I got pretty addicted a couple years back and
decided that to truly "beat" the game, I'd learn c# and program a bot that
could beat it faster than I could. My handiwork is here:
[https://github.com/Loufe/GroundPenetratingRadar](https://github.com/Loufe/GroundPenetratingRadar)
. I'm not a career programmer so it's not great and the main solving uses
heuristics (but I intentionally avoided looking up how others programmed their
solver). Still a great, simple game.

------
Waterluvian
I thought the original Minesweeper’s first move wasn’t a risky guess because
the board was seeded after clicking the first spot?

Not that I played a ton but I don’t recall ever losing on the first click.

~~~
dmurray
It's actually seeded before the first click, but if you would have hit a mine,
the mine is moved to the first available empty spot in the top left (which
means the top left corner is slightly more likely than other squares to be a
mine).

~~~
dwd
Nice, so my typical starting move of clicking top left first was not only
safe, but also didn't leave me with a corner guess at the end.

------
jasonkester
The first game I played, it gave me a corner with a forced random choice:

    
    
        1 *
      | 1 3 *
      | ? ? * *
      | ? ? 3 2
      + - - -
    

I assume that's the exact situation it was written to avoid, right?

I clicked one of the 3 possibilities and it gave me a mine and ended the game.
By the description, I expected it would have created an alternate universe
where there was no mine in the square I chose.

So I guess it needs more work.

But I did like being able to click anywhere on an empty board and have it open
up a "safe" area. That was always the annoying thing about the original.

~~~
OscarCunningham
Do *s represent flags in this diagram? If so then you can proceed because the
1 and 3 at the top are both saturated, so the two cells below them are safe.

~~~
jasonkester
Ugh. I must have copied across wrong. I've closed the tab, so I can't go back
and look at the puzzle in question anymore, but the cell I clicked to get the
mine was the top right, so the upper-left "1" must not have been satisfied.

Sorry about that.

------
Gregam3
It's interesting I actually made a similar version of this called "quantum
immortal minesweeper" in which upon clicking a bomb it would check whether or
not you could calculate the bomb was there, if you could not, it would change
the position of the bomb to another possible location.

People ended up being confused by this idea, so I instead made a button that
they could click if they thought it was not possible to figure out the next
mine. It's a little bit janky but if anyone is interested you can check it out
here: qims.greg-mitten.dev

~~~
Miiko
A bit janky indeed - could not figure out how to actually play the game? any
hints? (in text, if you can, hate to watch instruction videos)

------
Jaruzel
Fancy a challenge? Join others solving this 1000x1000 board:

[http://mega-minesweeper.com/](http://mega-minesweeper.com/)

------
crvdgc
> More importantly, I would like to make the game recognise when there’s a
> forced guess _coming_ — currently if there’s a 50/50 chance in one corner of
> the grid that you’re clearly going to have to take eventually, you have to
> wait until that’s all there is. If you take the chance when there was a safe
> space available elsewhere, you’ll always lose.

Before you play, please note that this implementation changes everything.

In the conventional minesweeper, the best strategy is always take the guess
first. Since any further play won't increase the chance of correct guess, and
if you guess wrong, all the efforts are wasted. But here you are forced to
complete all determined safe moves first.

I find myself losing again and again, and finally noticed this rule.

------
simonbarker87
Downloaded Mineswifter yesterday:

[https://apps.apple.com/gb/app/mineswifter-
minesweeper/id1521...](https://apps.apple.com/gb/app/mineswifter-
minesweeper/id1521190195)

Nice iOS app that will never force you to guess. What’s more fun though is he
made the inverse: Evil Mineswifter - will always make you guess

[https://apps.apple.com/gb/app/evil-mineswifter-
minesweeper/i...](https://apps.apple.com/gb/app/evil-mineswifter-
minesweeper/id1523249883)

By far the best looking mine sweeper apps I’ve seen on iOS

------
haar
I somehow managed to break it
[https://share.getcloudapp.com/6quexyvk](https://share.getcloudapp.com/6quexyvk)

Clicking on any of the remaining spaces results in:

    
    
        Uncaught Error: what
          at LogicGrid.updateKnowledge (logic-grid.js:431)
          at LogicGrid.resolveCell (logic-grid.js:175)
          at LogicGrid.reveal (logic-grid.js:96)
          at HTMLElement.reveal (grid.js:111)
          at HTMLElement.<anonymous> (grid.js:61)

------
flacebo
I really like this version, especially that it makes sure you lose if you
guess, you can't get lucky. It definitely makes me rethink wether I have to
guess or not every time, and it makes me so happy to see a number when I do
instead of a mine.

This arrangement made it crash though:
[https://imgur.com/a/TDj7afQ](https://imgur.com/a/TDj7afQ)

Nothing happens if you click on any of the white squares. "Uncaught Error:
what"

------
muzani
I went ahead and played this without reading the description. I'm not sure if
it's just me, but it seems like the game starts with a lot of 1s and 2s, and a
few 3s, and later on, it's mostly 4s and 5s.

It's intriguing to see a game change by how the players play - like if there
was a 50% chance of losing, you'll either have a 100% chance of winning or
losing. Something like XCOM can just change difficulty by making a 'default
lose' difficulty or 'default win' on easier ones.

------
exclipy
Love it. It feels like a simulation of many-worlds quantum mechanics. Whenever
there's no clear next move, the board is in a quantum superposition. The
waveform partially collapses whenever there's a definite choice, but I
generally want to avoid that as long as possible because as long as it's not
collapsed (there are multiple choices), I can enjoy the quantum immortality of
clicking anywhere.

------
grumple
Doesn't this require a guess, and should therefore be safe?

Either the 1st and 3rd or 2nd and 4th available spaces would satisfy the
board.

[https://imgur.com/ZoyjCBZ](https://imgur.com/ZoyjCBZ)

I noticed in the html there's a "knownSafe" class which was populated
periodically throughout the game. It did not apply to any of the squares in
question, yet when I guessed, I lost.

~~~
Miiko
Yes, if there're 2 mines left, that would require a guess. But not so if only
1 mine is left (or 3 of them)

------
kristopolous
Pretty sure there's bugs.
[http://9ol.es/unsolvable.png](http://9ol.es/unsolvable.png) I don't think any
more logical deductions can be made here.

edit 1: got past it presuming that more complex cases weren't being accounted
for and yes, there's clearly some cases not being considered.

edit 2: I can now proceed pretty reliably working around that hole.

~~~
ghusbands
When you can't make logical deductions, the game lets you take a guess and
rearranges the hidden mines so that you don't lose. It's not guaranteeing that
you can solve the whole thing with only logical deductions.

(If you guess when you shouldn't, then it instead rearranges the hidden mines
to make you lose.)

------
mrfusion
Offshoot. Are there any always solvable solitaire games out there? I couldn’t
find one on the App Store last time I checked.

~~~
LeonB
16 years ago, a man named Eric Sink decided to document the process of
creating, marketing and selling a small piece of software he had always wanted
to build, "Winnable Solitaire" which is, as you describe, always solvable.

His series of articles coined the term "Micro-ISV" which was a once-common
term for a small software company with approximately one employee. A category
that is now covered under "Indie" developers.

Here's the article that started it:

[https://ericsink.com/entries/Announcing_Winnable_Solit.html](https://ericsink.com/entries/Announcing_Winnable_Solit.html)

(He didn't end up selling many copies, but we all learned a lot on the
journey, it was very interesting at the time.)

------
FartyMcFarter
This is a great idea!

However I don't understand what happened here:
[https://imgur.com/1R3BROM](https://imgur.com/1R3BROM)

The game claims that the "2 at 4, 0 is done" \- in what sense is it "done"? I
hadn't marked two mines next to it yet.

~~~
coder543
It’s “done” because the numbers around it leave no option to move its mines
around. Since the mine locations have been fixed in that particular part of
the game board, you’re guaranteed that the square at 3,0 is safe. Instead, you
clicked on a square you couldn’t possibly know was safe (in the middle of
nowhere) when there was at least one square that was definitely known to be
safe, so the game punished you for it, exactly as promised.

I played a few rounds on an iPad, so I had no way to mark mines, and the game
works just fine. Marking mines has always been for your benefit, to make it
easier to remember where the mines are.

~~~
FartyMcFarter
Thanks, I think the problem was indeed the way I was interpreting the output!

------
wruza
After playing a couple of games with three+ lucky strikes, there comes very
uneasy feeling that you exhausted your luck for today at least twice. This
game will drive you away from reality if played too much. Maybe quantum gods
can play this way, but not mere mortals.

------
novaleaf
Interesting, but you can make the game crash (firefox) if you keep "reaching"
out when you have ambiguous mine placements. I'm guessing it has to keep
rearranging until it finds a valid board placement.

------
Kwantuum
Crashed with "Error: Infinite loop suspected while learning"

------
cobalt
Heh, i happened to have just written a minesweeper clone
[https://desu.io/minesweeper.html](https://desu.io/minesweeper.html)

------
WatchDog
This runs really slowly, surprising for such a simple game, must be using some
super inefficient algorithms for generating the mine placement.

------
jujodi
Love it. Can you please make it so the missed safe space is highlighted after
the loss?

------
davidtranjs
Since this website only has one narrow column, the reading experience on this
is smooth

~~~
KKPMW
Weird, for me it's the opposite. I would prefer it to be 2.5x wider.

------
rjeli
firefox esr (68) breaks on the optional chaining :(

------
runawaybottle
Tangent:

If I don’t like Minesweeper or Chess, am I still a smart? I really think these
games stink.

Need to know guys.

~~~
erulabs
“Smart” isn’t a useful concept, or identity. I strongly recommend doing away
with mentally picturing people as various gradients of smart. What matters in
life is effort. Of course not enjoying chess has no relation to intelligence.

If you give it some time, chess is an extremely rewarding activity. I don’t
meditate, but chess and cycling are quite close. It’s a hard departure from
the speed of modern life.

One comment I will make, is that expressing ones dislike of an activity,
rather than either staying silent or joining, is certainly not a good sign for
being “a smart” though. Life is too short to be negative!

~~~
NateEag
Some activities are destructive.

One has a responsibility to complain about those.

