Solving Minesweeper with Set Theory

  Рет қаралды 12,557

Wilf Waldron

Wilf Waldron

Күн бұрын

Пікірлер: 31
@andrewhubbard4043
@andrewhubbard4043 15 күн бұрын
I wonder, can your algorithm find the safe cell in: x 3 x ? x 2 ? ? ? x 2 ? ? 5 x x 2 2 x x It's not too hard to solve by hand, but requires looking at 4 sets
@wilfwaldron
@wilfwaldron 15 күн бұрын
That is a really fantastic example, I don't think it can solve it! imgur.com/Wm0ABwP Here is a diagram explaining why for anyone interested Essentially we need to see that 2 cells contain at least one mine, forcing a safe cell somewhere else. But because of how the sets are created initially (around each number), the only set that contains these 2 mine cells also contains the safe cell. I imagine that there would be some way to enhance the method by changing the logic so it also looks for situations where it can combine sets (since at the moment all new sets are subsets of existing ones) Really really nice example.
@schazz3929
@schazz3929 6 күн бұрын
Replace your 5 with a 6 and you have a better example, because in this position, after clearing the safe tile and marking the guaranteed mine, you have a 50/50 situation, whereas if it was a 6 you would have a guaranteed win :)
@andrewhubbard4043
@andrewhubbard4043 6 күн бұрын
​@schazz3929 Quite the opposite, with a 6, you have 5 mines around it in the rightmost 2 columns. You flag the mine and can't go further. With a 5, you know the tile above it is safe, and you know whether the tile in the top row is safe. If it is, you can solve the 2x2 as well as whatever is off the example toward the top right. If not, you have to guess anyway. Maybe I forgot to mention, but that example is a subset of a ~80% completed board.
@schazz3929
@schazz3929 Күн бұрын
@@andrewhubbard4043 You are correct, my mistake My brains must've temporarily leaked out at the time I wrote this comment, I apologize.
@chappuis73
@chappuis73 17 күн бұрын
Wow, this was a really cool and well-explained video! I thought I was watching someone with like 50-100k subscribers, my jaw dropped when I saw the actual subscribers/views count
@zetsubou-san8390
@zetsubou-san8390 15 күн бұрын
Have you played the game Bombe before? It basically plays just like this. Instead of discovering the mines with the clues given, you're writing formal rules that specify what those clues logically dictate.
@clementbarbara7741
@clementbarbara7741 7 күн бұрын
What an amazing game
@antibehroz7304
@antibehroz7304 16 күн бұрын
There are some minesweeper variations that generate boards that guarantee that no situation comes up where you must guess if you go about the board logically, I usually play one called "Mines from Simon Tatham's Portable Puzzle Collection"
@MarkWiemer
@MarkWiemer 14 күн бұрын
High quality vid! I love Minesweeper as a testbed for math stuff. I was so excited when I learned it was NP-hard, maybe one day we'll truly solve it ;)
@LesslyPoint
@LesslyPoint 17 күн бұрын
This is excellent! Very cool applications of set theory. I usually see trial and error based approaches with mine sweeper, so this is a great change of pace
@Akronymus_
@Akronymus_ 15 күн бұрын
Makes me think of the game "Bombe" which is a minesweeper where you only solve them via making rules.
@ninam6826
@ninam6826 17 күн бұрын
Very cool! Nicely formated presentation as well!
@gurchyy
@gurchyy 14 күн бұрын
I believe this method can also solve situations that require knowing the number of remaining mines, if you create a set that covers every remaining cell on the board, with number of mines equal to the number remaining.
@ouzoloves
@ouzoloves 13 күн бұрын
Very nicely explained and excellent algorithm, I had to stop and work out how it knew the 2 clear cells next to the 1 in the top left corner of the intermediate. Though I think in normal play, the clearing of the nearby cells would easily result in knowing where the bomb touching the 1 was, it was interesting to see that it can be logically worked out at that stage. Do you find yourself recogising any of the more advanced patterns at all when playing?
@wilfwaldron
@wilfwaldron 12 күн бұрын
Yes that surprised me as well. As for seeing patterns, sort of, you can make your own judgement with this video: kzbin.info/www/bejne/sH_Jn5aLhLyni8U It is just me solving and explaining some of it.
@sinom
@sinom 15 күн бұрын
People have already mentioned it but you can implement a way of solving similar to this in bombe (+ a bunch of other stuff) These "groups" you're talking about are called "regions" in that game, any hint generates base regions and you can define rules that then act on the regions to either generate more regions or reveal a cell
@gavinkleinebecker3672
@gavinkleinebecker3672 17 күн бұрын
Now I want to see how you calculate probabilities with set theory!
@ThomasEdits
@ThomasEdits Күн бұрын
"thats pretty cool in my opinion, hope you enjoyed, bye bye" love people just sharing their random fascinations
@Flourish38
@Flourish38 15 күн бұрын
If you want to get cheeky with your hash function for the groups, you might be able to make it something like index of center cell + bit mask indicating the shape of the group. It doesn’t seem like you’re struggling with performance, though :P
@hans-edwardjaquegranstrom3486
@hans-edwardjaquegranstrom3486 17 күн бұрын
Would you be ok with sharing the source code? Fun to play around with and learn from :)
@wilfwaldron
@wilfwaldron 17 күн бұрын
Go for it! There is a deployment/code here. aosuk.github.io/MS/index.html there are instructions on the page itself. Though, good luck if you are on mobile... I want to warn and apologize to you about the code, I made the entire clone JUST to test if this set idea worked, so it is incredibly rushed, I am not proud of it. This might be more useful to read, it just talks about how the board is stored, and what operations are done on sets. pastebin.com/8gLsQAee I would like to make this very cleanly in java, and run simulations to collect data about the exact strength of the solver.
@hans-edwardjaquegranstrom3486
@hans-edwardjaquegranstrom3486 16 күн бұрын
​@@wilfwaldron Awesome, thank you! No need to apologize for the code. I'd rather look at rushed code than no code :D If you end up rewriting it in Java I'd love to see that code as well, no pressure! :D
@quantumsoul3495
@quantumsoul3495 12 күн бұрын
I would have prefered a bigger pointer
@cipeman3498
@cipeman3498 16 күн бұрын
interesting! i wonder how endgame total mine counting techniques could be applied in this framework? i also wonder if these ideas could apply to any of the variants from 14 minesweeper variants 1 or 2
@hhhhhh0175
@hhhhhh0175 11 күн бұрын
just the other day i was looking at that combinations example on minesweeper online and was like "there's obviously still logic here" e.g. the 1 in the top right corner reduces the 3 on the left into a 1, which reduces the 2 below into a 1, which reduces the 2 below and to the left to a 1, which combines with the 3 below to give a safe square and a mine
@vilkillian
@vilkillian 16 күн бұрын
Basically a convolution
@nyphakosi
@nyphakosi 15 күн бұрын
this sounds a lot like how the game Bombe on steam works!
@Patashu
@Patashu 15 күн бұрын
@@wilfwaldron Join us Bombe players and stare into the abyss :D
@GoldenArbiter01
@GoldenArbiter01 13 күн бұрын
Now you just need it to click the green boxes for you
@serverinvihatuin2654
@serverinvihatuin2654 17 күн бұрын
Epic
Minesweeper Opening Strategy: The Classical
11:51
Mine Buoy
Рет қаралды 258 М.
12 Year Old Kid Destroys Minesweeper's Oldest World Record!
16:53
Karl Jobst
Рет қаралды 1,1 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
The Axiom Behind Math's Weirdest Paradox
9:27
Abide By Reason
Рет қаралды 49 М.
How do you solve Minesweeper?
12:41
Apple Maths
Рет қаралды 225 М.
4 Views of the 4-Cube
5:25
Richard Hammack
Рет қаралды 18 М.
The Paradox Of Self-Locating Probabilities
11:01
Polymorphia
Рет қаралды 17 М.
⚡ Minesweeper Is Hard - Keegan R
15:23
UWCS - University of Warwick Computing Society
Рет қаралды 63 М.
The Perfect Dependency - SQLite Case Study
19:32
Tom Delalande
Рет қаралды 100 М.
I made a self-solving Minesweeper screensaver
5:59
Have a Luke at this
Рет қаралды 139 М.
Goal Misgeneralization: How a Tiny Change Could End Everything
11:44
Rational Animations
Рет қаралды 104 М.
An Engineering Fairy Tale: Cascade Failure at the Super Kamiokande
22:21
Alexander the ok
Рет қаралды 681 М.