Live data from Hacker News

Making Explainable Minesweeper

sublevelgames.github.io

11–20 of 44 posts

Re: Making Explainable Minesweeper

#11

Simon Tatham's Puzzles app has a minesweeper version that both A) generates on first click so you are guaranteed to never hit a mine on the first click and B) every board is 100% solvable with no need to guess. I have no idea what method it uses. I believe that _every_ puzzle in it is 100% solvable with no need to guess. It's also add free and completely local. It's a great app for anyone who likes puzzles on their p…

I looked at the code for this once. It's sort of a hack. It generates a random puzzle, tries to solve it with a deterministic backtracking(IIRC) solver that detects situations where it's stuck. If it is stuck, it shifts some mines around in the place where the solver got stuck, according to some heuristics, and keeps solving. It keeps doing this until the entire puzzle has been solved, verifying that the puzzle can be solved without any guesswork.

I will second the recommendation. As someone who's wasted too many hours on minesweeper, it radically changes the game. Because I know there's a logical solution, I'm able to find patterns that I never found in the original, because I'd often assume it was just one of those guesswork situations. It's similar to how chess puzzles are easier than an equivalent position during a game. Because you know there's a neat solution, you're more willing to put in the legwork of searching for it. Learned a lot about the game simply by playing Simon's version.

Re: Making Explainable Minesweeper

#12

Simon Tatham's Puzzles app has a minesweeper version that both A) generates on first click so you are guaranteed to never hit a mine on the first click and B) every board is 100% solvable with no need to guess. I have no idea what method it uses. I believe that _every_ puzzle in it is 100% solvable with no need to guess. It's also add free and completely local. It's a great app for anyone who likes puzzles on their p…

> anyone who likes puzzles on their phone

it's also available on windows and android - very good.

Re: Making Explainable Minesweeper

#13
post #12

Simon Tatham's Puzzles app has a minesweeper version that both A) generates on first click so you are guaranteed to never hit a mine on the first click and B) every board is 100% solvable with no need to guess. I have no idea what method it uses. I believe that _every_ puzzle in it is 100% solvable with no need to guess. It's also add free and completely local. It's a great app for anyone who likes puzzles on their p…

> anyone who likes puzzles on their phone it's also available on windows and android - very good.

It's also available in HTML/js/wasm, so practically all networked devices:

https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/mine...

However, the minesweeper puzzle is the one that causes a big wart in the API, which part of me has wanted to refactor for years. (it's for the reason given in GP comment, the puzzle isn't generated until first click; it's the only one with this behavior and could be reworked to have the clicked area be a parameter to creation, but then it would have a slightly quirky main()-equivalent function.. IMO worth it for the cleaner API)

Simon's puzzles have overall been an inspiration, some good reading if you're into algorithms and applied graph theory and don't mind that it's in C.

Re: Making Explainable Minesweeper

#16
post #15

The first example is not ambiguous. You can solve it starting at the bottom left

Do you mean the first screenshot of Windows Minesweeper (the left half of ems02.png)?

Could you explain how? I haven't played a huge amount of Minesweeper, but I can't see how that can be solved without risk/luck.

Re: Making Explainable Minesweeper

#17
post #16
post #15

The first example is not ambiguous. You can solve it starting at the bottom left

Do you mean the first screenshot of Windows Minesweeper (the left half of ems02.png)? Could you explain how? I haven't played a huge amount of Minesweeper, but I can't see how that can be solved without risk/luck.

On the left side, the 1 at the bottom means that the third from the bottom must be a mine (since the 2 can't point to the bottom two). The 1 touching that mine then excludes a bunch more, and that's sufficient to solve the rest.

Re: Making Explainable Minesweeper

#18
post #17
post #16

Earlier quoted context omitted.

Do you mean the first screenshot of Windows Minesweeper (the left half of ems02.png)? Could you explain how? I haven't played a huge amount of Minesweeper, but I can't see how that can be solved without risk/luck.

On the left side, the 1 at the bottom means that the third from the bottom must be a mine (since the 2 can't point to the bottom two). The 1 touching that mine then excludes a bunch more, and that's sufficient to solve the rest.

Thanks - I finally saw it just as you replied. I agree that it looks like that mine layout is the only possible one which satisfies the vertical 1,2,1 boxes. I need to play more :)

Re: Making Explainable Minesweeper

#19
Nice article, I wanted to point out though that your example board at the beginning has no such ambiguities or 50/50's. Here's a recreation of it so you can see for yourself, if you open it up from the bottom left as you did, the 1 2 1 leads to the board being solved rather quickly:

https://agustinfitipaldi.com/minesweeper?seed=eyJ3aWR0aCI6OS...

Post reply on HN