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.
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.
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?
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.
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 -
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.
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.
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.
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.
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:
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 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.
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`
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