Skip to content

Comment on Solving Minesweeper and making it better (2015)parent

Comments

Thank you, that's a nice compliment :)

My inspiration for the format is Red Blob Games (https://www.redblobgames.com/), truly a marvel of interactive writing. (https://www.redblobgames.com/grids/hexagons/ is my all-time favorite)

Any idea why the AI in your minesweeper sometimes doesn't declare it to be a local consideration that the one uncleared square adjacent to a 1 marker must be a mine? It's a funny hole in the final version of the game. I can't characterize exactly when it happens, but it seems related to cases when the seven non-mine revealed squares around the 1 have numbers in them.

My only other complaint is that it sometimes tries far too hard to derive facts in cases where a higher-level consideration makes it obvious there are none to be found. Try starting by clicking on 6 wildly disconnected locations, and getting a number on all of them. Requesting help at that point is very, very slow.

Regardless, this is a lot of fun, and actually requires some new reasoning. Most minesweeper variants just use the same set of 10 rules I memorized 20 years ago. It's nice to stretch instead.

Any idea why…

No idea. It's a bug that I haven't been able to straighten out.

My only other complaint…

Sure. As noted in the article, this is unescapable. For the situation you describe it would be possible to segment the constrained squares into distinct "islands" and then consider these independently of each other, reducing the complexity of the solver in these situations.

But it is proven that it is always possible to get into degenerate situations which no solver can ever hope to figure out.

I think my implementation is sufficient to demonstrate the concept and illustrate the article :)

Red Blob Games is incredible! Thanks for share. I hadn't seen it before. I enjoyed Polygonal Map Generation (http://www-cs-students.stanford.edu/~amitp/game-programming/...) most so far.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.