Sunday, July 25, 2010

Minesweeper, or My Personal Brand of Nerdiness

Since early June, I've now played 1000 games of Minesweeper on my new laptop on the expert difficulty level. That's an average of about 20 games per day. And that doesn't count the games I've played while on conference calls at work, during each of which I can probably get through 20 games easy. So yes, I am addicted.

But I love it. I love Minesweeper because it's a wonderfully maddening mix of logic and luck, NP-completeness and silliness, pointlessness and the opportunity to win a million dollars.

And it's an addiction of choice: I blogged once before about giving up Minesweeper for a year. It wasn't too hard, though I did pick up a decent Freecell habit (laced with occasional Solitaire) to compensate. And once New Year's Eve was here, I was right back in it. The point is: I really can quit any time I want.

While I like to see how fast I can beat a board, my main goal is to win. As often as possible. So if I get in a complicated situation, I'll take time to stop and think about it. I love the never-ending new situations that come up. To the right is a recent finish
that I liked a lot. There are two right answers for which mine to click, and two wrong answers; the proof is left as an exercise for the reader.

Apparently, I'm in a minority in caring about winning percentage. In the (minuscule) world of Minesweeper enthusiasts, it seems like the decision to keep track of win percentage is ridiculed in favor of obscure stats that tell you how fast you can go. I certainly couldn't find anyone via Google who kept track of best win percentages. But I am quite proud of my 33% (339 wins in 1000 games) on expert. (I was this close to getting to a 34% winning percentage, I'll have you know, but it just wasn't meant to be.) But fortunately the two goals--speed and winning percentage--aren't completely mutually exclusive. My best time is 80 seconds, which ain't too shabby.

It would be interesting to try to figure out what the maximum winning percentage is in the limit. There are a lot of games that come down to guessing, but I've been able to keep steady at about 33% for a good while, so I feel pretty comfortable proposing that as a lower bound. And while I certainly don't make optimum moves all the time, and human error creeps in for sure, I don't think a winning percentage too much higher than that is feasible in the long term. Maybe low 40's. That will be my first question when I get to heaven.

And thus concludes my random celebration of a beyond-meaningless milestone. Please share any Minesweeper anecdotes or thoughts on obscure addictions.

