Mindsweeper — a principled take on minesweeper written in Rust for the browser

166 points AlexBuz

Hey all. I wanted to share a game that I made over the summer: https://alexbuz.github.io/mindsweeper/

It's an implementation of minesweeper with some unique features as well as some opinionated choices about what minesweeper fundamentally should be. The README on my GitHub repo explains this in more detail, but essentially my goal was to eliminate the luck aspects of the game without forcing a specific first click location and without sacrificing performance, all the while ensuring that every viable mine arrangement is equally probable. This took quite a bit of optimization to achieve—and I'm sure more is possible—but I'm happy with its current state so I figured I'd share it now that I'm on break from school for a few weeks and had time to clean it up a bit.

In Mindsweeper, if you click on a tile that can be a mine (i.e., nonzero probability), then mines will be secretly moved to ensure that that the tile you clicked is in fact a mine, causing you to lose. Thus, the only way to win is through logical deduction, not guessing (unless you disable the guess punishment feature). And in the unfortunate event that you do click on a mine, you'll get a color-coded analysis about what you did wrong and what you should've done. Hover over any tile to see this explained in words.

Another unique feature of my game is called autopilot mode, and it effectively skips past the easy parts of the game by auto-flagging tiles that are clearly mines and auto-revealing tiles that are clearly safe, so you can focus on the actual logical deduction.

There's also a feature called mindless mode, and it does the opposite of autopilot, ensuring the game is easy from start to finish. These modes are mutually exclusive since autopilot would instantly win any mindless-mode game.

If you have any feedback, questions, or bugs to report, I'd love to hear them!

Edit: added explanation of guess punishment feature