If you're around my age, you'll remember Windows Minesweeper. It was one of several games included with Windows back in the day to try to train users in the use of the then-newfangled ‘mouse’. It doesn’t come with Windows any more. You can get Minesweeper for Windows 10, but the developers have… made some choices.
If you haven’t played it, Minesweeper is a grid of squares, some of which have mines underneath, and your job is to click on all the others. If you click on a mine, you lose. You can also flag squares with the right mouse button to record that you think they are a mine. Your only clue as to where the mines are is that when you click on a square that isn’t a mine, it tells you how many of the eight adjacent squares are mines. If that number is zero, the game automatically clicks on all the adjacent squares for you so you can get a little patch to start from. Hopefully that will include a 1 in a tight corner so there’s only one place its mine can go, and that will complete a nearby 1 so you can get some more numbers to work from, eventually leading you to complete the game.
If you’re not so lucky, you might not get a solvable board. A common situation is that you get down to the last two spaces and you know one of them is a mine but there’s no way to predict which one. You have to guess. Heads you win, tails you just wasted 10 minutes carefully clearing the whole board only to be scuppered by a forced guess.
There’s a version of Minesweeper that guarantees you never have to guess, which is very nice. It neatly solves the problem of unwinnable games, and while I find that always knowing you can make a deduction can be too big a clue, in regular Minesweeper you could even lose straight off the bat — you have to guess the first move and maybe it’ll be a mine. In this case, Windows Minesweeper quietly chooses a different arrangement of mines and pretends like you got lucky after all — but it doesn’t do that if you’re stuck at the end.
So what if we went further? I wanted to build a version of Minesweeper where you will never be penalised when forced to guess. Any time there simply isn’t enough information to deduce a safe move, we’ll pull Windows’s trick and quietly rearrange the mines so you don’t get penalised.
But since that would on its own make the game too easy, the flip side of this coin is that if you can in theory deduce a safe move but guess anyway, the code will quietly rearrange the mines so that your unnecessary risk backfires and you lose.
I sort-of managed this goal: the game I built worked in most cases, but the moment any real number of people started playing it the bugs started to appear. It became an actual burden trying to keep on top of it. Luckily, kind of, in one of the discussion threads I found a link to another person who'd had the same idea and built a much more robust version. That’s also JS-based and open-source, so I could go and copy its tricks, but I have no real interest in duplicating their work when I can link to it instead. So, if you absolutely want to play my broken version you can, but I strongly recommend you instead play
Paweł Marczewski’s KaboomAn improvement I would like to make to both versino is 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.
If I was feeling especially mean, I could insist that the player choose the square with the best odds of being safe, rather than simply judging whether or not each square is theoretically knowable. But I think that would be taking things too far.