31 comments:

  1. Nice post. I dont play as much as you but I enjoy keeping my win %age high (I'm at 29% at the moment), but my fastest time is only 162 secs.

    ReplyDelete
  2. Nice! I can now report that my win percentage is 36% and my best time has dropped to 69. Keep at it!

    ReplyDelete
  3. Does over 8000 games make me a junkie? My win %age is at 30.49 and best time of 163. Was at 29% for a long time then started concentrating a bit more. Maybe I should reset the stats but just the thought causes panic.

    ReplyDelete
  4. I think that's enough for a pretty strong showing of junkie status, yes! :) Solid win percentage, too.

    Since writing this original post, I've now played another 16,472 games on expert. Yikes! I totally understand about not wanting to reset the stats; perhaps you could do like me and actually keep track of month-by-month statistics (see my spreadsheet, for example).

    ReplyDelete
  5. Just played my 500th expert game (at least on this computer), with 108 wins, best time 102. I thought that was good until I read this, guess there's always room for improvement!

    ReplyDelete
  6. Solid, Anon! I'm mostly just glad there are more people who care about win percentage at all! And I'm sure with practice you'll get even better :)

    ReplyDelete
  7. I simply don't believe you folks. My winning percentage is 3 percent! Okay, what's the trick in getting to 34%? I need to know.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. I'm with you, Rich. I don't believe them either. My best is 124 and my average is 9%. My wins are almost always under 200. Usually in the 160's to 180'S. Too much guessing required to get 34%.

      Delete
  8. Rich, my trick is always taking my time to get the right one, not just going straight for best time, and also just playing for years and using logic to be able to deduce where mines are in more and more complex situations. Don't know if that's helpful, but believe me, it's possible! Good luck!

    ReplyDelete
  9. I stick to the simple game because it doesn’t last as long, and I’m shooting 68%. I like the Win7 version better than earlier versions.
    :D

    ReplyDelete
  10. Nice! My beginner win percentage is currently at 86%. Sometimes I'm nostalgic for the earlier versions of Minesweeper, but I agree that the Windows 7 version is the best!

    ReplyDelete
  11. My winning Percentage of the last 50/50 mine guess is only about 25%. Probably would not fare well in Vegas. I have been close to 17.30 percent for the last 1000 of my 4000 on Minesweeper Q for IPad
    can,t seem to improve in the last two months

    ReplyDelete
  12. Grrrr, 30% win percentage and best time of 112. Been trying SO hard to crack double digits for time, but it is quite elusive. Going to keep trying!

    Nice post :)

    ReplyDelete
  13. Really nice post. Happy to know that I'm not the only one wasting time with minesweeper. 33% win percent and 26,000 games played so far :)

    ReplyDelete
  14. Nice, Anon! I'm now over 24,000 games, and my win percentage has snuck up to 36%--Minesweeper really is a great game! :)

    ReplyDelete
  15. I'm at 18% of 300 games on my current computer. I played hundreds on other machines but don't know the statistics, I don't think they kept win%. If you can get to 33% I guess about half my losses were avoidable, which sounds about right. 24000 games at 4 minutes each is one year of 40 hours a week with a 2 week vacation. Wow.

    ReplyDelete
  16. Sadly I've gotten a new computer and it's a Mac. There aren't really any good Minesweeper programs I've found for it yet, so my statistics might come to a bit of an end :(

    ReplyDelete
  17. Jot down your stats, add them to your new game's stats to keep records maybe?

    Anyhow, I'm creating a bot to play the minesweeper on my computer. It's not optimal yet, but getting close. All possible logical solutions are implemented, but some advancements still needed in it's guessing algorithm. It's managed 40% on expert over 3000 games. As guessed at in the article, it seems low 40s is about the limit. Possibly up to 45%.

    ReplyDelete
  18. Unfortunately, no Mac program I've found actually keeps track of how many games have been played and won--they just record fastest times :(

    And I'd love to see the code, Stuart! I've often kicked around the idea of creating an AI for playing Minesweeper, but never actually did anything about it. Well done!

    ReplyDelete
  19. I've made some more improvements and it's running around 43%. My intention is to fully implement the techniques detailed here: http://www.nothings.org/games/minesweeper/

    ATM, I'm still not accounting for the unencountered mines properly in the probabilities. Once this is done, I'm expecting 45%+.

    I've programmed for many years, but only just getting into c++, the code isn't pretty, but I'm willing to post it when it's all working. Also, it occasionally encounters situations that are so complex that it gets too slow and memory consuming, and eventually crashes, about 1 in 500 games.

    Here's a screenshot of my latest run. http://i.imgur.com/PTxeTMF.jpg

    ReplyDelete
  20. Cool, I'll be sure to check back there, and if you remember drop a comment here to remind me too!

    ReplyDelete
  21. Wow, your scores are very impressive.
    Would you mind telling me the answer to "There are two right answers for which mine to click, and two wrong answers; the proof is left as an exercise for the reader." and explain your reasoning? I can't figure it out, and it seems to me that each remaining square should have an equal probability of being a mine...

    ReplyDelete
  22. Anonymous: sure thing--I think close to 4 years is enough time that spoilers shouldn't be a problem anymore! :)

    You're half right: all of the squares left are equally likely to be mines--but it's all about the situation that comes up *after* you click on one of them. The "right" answers are the two on the far right. Clicking on either of them means you have a 75% chance of winning (i.e., if you survive the first click you won't have to guess anymore about where the mine is, you're guaranteed to win if you play it right). If you click on the left or middle squares on the bottom, though, you have only a 50% chance of winning the game even if you survive your first click (i.e., some more guessing will be needed).

    Explanation: as I said above, all the four remaining squares have an equal probability that they're the mine. So whichever you click on, you run a 25% risk of dying immediately. Nothing to do there. But let's analyze the situation, one by one, when you click on each of the squares and *survive*.

    Bottom left square: now there's a 1/3 chance that the middle bottom square is the mine (remember, we're assuming we didn't die when we clicked the bottom left square, so now the three remaining squares are equally likely to contain the last mine), in which case this bottom left square you clicked on will be a 4, tipping you off to the location of the last mine. Then you can click the bottom right and top right squares and win. In other words, after clicking this square and surviving you have a 1/3 chance of being in a situation where you know the answer with 100% certainty. However, 2/3 of the time the mine will be in either the bottom right or top right square. In that case, this bottom left square you clicked on will be a three, letting you know the bottom middle square isn't the mine but forcing you to guess which of the remaining two squares on the bottom right is a mine, with a 50% probability of guessing right. In other words, 2/3 of the time you will be in a situation where you have a 50% chance of winning. So to sum up: 1/3 of the time you will win 100% of the time (when the mine is in the bottom middle square) and 2/3 of the time you will win 50% of the time (when the mine is in either of the far right squares). Adding that up, you will win 66% of the time if you click the bottom left square and survive that initial click. And since you only survive that initial click 75% of the time, the total probability of winning if you guess this square is 3/4*2/3=1/2.

    Bottom middle square: no matter where the last mine is, you'll see a 2 in this square, so no new clues as to the mine's location. If you were to click the bottom left square, there's a 2/3 chance you'll survive, but then you're left with a 50/50 shot on the far right squares. So that would be a bad choice: you'd only have a 1/3 chance of winning. The better choice would be to click either of the far right squares after clicking the bottom middle one and surviving: you'll survive that second click 2/3 of the time, and you'll know the location of the mine for sure if you do (hopefully you can see why--think about it just a bit and it should be clear). In sum, then, if you play smart after clicking the bottom middle square and surviving (by clicking either of the squares on the right), you'll have a 2/3 chance of being in a situation where you win 100% of the time. Again, though, you only survive the initial click 3/4 of the time, yielding a total probability of winning of 50% if you click this square. (And if you play stupidly and click the bottom left square second, your total chance of winning drops down to 25%.)

    [rest of analysis in next comment because apparently blogger comments can't be longer than 4,096 characters??!?!?]

    ReplyDelete
  23. [carrying on, *grumble grumble*]

    Bottom right square: now 1/3 of the time the mine will be in the bottom left square, thus making this bottom right square a 0 (or blank) and automatically opening the top right square to reveal its 2. You win, no more clicks! But of course, 2/3 of the time the mine will either be the bottom middle square or the top right square, making this bottom right square a 1. Rather than try to guess between those two squares immediately, now you would click on the bottom left square which you know is *not* a mine. Whether that's also a 1 or a blank will tell you for sure where the last mine is. In other words, if you play smart, there's no need to guess anymore if you survive the initial click in this situation: your only risk is dying 25% of the time when you don't survive that click. Win percentage here is thus 75%.

    Top right square: very analogous reasoning as with the bottom right square. If it's a 2, you know the mine is in the bottom left; uncover the blank in the bottom right and win! If the tope right square is a 3, that means either the bottom right or bottom middle square contains the mine; click the bottom left square to get the info necessary to determine that without any guesswork. Again, if you survive the initial click, you are guaranteed to win with smart play. Overall win probability if you guess this square: 75%.

    Phew, sorry that's a bit long. Hope it was interesting, though (and let me know if anything I said wasn't clear!). I really do enjoy that kind of weirdly in-depth analysis of Minesweeper endgames!

    ReplyDelete
  24. That was a great explanation! I really appreciate your effort in writing this up and your quick reply. Thanks! Hopefully I'll be able to elevate my minesweeper scores with this sort of analysis in mind.

    ReplyDelete
  25. 36% is very nice. I am around 30.3% after 870 games although I guess I would be a couple of percentage points higher if not for the occasional mis-click late at night. Once you have mastered all the common patterns, it gets harder since you need to start evaluating probabilities and that can be time-consuming.

    P.S. My best time is only 146 seconds. My wrists are not what they used to be and I haven't mastered the "jump behind enemy lines" technique yet.

    ReplyDelete
  26. An online multiplayer mode was definitely true on my TODO list for this game. Infact, I was more into MSN on the flags for a while, but hated that it was still offline, and thus began this project.
    how to play minesweeper like a pro

    ReplyDelete