5 ms·
Minesweeper thermodynamics
- grozmovoi 1y agonow this is time well spent
- modeless 1y agoOnly tangentially related, but Dragonsweeper is an interesting extension of minesweeper where you have hit points and the "mines" have attack values. I got a better appreciation for the mechanics of minesweeper by playing it; it's surprisingly deep. https://danielben.itch.io/dragonsweeper https://danielben.itch.io/dragonsweeper
- cuber_messenger 1y agoThis is actually a quite interesting game, I played it for like 2 hours when I saw it first time.
- mamonoleechi 1y agoSimilar game: Mamono Sweeper https://duckduckgo.com/?q=mamono+sweeper https://duckduckgo.com/?q=mamono+sweeper (mamono is monster in japanese) it's a RPG variant of Minesweeper, where you have life points, level up and fight against monster (mines) that gives you xp once killed (you loose HP if you fight a monster higher lvl than you). it's a flash game, that had an android release at some point (it was removed from the store for some reasons)
- gregfjohnson 1y agoI hacked up a version of minesweeper that was “forgiving:” if there was no selection that was provably safe, it gave you a safe move. If you picked any square that was not provably a bomb, it would not be a bomb. Typically, as long as you don’t select a number of bombs equal to the number of squares , your first move is safe. I just extended that for the whole game. If you select N-1 bombs, you always win on the first move..
- abetusk 1y agoHa! This is NP-Complete, no? In practice, it probably doesn't matter but my bet is that there are some configurations that will take exponential time to see if the player should be "forgiven".
- alain_gilbert 1y agoI made winsweeper, which will move the mine if there is no safe tile left for you to discover. https://github.com/alaingilbert/winsweeper https://github.com/alaingilbert/winsweeper
- mcmoor 1y agoYeah I've debugged another game that attempted this and this system resulted in the game lagging as hard sometimes.
- OscarCunningham 1y agoYeah, it's NP-complete to decide whether a cell in Minesweeper must be a mine: https://logic.pku.edu.cn/ann_attachments/np.pdf https://logic.pku.edu.cn/ann_attachments/np.pdf. In practice I suspect a SAT solver would make quick work of the positions that actually appear in games.
- maggit 1y agoThere was a Minesweeper on here that used a SAT solver, but I cannot find it at the moment. As I recall, it never had any issue with resolving the board quickly. I think it dynamically resolved where the mines would be as you played the game, and if you clicked a square that could be a mine, it would be a mine, except, I believe, when there were no open squares that were safe. (Edit: Here it is! https://pwmarcz.pl/kaboom/ https://pwmarcz.pl/kaboom/ And the write-up: https://pwmarcz.pl/blog/kaboom/ https://pwmarcz.pl/blog/kaboom/ ) This is similar in spirit to my take on the game: https://magnushoff.com/articles/minesweeper/ https://magnushoff.com/articles/minesweeper/ Unfortunately, not being familiar with SAT solvers, my implementation can grind to a halt in some configurations :)
- kens 1y agoThe article discusses Boltzmann's formula exp(-E/kT). I was recently looking at the same formula in the context of semiconductors and I realized that Boltzmann's constant k is only needed because temperature uses bad units. If we measured temperature in energy instead of degrees, then Boltzmann's constant drops out. For instance, you could express room temperature as 25 meV (milli electron volts) or 2444 joules/mole and the constant disappears. Likewise, the constant in the ideal gas law disappears if you measure temperature as energy rather than degrees Kelvin. In other words, degrees Kelvin is a made-up unit that should be abandoned. (I'm not sure I believe this, but I don't see a flaw.)
- donovanr 1y agoYes! Units are up to you (with some constraints)! Physicists do this in practice a lot: https://en.wikipedia.org/wiki/Natural_units https://en.wikipedia.org/wiki/Natural_units
- cperciva 1y agoPhysicists also sometimes deal with inverse temperature aka "coldness".
- jabl 1y agoThis is to an extent a party trick to befuddle lay people. Physicists know perfectly well that temperature is not a well-defined concept out of equilibrium. And when in a population inversion experiment when "temperature" is determined to be negative (or "beyond infinite" if you will) it arises because for a short while you have a non-Boltzmannian distribution.
- OscarCunningham 1y agoI don't think they were talking about negative temperature, they just mean that sometimes the convenient quantity to work with is β = 1/T.
- deleted 1y ago[deleted]
- RA2lover 1y agoHow could this be extended to a negative bomb space like in Bombe (https://store.steampowered.com/app/2262930/Bombe/ https://store.steampowered.com/app/2262930/Bombe/)?
- oerpli 1y agoWhat would the winrate of a bot doing these calculations be compared to one that doesn't?
- OscarCunningham 1y agoThe bot at https://mrgris.com/projects/minesweepr/ https://mrgris.com/projects/minesweepr/ does these calculations, and has a winrate of 37.8% on expert. I don't know what a more naive bot would achieve.
- senfiaj 1y agoIs this better compared to an actual expert human?
- OscarCunningham 1y agoI think the human experts mostly care about speed rather than their average solve percentage. If they're forced to guess then they can just restart if they get it wrong.
- deleted 1y ago[deleted]
- GistNoesis 1y agoMinesweeper is a probabilistic game, that's why you should use probabilistic tools to solve it. For example you can use a particle filter to approximate the distribution of mines. Every time you obtain new information you update the filter so that only distributions compatible with constraints remain. Once you have an approximation to the distribution of mines you can calculate the probability of each spot being a mine. You can also calculate statistical indicator like the Information Gain of each action. A good strategy is therefore to play low mine probability with highest information gain. But there is a trade-off, when the mine probability is non-zero. So you need to look-ahead. Fortunately thanks to the mine distribution approximation you can also simulate any actions and their consequences, because you can use your approximation of the distribution to predict which number will be revealed upon a click. So an even better strategy is to unroll the game tree for the best few candidate moves based on some heuristics, and calculate the cost gain probabilities after a few moves.
- gus_massa 1y agoMost of the times Minesweeper is deterministic, and you can just think and get an empty spot. From time to time, you are unlucky and has to guess. A few years ago, I modified the version of minesweeper in the "Games" collection of Racket to get more mines per board and get more hard cases. (I added the trick to autoopen the squares that have enough flags around, so it solved all the easy cases and it was more fun. I never upstreamed the changes...) I like Dragonsweeper (discussed in a sibling comment) because it has a more clear probability and information tradeoff.
- AtlasBarfed 1y agoThere are other squares to click on on the other side of that "probability wall" that might reveal more info at a lesser danger percentage.
- OscarCunningham 1y agoYes, (original author here) in fact all the cells outside this region have an even better safety probability of 80.1%. I think the best move might be to start fresh in a new corner.
- modeless 1y agoHmm, but how likely are clicks on random squares to reveal more safe clicks? Seems likely that even if you hit a safe square you might still not have any safe moves. The goal ought to be to create more safe moves for the next turn, to reduce your chance of dying over the whole game, not just in the current turn. I wonder what that analysis would look like.
- AtlasBarfed 1y agoIn the given example, if you click two squares down from the 3 in the 2-3-4 at the bottom, if you get a 3 it may reveal a 3 that will open up all the spaces around it. Which in the process may reveal what kind of 4 it is. If you click on the square three to the right of the top 1, if that shows a 1, then a lot of surrounding squares can be revealed and again you may "walk up" to a more definitive mapping of the bombs. I'm not even sure those are the optimal examples, but when I minesweeper it was for speed. The real advantage, especially at this stage of the puzzle, is that those squares might quickly lead to another big field to be revealed.
- todorov84 1y agoInterestingly, the main problem with Minesweeper is that is a game of chance (so the approach discussed in the article is very appropriate). For a minesweeper variant purely based on logic, I highly recommend the game Tametsi. It has 160 handcrafted levels, and some have very interesting geometrical arrangements. I have logged over 100 hours in this game.
- kej 1y agoTametsi is amazing. I also like the drawing mode, and I think it should be added to the Steam overlay so that you could use it in every game. The HexCells series is also worth a look for anyone interested in pure logic Minesweeper.
- owenbrown 1y agoThe article makes a serious math error early on. The author’s math considers how mines would be distributed if mines were distributed to the empty squares after reaching that board state. This is wrong. This is classic Monty Hall Problem. The author is doing the equivalent of saying “there are two doors left, so the odds are 50 / 50 that the prize is behind either door. It invalidates all of the numbers after this point.
- OscarCunningham 1y agoI don't agree (I'm the author). The difference is that Monty knows which of the doors the car is behind and deliberately avoids it, thereby giving away information about where the car is. Whereas in Minesweeper we've just blindly stumbled across a situation where we have to guess. It would be like if every show Monty always revealed a random door. Sometimes he would reveal the car and the game would end immediately. In the cases when he didn't reveal the car it really would be 50/50 between the remaining two doors.
- dako2117 1y agoI agree, its definitely not Monty Hall, and IDK why they are so confident.
- kqr 1y agoAt first I thought the "equal probability assumption" wasn't too bad an approximation, but it has an average Brier score of 0.217. Much worse than I thought.