Live data from Hacker News

Minesweeper thermodynamics

oscarcunningham.com

21–30 of 65 posts

Re: Minesweeper thermodynamics

#21

I 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 firs…

Prior art: https://news.ycombinator.com/item?id=21883875

Re: Minesweeper thermodynamics

#22
post #5

The 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…

Another example that shows up in mid school is how we measure angle.

Like the Greeks and Babylonians we usually measure it in degrees. Later around 18th century radians started getting used, especially in power series expansions.

In India, historically, angle was measured in the units of length (for a standardized circle). That made functions like sin be a function from length to length.

Re: Minesweeper thermodynamics

#23
post #5

The 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…

This is true of any units. A lot of physicists say things like "set c=1", does that mean that meters/feet are bad units and we should instead be measuring our height in fractions of c? That sounds inconvenient to me.

I just calculated that I’m about 6.24 nanolightseconds. A nanolightsecond is just over a foot, so at least Americans should easily get use to the unit.

Re: Minesweeper thermodynamics

#24
post #6

Earlier quoted context omitted.

Ha! 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".

Yeah, it's NP-complete to decide whether a cell in Minesweeper must be a mine: 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.

There 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/ And the write-up: https://pwmarcz.pl/blog/kaboom/ )

This is similar in spirit to my take on the game: https://magnushoff.com/articles/minesweeper/

Unfortunately, not being familiar with SAT solvers, my implementation can grind to a halt in some configurations :)

Re: Minesweeper thermodynamics

#25

I 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 firs…

I would also like to auto clear tiles that are unambiguous when I flag a mine. Perhaps by double tapping one of the adjacent tiles

Re: Minesweeper thermodynamics

#26

I 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 firs…

Simon Tatham's _Mines_ deals with this in a different way: it generates the mine positions in such a way that they can never lead to an ambiguous state during a game. https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/min...

Re: Minesweeper thermodynamics

#27

I 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 firs…

The Windows 7 Minesweeper does something like this on the initial click, I think. You usually get a "good start".

Re: Minesweeper thermodynamics

#29
post #3

Only 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

Similar game: 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)

Re: Minesweeper thermodynamics

#30
Minesweeper 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.

Post reply on HN