Тёмный

I created a PERFECT minesweeper AI 

Code Bullet
Подписаться 3,2 млн
Просмотров 7 млн
50% 1

Using the power of MATH and Probability, I was able to create what I believe to be a perfect minesweeper player
Become a patreon to support my future content as well as sneak peaks of whats to come.
/ codebullet
Check out my Discord server
/ discord
live QnA at 8:30 - 9:00pm every Sunday AEST

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 7 тыс.   
@willmunoz1638
@willmunoz1638 3 года назад
0:48 Dam, the ai found all the bombs in less than half a second. Thats really good
@puppergump4117
@puppergump4117 2 года назад
Not good at all. I can do the same thing faster than that.
@Kilomegaminx
@Kilomegaminx 2 года назад
@@puppergump4117 You mean that's not how you start the game?
@Mr83nn0
@Mr83nn0 5 лет назад
Difficulty in minesweeper isn't determined by size, but by density.
@manegar9990
@manegar9990 5 лет назад
Minesweeper*
@Mr83nn0
@Mr83nn0 5 лет назад
@@manegar9990 effing autocorrect!!
@aidenheiber8726
@aidenheiber8726 5 лет назад
Magnus Larsson yeah but a bigger board means more times you could mess up or get unlucky
@Mr83nn0
@Mr83nn0 5 лет назад
​@@aidenheiber8726, not really sure what you're referring to. If you mean 50/50 klick chances they also increase and decrease based on mine density and not size. If you look at the last example given, the large 64x36 it has less mine density than the original small one. But sure, with a larger board, the figurations can get more tricky. But it still less likely when as in the examples given the mines are miles apart.
@beefedupkronks4371
@beefedupkronks4371 5 лет назад
Try 32x24 with 256 mines, I've been trying to beat it for half a year.
@DefineSyntax994
@DefineSyntax994 5 лет назад
Imagine code bullet making a bot that defeats captcha
@dcfuksurmom
@dcfuksurmom 5 лет назад
its been done before but i dont remember who did it
@laurahurst8901
@laurahurst8901 5 лет назад
*_DETROIT: BECOME HUMAN_*
@alexwang982
@alexwang982 5 лет назад
Am I a joke to you?
@caveman2140
@caveman2140 5 лет назад
Been done a tone of times, and that's usually just one of the steps for that bots task.
@memersdreamisntfunny
@memersdreamisntfunny 4 года назад
Mr Guest god TOO MUCH SCIENCE TO MUCH POWER
@feelingsyko
@feelingsyko 4 года назад
It's fun seeing how his channel went from explaining everything like a tutorial channel to half of his vocabulary being "I can't be fucked"
@AnonUserAgain
@AnonUserAgain Год назад
nahhh I just cant bc this video is so funny why is he why its so funny hes just being mr tutorial man the professional. its so funny it's so normal the editing is so average along with the dialogue and it cant be. did i just hear him say walla in the backgroung noooo
@RandomRothbardian
@RandomRothbardian Год назад
And now he has a good mic
@Dinosaurs4lyfe
@Dinosaurs4lyfe 9 месяцев назад
I was gonna raply but I cant be fucked. Oh, wait...
@CerealExperimentsMizuki
@CerealExperimentsMizuki 2 месяца назад
I like how he drew Mr. Perfect Cell.
@walkinglegend
@walkinglegend 5 лет назад
You just taught me how to play minesweeper. I never got past clicking and praying.
@AMPMASTER10
@AMPMASTER10 5 лет назад
Ditto
@AMPMASTER10
@AMPMASTER10 5 лет назад
@HeavenStito - ROBLOX cause mine didn't come with stupid instructions
@timtams_6
@timtams_6 5 лет назад
@@AMPMASTER10 but... wouldnt you be able to understand how to play it if you play it long enough?
@AMPMASTER10
@AMPMASTER10 5 лет назад
@@timtams_6 if I was really interested in it like a difficult but fun strategy game with a good story, then yes. But I thought it was wired n only played for a few min at a time before quitting
@timtams_6
@timtams_6 5 лет назад
@@AMPMASTER10 heh... minesweeper as a strategy game with a story
@killerkitten7534
@killerkitten7534 5 лет назад
I used to make 500 by 500 custom maps with only 10 bombs and win with one click
@online_cat
@online_cat 5 лет назад
@Scarce-20 yes i agree
@reubenschooley4280
@reubenschooley4280 5 лет назад
I'd like to see him try his AI on hard
@jackwoodhead
@jackwoodhead 5 лет назад
Me: *clicks on a bomb on first move*
@TheF4talgamer
@TheF4talgamer 5 лет назад
@@jackwoodhead its impossible, the game is coded so that the first click is never a bomb
@thomasmueller618
@thomasmueller618 5 лет назад
i dont think so... if one-shot-died many times
@thebokchoy6854
@thebokchoy6854 5 лет назад
Plot Twist: Code Bullet can't code and is just really good at minesweeper
@damienbailey227
@damienbailey227 5 лет назад
I feel like you are on every one of his videos like i swear i saw you on the piano tiles video eh Have a good day
@Linuxdirk
@Linuxdirk 5 лет назад
You actually do not need any skill to play Minesweeper. You just need to understand the rules.
@jensjens7932
@jensjens7932 5 лет назад
@@damienbailey227 Yeah, i think so to
@agvulpine
@agvulpine 5 лет назад
@@Linuxdirk Minesweep is a challenge of speed; it's not a game of success or failure.
@zombossgaming3721
@zombossgaming3721 5 лет назад
Lol
@Owen_loves_Butters
@Owen_loves_Butters 3 года назад
One flaw in your ai When it comes to a 50/50 situation, sometimes one of the guesses tells you more information.
@higztv1166
@higztv1166 2 года назад
true
@brandonbombplays9304
@brandonbombplays9304 2 года назад
That is true. To clarify, let me give an example: a stranded few boxes in the middle of cleared squares, or a box in the middle of the main area of squares, both with the same odds of being a bomb. The ai sees these as equal. However, the one in the main area is actually a much more valuable data point as it helps you to solve many more squares than the other if not a bomb.
@SylviaRustyFae
@SylviaRustyFae 2 года назад
I mean, a bigger tho related flaw is its search pattern is rather slow and often bounces between places rather than focus on an area to clear it and then move over to another area. It is wastin precious seconds even when certaintys are at 100% for many spaced. Ofc, i am assumin speed is what matters; cuz thats all that shows up in high scores after all. And if we're talkin speed then the time to beat is 31.133 seconds; on Expert.
@DougSalad
@DougSalad 2 года назад
@@SylviaRustyFae watch the follow up video, he slowed it down for the video, so we could see what the AI is doing.
@SylviaRustyFae
@SylviaRustyFae 2 года назад
@@DougSalad But its still jumpin all over the place even if it does it at near instant speed, those tiny amounts of time wasted do add up. Particularly when multiple squares have similar odds but it picks a square much further away.
@ilovepinatas3179
@ilovepinatas3179 5 лет назад
When I was a kid I taught myself how to play Minesweeper (I didn't have internet don't judge me) by lowering the bomb count and increasing the grid. Then I increased and decreased both respectively as I got better and better at the game. Hell it beat playing solitaire for the umpteenth time
@zakuro8532
@zakuro8532 4 года назад
You are amazing
@JBerg_
@JBerg_ 4 года назад
Did you get to the point where you could beat a regular expert field?
@JosephQPublic
@JosephQPublic 3 года назад
Doesn’t the game have a guide in the options to teach you?
@itismethatguy
@itismethatguy 3 года назад
Man same but i learnt solitaire after minesweeper
@tunaman9178
@tunaman9178 4 года назад
This guy is like mumbo jumbo but with actual coding
@TheFuriousBrother
@TheFuriousBrother 4 года назад
Nah, mumbo can't keep his logic straight, he always misses something
@tunaman9178
@tunaman9178 4 года назад
No mostly because "it's simple really"
@caros4220
@caros4220 4 года назад
Actually alirion Is right
@paladin_2164
@paladin_2164 4 года назад
More like Ceave Gaming
@drfidelis558
@drfidelis558 4 года назад
More like sethbling
@brostrod
@brostrod 4 года назад
If:going-to-touch-bomb Then:don’t+flag CODED
@Some.username.idk.0
@Some.username.idk.0 4 года назад
If: game-started Then: win
@SoDamnMetal
@SoDamnMetal 4 года назад
using System; namespace l33tsweeper { class Program { static void Main(string[] args) { while (true) { flipTile(); if (touchingBomb) { dont(); // Hire me Microsoft, i'm ready! flag(); } } } } }
@ethanhiro9645
@ethanhiro9645 4 года назад
E
@mcdoodlesnap
@mcdoodlesnap 4 года назад
E
@ImXyper
@ImXyper 4 года назад
@@SoDamnMetal you forgot if (!touchingBomb) { click(); }
@Zorgdub
@Zorgdub 4 года назад
k"CB: We're gonna have to use a little bit of maths and probabilities." Me: "Oh yeah! I'm all about maths, and I especially love probabilities!" CB: "Wait, don't click away! We can make things interesting." Me: "I feel so attacked right now..."
@haileyen353
@haileyen353 4 года назад
ME
@doomse150
@doomse150 4 года назад
10/10 can relate
@jeremybenson4806
@jeremybenson4806 4 года назад
Same
@peknive8331
@peknive8331 4 года назад
I want to learn to like math but I’m not good at it so.
@alfiealfie35
@alfiealfie35 4 года назад
ye
@SickSkilz
@SickSkilz 5 лет назад
Found a flaw. At 4:48 it randomly chose an edge piece. While mathematically the odds of it being a bomb are the same, the odds of it openning a gap of spaces is lower. Random selection should default to a space as far away from edges and known squares as possible.
@beanburrito4405
@beanburrito4405 5 лет назад
Nice catch
@teoteoteoteote
@teoteoteoteote 5 лет назад
John Richardson what
@SickSkilz
@SickSkilz 5 лет назад
@@teoteoteoteote It was asserted to be "perfect" but at that point made a statistically poor random choice.
@teoteoteoteote
@teoteoteoteote 5 лет назад
John Richardson oh ok
@goldenstripes3296
@goldenstripes3296 5 лет назад
Well actually every game has a set amount of bombs, if it is the last square left but not all the bombs have been flagged then the space would be flagged as it would be the last bomb, if all the bombs have been previously flagged then it’s simply an empty space
@skylardeslypere9909
@skylardeslypere9909 4 года назад
Me: "Mom can we have AI?" Mom: "No we already have AI at home" The AI at home: 0:47
@Kadencabs
@Kadencabs 3 года назад
my ai at home 6:13
@iamacatperson7226
@iamacatperson7226 3 года назад
@@Kadencabs My AI at home: Litterally just terminator
@crappy_usename
@crappy_usename 2 года назад
my ai at home: 4 + 2 = 7
@asheep7797
@asheep7797 2 года назад
My AI at home: 0:57
@kirill9064
@kirill9064 Год назад
ai:2+2=7
@harshilagarwal6295
@harshilagarwal6295 5 лет назад
*That moment when you click bomb in the first move*
@snowrhino675
@snowrhino675 5 лет назад
but you can't
@dustincoon2032
@dustincoon2032 5 лет назад
Yes you can
@Mp57navy
@Mp57navy 5 лет назад
@@dustincoon2032 no. First click is never a bomb. If you make a 10x10 with 99 bombs, and click randomly you always win. I learned that like 25 years ago
@-Nudal
@-Nudal 5 лет назад
@@dustincoon2032 Only on certain apps/online versions that are not the original is that possible. The original minesweeper is hard coded to generate every tile 'after' the first click, and the first clicked tile can't be a bomb... HOWEVER, your first click CAN be a flag, then the tiles are all generated, and you can click a bomb without getting any tiles correct, but that's the only way in original minesweeper.
@kitchenjail3546
@kitchenjail3546 5 лет назад
*insert "lion sleeps tonight" beginning*
@bobbydirtamiyer2151
@bobbydirtamiyer2151 3 года назад
It would be super cool to see the A.I. leave behind a little fraction on each square that he chose, so we could see the probability. If you then plot the percentages, you would have a nice little graph of how hard the game gets for your boy towards the end. 👍 Bravo man, you are awesome.
@bonebasket621
@bonebasket621 5 лет назад
Code bullet: I hope you enjoyed watching my AI. RU-vid’s Subtitle AI: I hope you enjoyed watching my eye.
@kornsuwin
@kornsuwin 4 года назад
Leo Sevilla my eye!
@diablotry5154
@diablotry5154 4 года назад
The subtitles don't use an AI
@Subscriberswithnovideos-en3lw
@Subscriberswithnovideos-en3lw 4 года назад
Onat Akosha The Third “auto generated” dumbass
@diablotry5154
@diablotry5154 4 года назад
@@Subscriberswithnovideos-en3lw Ah yes, AI stands for auto generated
@Subscriberswithnovideos-en3lw
@Subscriberswithnovideos-en3lw 4 года назад
Onat Akosha The Third but an ai progressively generates stuff
@justarchive789
@justarchive789 4 года назад
Minesweeper. How to win Width: max Height: max Bombs: 10
@RFDN0
@RFDN0 3 года назад
Weak. Prove yourself with 1600 x 900. 1,439,999 mines.
@justarchive789
@justarchive789 3 года назад
@@RFDN0 It's unable in classic minesweeper from windows 3.1-xp
@RFDN0
@RFDN0 3 года назад
@@justarchive789 Honestly last played minesweeper as a kid on windows 95 and lost many times with a set up like that.
@brandontechnerd
@brandontechnerd 3 года назад
@@RFDN0 that would completely fill my old laptop's screen pixel for pixel, interesting if that could work
@dandanthedandan7558
@dandanthedandan7558 6 лет назад
3:43 No, you.
@kieranwalker2249
@kieranwalker2249 6 лет назад
No he is right
@loopyzach7537
@loopyzach7537 6 лет назад
*Reverse card*
@dandanthedandan7558
@dandanthedandan7558 6 лет назад
Gabriel Barbosa He said "your mom gay" instead of "ur mom gay" so I'm following the trend.
@dandanthedandan7558
@dandanthedandan7558 6 лет назад
*MIC DROP*
@Dee-mm1bt
@Dee-mm1bt 6 лет назад
you mum gay
@thomaswebster5488
@thomaswebster5488 6 лет назад
Next from codebullet an ai the does math homework perfectly =)
@coder0xff
@coder0xff 6 лет назад
Try Wolfram Alpha.
@andrewstehman2330
@andrewstehman2330 6 лет назад
Also, integral calculator
@zperk13
@zperk13 6 лет назад
well that's easy
@Naokarma
@Naokarma 6 лет назад
that's called a calculator
@Grimeaper
@Grimeaper 6 лет назад
No, you need a human factor for you to not be spotted. A few 90s here and there at least.
@Froggend
@Froggend 5 лет назад
“The perfect AI” **AI immediately clicks on a bomb second turn**
@simonforsberg3757
@simonforsberg3757 5 лет назад
Well yeah, because in that case there was no better option - mathematically speaking.
@level8473
@level8473 4 года назад
1st of all you're being sarcastic right? If you ain't then, imagine this there are 2 cups upside down inside 1 of those is a chocolate bar and the one who arranged it was your mom they are placed on the table, now your mom asked you to come to the living room and guess where the chocolate bar is, now you have 50% chance of getting the bar, now imagine that with 10000 cups that's minesweeper, and btw the first box you click is a guessing game.
@Rayzan1000
@Rayzan1000 4 года назад
@@simonforsberg3757 I get what you are trying to say, but what you are saying is simply not true; i.e. there was a better option. (Choosing your first box has nothing to do with math by the way. With no leads there is nothing to calculate) The word 'perfect' is really the wrong word to use here. It implies there is no room for error, i.e. if the AI was 'perfect' it should win 100% of the time. But a game of chance cannot be won 100% of the time, so there is no 'perfect AI'. It can still be a great AI though...
@simonforsberg3757
@simonforsberg3757 4 года назад
@@Rayzan1000 My definition of "Perfect Minesweeper AI" is simply: Make the best possible move with the information that you have. In which case, taking a bomb on the second move when the first field revealed was a 3 is perfectly acceptable. Choosing your first box has a lot of things to do with math, you have to think "What if it is *not* a mine?" in which case one could argue that picking a corner is the best move as that has a higher probability to be a '0' and create a bigger open field.
@mahmoudhossam6014
@mahmoudhossam6014 4 года назад
*Directed by Robert B.Weidy* 😂
@singadorito7802
@singadorito7802 3 года назад
6:13 when the minesweeper is sus!
@arjuns.3752
@arjuns.3752 2 года назад
😳😳😳😡👎👎👎👎🥺😟
@dnaxdevil7391
@dnaxdevil7391 5 лет назад
Am I the only one who keeps on getting recommended old videos from him? Even when you think you binged them all somehow there is a new old one which you have never seen. ... Has Code Bullet hacked time???
@chucknorify17
@chucknorify17 4 года назад
He did that a few years ago ...or is it a few years from now? I can never keep things straight with time travel
@Speed001
@Speed001 4 года назад
Same
@magical_onion9854
@magical_onion9854 4 года назад
Since you liked the newer ones, you get the older and thus more irrelevant ones
@magical_onion9854
@magical_onion9854 4 года назад
And also, they are probably just not exactly fitting for you from the AI algorithm. It's a robot, ya can't blame it that much.
@vanilla_MC
@vanilla_MC 3 года назад
Meeting too, watched all of the new ones then these just pop up lol
@kenmendoza6932
@kenmendoza6932 6 лет назад
*M A T H* and _PROBABILITY.._ made it very interesting to watch.
@brooked982
@brooked982 6 лет назад
How do u do slanted words
@brooked982
@brooked982 6 лет назад
'Hi'
@arkell7763
@arkell7763 6 лет назад
Brooke D _I dunno_
@yellowstonenationalpark6082
@yellowstonenationalpark6082 6 лет назад
_wow_
@yellowstonenationalpark6082
@yellowstonenationalpark6082 6 лет назад
-dude-
@sapphysparrow1129
@sapphysparrow1129 4 года назад
I was today years old when I learned that the numbers actually mean something in minesweeper.
@Pikalexi
@Pikalexi 4 года назад
Sapphy Sparrow they mean the amount of bombs touching it at least 1 block away and around it forming kind of like a square with a square I know this because my family is really competitive
@skyfirevoid
@skyfirevoid 5 лет назад
3:48 bottom left
@ramengandalf7064
@ramengandalf7064 5 лет назад
Pokerxs it kinda looks like a face is that what your saying
@imthedarknight-8755
@imthedarknight-8755 5 лет назад
Sonofwolf628 lol it says your mum gay
@Dragonofshame
@Dragonofshame 5 лет назад
No u
@Nunyuhbusniz
@Nunyuhbusniz 5 лет назад
Pokerxs no u
@skyfirevoid
@skyfirevoid 5 лет назад
fuck you guys lmao
@syrenarch251
@syrenarch251 5 лет назад
1980: I bet you there are going to be flying cars and a cure for Cancer! 2018: I created the perfect Minesweeper AI.
@torginus
@torginus 5 лет назад
Speak for yourself, this video actually cured my cancer.
@imabird1566
@imabird1566 5 лет назад
Ehh potato potahto.
@5ucode
@5ucode 5 лет назад
In Canada, they have the cure but the government won’t release the cure because they’re afraid they won’t get any credit, do maybe if they release it then our population won’t be so low for our size, the population will grow at a better rate Atleast
@haydengillanders7997
@haydengillanders7997 5 лет назад
2118: I bet that the earth was not dying!!
@noah-ns7lu
@noah-ns7lu 5 лет назад
Im a disappointment
@cryochick6736
@cryochick6736 5 лет назад
I lose 99% of my mindsweeper games cause I misclick WAY to much
@darthvader8641
@darthvader8641 5 лет назад
No one realized that he said mindsweeper instead of minesweeper
@joops110
@joops110 5 лет назад
*minesweeper *misclick *too
@bledlbledlbledl
@bledlbledlbledl 5 лет назад
Oh yeah, a typo will get you blowed up quicker than anything
@joops110
@joops110 5 лет назад
@@keenankersh7944 Thanks! English is not my native language, always happy to learn new things.
@skydivingisfun
@skydivingisfun 4 года назад
I'm the same
@dennisrkb
@dennisrkb 3 года назад
"generate all possible bomb arrangements" - doesn't that lead to a combinatoric explosion?
@gabe8168
@gabe8168 3 года назад
There are many ways to get around generating all combos for the the entire map at once. You would have to be insane to do that. It's simple: only generate all possible combinations for 5 tiles at a time
@dennisrkb
@dennisrkb 3 года назад
@@gabe8168 Could you elaborate a bit more?
@danielyuan9862
@danielyuan9862 2 года назад
@@dennisrkb One way to mitigate the explosion is to notice that in untouched squares (squares with no clues touching it), all combinations within those squares have the same probability, so you'll only have to consider touched squares. As a math person myself, I've also realized that if you add all the probabilities of there being a mine within all the squares touching a certain clue, it must sum to that clue. I'm not sure how much that helps, but there may be techniques to minimize that chance. One last thing: this probably never applies until near the end where the only squares left are those where you have to guess, so there would be no combinatorial explosion.
@JesusRodriguez-cg7qh
@JesusRodriguez-cg7qh 6 лет назад
Me: The perfect minesweeper AI doesn't exis-. The Video:
@wolverdep4739
@wolverdep4739 6 лет назад
Jesus Rodriguez no likes? let me help you :)
@gravity9450
@gravity9450 6 лет назад
Me: There is no most unoriginal comme-.
@sanderlahuis5698
@sanderlahuis5698 6 лет назад
Me: I regained my faith in humanit-. tHiS ComMEnT:
@dragonx8361
@dragonx8361 6 лет назад
Me: Ah there will be Normal Commen- These Comments
@joshe9409
@joshe9409 6 лет назад
Me: the perfect meme-killing comment doesn’t exis-
@doommustard8818
@doommustard8818 6 лет назад
You can make a better AI: To make choices of equal risk: (like the first few moves) have it prioritize the move that will give it the *most information* about the rest of the board. I wrote an AI very similar to this one to solve the "Thrill Digger" minigame in Skyward's Sword, and increased it's win rate significantly by giving it this secondary priority. (It had the Third priority of picking the square that netted you the most points in situations where they were equally risky and equally informative; but moves aren't assigned point values in minesweeper)
@DanielCopelandMD
@DanielCopelandMD 6 лет назад
I like this! But also I feel the programing should incentivize clicking on the nearest certain safe spot to speed up the process. There were several times in the video where the computer would go back and forth across the board/field to click on knowingly safe spots.
@doommustard8818
@doommustard8818 6 лет назад
I'm talking about the situation where you get two places where you have two equally safe moves. Obviously if there are two places it knows are safe then it will eventually click both of them-- so it wouldn't matter. But lets say there are two (or more) places that each have a 20% chance of blowing up AND those are the spaces with the lowest chance of blowing up. It's better to pick the spot that gives us a higher chance of winning in the long run. We can both agree that emulating an entire game in this fractal manner would be incredibly slow, (unless you're on a super computer) but what we can do is choose the move that is most likely to reveal the highest number of safe spots, as one way of implementing this idea of "information". There are other ways to implement this but they take longer to explain. This matters the most during the 2nd through when it gets its momentum. As said in the video, once it gets its momentum it's good. The goal is to get momentum faster, so it spends less time in the dangerous state, where it has a very real chance of losing.
@doommustard8818
@doommustard8818 6 лет назад
Sorry I like explaining things and get a little excited when I get to.
@DanielCopelandMD
@DanielCopelandMD 6 лет назад
DoomMustard I get what you are saying and I agree with you. I was saying that in addition to that, having it clear out one section of absolutely safe spots before moving on would also speed it up. It spent most its time moving the mouse needlessly back and forth across the field.
@doommustard8818
@doommustard8818 6 лет назад
Daniel Copeland: I realized that after I finished typing it, but I spent so much time typing it. Hense the "sorry" right after
@Baekstrom
@Baekstrom 6 лет назад
Maybe it can get better, if by better you mean "completing more games per hour". You can probably optimize and make it faster, but in terms of changing the logic, you could look at situations where it at some point HAS to take a chance, like if there is an island that can't be completed unless you pick a square with less than a 100% chance of not being a bomb. In that case you would be better off taking the chance right away and fail fast if you have to fail at all, rather than putting it off until the last moment.
@Starwort
@Starwort 6 лет назад
well actually it could end in a situation where there are more/fewer bombs on the board and therefore the chance changes - if it waits longer it has the best idea
@AndrewKay
@AndrewKay 6 лет назад
There are such cases where you already know how many bombs are in the island, so the rest of the board truly can't give you any more information.
@descai10
@descai10 6 лет назад
This is likely slowed down so it's visible for us to see. The computer probably can complete it in milliseconds.
@ianbentryn8306
@ianbentryn8306 6 лет назад
(From a former addict.) It is a simple matter to play perfectly logically, so the game really is about racing the clock. The trouble, when it arises, is in clearing out the last of areas, when you can arrive finally at 50/50 gambles. So the most efficient play is always to try to finish areas completely so that if you are going to lose on a forced gamble, you find that out before wasting time doing the rest of the board. This flaw in the game is why I kicked the habit - as opposed to rewarding the player for getting better, the game ultimately punishes you. It always bothered me that it would have been a simple matter for the game to be programmed to check after the random mine placement, and scrub matches that could only be won by chance.
@joshuacook2
@joshuacook2 6 лет назад
For probabilistic minesweeper complexity, see: arxiv.org/abs/1204.4659 The short of it: it's extremely hard, harder than solving np problems or simulating quantum computers. Widely believed to be impossible to do perfectly, but perhaps it could be approximated closely.
@AmaroqStarwind
@AmaroqStarwind 2 года назад
What if you _combined_ hard-coded rules *with* neural networks and genetic algorithms, not only so that it can never lose on increasingly large boards, but also play at an increasingly faster pace. So it wouldn't just be a perfect Minesweeper player, but a Minesweeper _speedrunner._ One useful technique to teach it would be "1.5-clicking" as well as some no-flags techniques. And maybe throw some raycasting in there just for the sake of over-engineering it~
@danielyuan9862
@danielyuan9862 2 года назад
over-engineering sounds like the last thing Evan would ever do
@superfeel1275
@superfeel1275 2 года назад
theres no way to get better than polynomial time anyways since its a NP complete problem. Best implementations (without any mistakes possibly occuring) is sub exponential at best.
@thespaceace8164
@thespaceace8164 6 лет назад
Funny story. All the way into my teenage years, I didn't know how to play minesweeper; I didn't know what the numbers were for. I just thought it was a game where you randomly revealed squares and sometimes there were mines underneath. I hated it since I thought it was based on pure luck and was practically unwinnable... One day it hit me that I might have a few misconceptions about the game, and I was able to logic out how to actually play it.
@paulgoogol2652
@paulgoogol2652 6 лет назад
somebody should make a film of your story.
@daniellebarker7205
@daniellebarker7205 6 лет назад
Same, I thought it was the worst game ever, never really thought too much about it, it was just a free shitty game that came with Windows lol
@apollojustice5423
@apollojustice5423 6 лет назад
0000 Huh,that's funny
@PhilippeLarcher
@PhilippeLarcher 5 лет назад
Press f1
@TR2000LT
@TR2000LT 5 лет назад
Same i hated it because it looked unbeatable but then i figured out.
@TheUKNutter
@TheUKNutter 6 лет назад
You should have added more bombs.
@thedoge492
@thedoge492 6 лет назад
every single square are bomn and left one space square so no one can win it
@muizzsiddique
@muizzsiddique 6 лет назад
Tom Tang: Actually, that'd be a instant win. The first tile you click on is guaranteed not to be a mine, so if there was only one square that wasn't a mine you would've already clicked it.
@nexus1g
@nexus1g 6 лет назад
Mu'izz Siddique, that's not true.
@muizzsiddique
@muizzsiddique 6 лет назад
Load up Minesweeper on Windows (most people are ever only talking about the Windows XP/Vista/7 version, there's one on the Windows Store by Microsoft) and make a custom game of 10x10 field with 99 mines. Try it. Don't play shoddy ports made by first time developers who are still learning to code.
@nexus1g
@nexus1g 6 лет назад
Mu'izz Siddique, maybe you're right on the newest version. In Windows 3.11/95 it was possible to hit a bomb on the first try.
@thatoneginger
@thatoneginger 4 года назад
You should revisit this. Room for improvement include having the ai focus on one area at a time to reduce travel time and the utilizing the double click trick: if you left click and right click at the same time on a number that has all its bombs flagged it clears all remaining squares that are touching it.
@Jennifer-ri9nc
@Jennifer-ri9nc 6 лет назад
it's really really good but it's not perfect. the first move shouldn't be completely random, even though all the squares have the same probability of containing a bomb. The corner for example would be a bad move, because in the case that it isnt a bomb, you wouldn't gain as much information about other squares. I imagine that similar but more complicated decisions issues would exist once the game is in progress where multiple squares both have equal probability of being a bomb, but one would give you more information, and therefore give you a higher probability of winning the game. it's really good though.
@thomasritter2183
@thomasritter2183 6 лет назад
Underrated comment! I like your way of thinking :)
@Jennifer-ri9nc
@Jennifer-ri9nc 6 лет назад
Thomas Ritter Thanks, Thomas!
@Trixbeat
@Trixbeat 6 лет назад
Actually I always start with the corner in minesweeper. You have a much higher chance of opening a patch with useful information as opposed to a single number which doesn't tell you anything.
@thomasritter2183
@thomasritter2183 6 лет назад
That's an interesting point! Is there any data about that or are you judging from experience?
@maxfamilant246
@maxfamilant246 6 лет назад
how many games of minesweeper does it take for experience to become data?...the first square you click will never be a bomb, so starting the game on a corner both ensures there is no bomb there, and solves one of the corner squares which has a high chance of a 50/50 choice since there are at most 3 squares providing clues about its status...that being said, you will not likely be able to solve the whole board without having to make subsequent guesses elsewhere, hopefully opening a patch to end the guess work for a moment
@quantumsoul3495
@quantumsoul3495 5 лет назад
Code Bullet: Here's my perfect AI Also Code Bullet : *Gives an hardcoded solver*
@matteoar
@matteoar 5 лет назад
this comment is underappreciated.
@quantumsoul3495
@quantumsoul3495 5 лет назад
@@matteoar ikr
@sea81793
@sea81793 4 года назад
But it is an AI.
@matteoar
@matteoar 4 года назад
​@@sea81793 Well, no. An AI would learn by itself how to do this, the ability to autonomously learn from data and improve without having to change its program code defines an Artificial Intelligence after all, while he wrote every possibility and the best way to solve it. It's, as said, an hardcoded solver, a really good one at that, but it does not define as AI.
@sea81793
@sea81793 4 года назад
Matteo A. I understand what you’re getting at, but your point is a product of “machine learning”. Machine learning is a form of Artificial Intelligence. It is capable of learning on its own(within parameters). Code’s minesweeper program is also a form of Artificial Intelligence. While it may not be self-learning...it is still able to achieve its goal through the knowledge it has been provided. medium.com/axiomzenteam/what-most-people-dont-understand-about-ai-and-the-the-state-of-machine-learning-ed007a987108
@MathAndCarnage
@MathAndCarnage 6 лет назад
Hey Code Bullet, I'd like to hear more about how you calculated the bomb arrangements for the probabilities. I made a Minesweeper AI myself a little while ago (no video, just a personal project) and I found that part to be extremely difficult, especially considering that the number of arrangements can reach into the hundreds of thousands even on a normal expert level board. I'm curious if our methods of solving that problem are similar since the math can get kinda tricky.
@timothyhilditch
@timothyhilditch 6 лет назад
Same I'm writing and report on it. Also what version he is using? Here is a presentation explaining what MathAndCarnage is talking about. It is written by the guy who proved it is impossible to find the perfect algorithm. web.mat.bham.ac.uk/R.W.Kaye/minesw/ASE2003.pdf
@57thorns
@57thorns 6 лет назад
My suggestion would be that all squares with no information about them are equal. So if you have a 1 as first you know there is a 1/8 chance for those, and the rest have (m-1)/(x*y-9). m i mines, x,y are the size of the field. if m is sufficiently high, this is more than 1/8 and we can pick any of the adjacent squares. But, the tricky part here is this: Does it matter if we pick a corner or a side? --- And what about the first move, should that be a corner, a side or in the middle of the field? They all have the same probability for a mine, but if they do not, what are the odds we gain useful information? And I have a suspicion this solver does not take those things into account, and thus I have proven that it is possible to create a better solver for mine sweeper. One standard size in timing for the minesweepers world records is 16x30 with 99 mines. This means the base odds for a mine is about 1/5. For a central position, there is a 1/5 risk of a mine at each of the nine positions, however, strictly speeking they are _not_ independent. If there is a mine on the top left, there is a 98/480 chance for one in the next, if not, the chance is 99/480. But if we ignore these small changes (thus making our solver worse) there is a 13% chance to get a 0 (which automatically expands, or we can expand with no further thinking). For a corner, there are only 4 squares to consider, so the odds of getting a 0 is about 40%. Of course, a 1 means the surrounding spaces has 1/3 of having a mine, sp we are much worse off in that case.
@vis9487
@vis9487 6 лет назад
What are you guys coding it with? C++/Js?
@timothyhilditch
@timothyhilditch 6 лет назад
I'm coding in Java using Javafx. Also @57thorns first click does matter check out this www.minesweeper.info/wiki/Strategy#First_Click
@Stephan-wf1ec
@Stephan-wf1ec 6 лет назад
Yeah I know that code and math on a screen may not be the most mesmerizing visual but it is certainly fascinating stuff and I was very disappointed when the video just kinda skimmed over what I thought would be the interesting stuff. Also would be kinda neat if it could be optimized to win as many games as possible as fast as possible by taking into account how much information is revealed with each click. Sometimes taking a risk just doesn't tell you anything about an area making even a low bomb probability a bad choice over a slightly higher risk but much more informative choice.
@gecko2023
@gecko2023 4 года назад
Who’s talking to me through the washing machine
@tornadomash00
@tornadomash00 4 года назад
Dude someone is talking through a toaster
@andrehen8645
@andrehen8645 4 года назад
hahahahahha 🤣🤣🤣
@Furiousd
@Furiousd 6 лет назад
Sometines Minesweeper generates maps which just can't be solved with all of these rules. So your AI would just rely solely on probability. I'd recommend adding another rule: If we solved everything that we were 100% sure in and now we're left with space which can't be solved with our rules => calculate where the bombs that are left have to be. We got the exact number of bombs left and the "unsolvable" space. Yea, in some cases even this wouldn't work, but solvability percentage will rise and the AI will be even more PERFECT. P.S. well... it would be kinda hard to implement this I guess...
@ManiakPL22
@ManiakPL22 2 года назад
jeez, coming back to OG code bullet is a trip.
@circli
@circli 6 лет назад
Maybe a revised version might help soldiers in the field... Or not...
@arielsproul8811
@arielsproul8811 6 лет назад
the minesweeper game needs to know where the bombs are, a critical bit of information not available in the war zone
@satibel
@satibel 6 лет назад
If you can find the solution in polynomial time, it might. (Well, and you'd be filthy rich.) Because Minesweeper is NP complete. sed.free.fr/complex/mines.html
@NikkiTheViolist
@NikkiTheViolist 6 лет назад
What? You mean in actual war zones, the dirt you're standing on doesn't tell you how many mines are around you?
@TheRealDrWho
@TheRealDrWho 6 лет назад
At 5:35 to 5:45 it leaves a big line at the bottom, which it later solves. What is the reasoning behind this? Is it just always doing rule one until no more rule one is possible and so rule 2 and eventually rule 3???
@Kasamori
@Kasamori 6 лет назад
xchiltonx Those lines have no tiles with a 0% chance of not being a bomb. I just realised that my last sentence is kind of triple negative.
@Tristoo
@Tristoo 5 лет назад
Title should be "I created a minesweeper algorithm."
@TheHuesSciTech
@TheHuesSciTech 4 года назад
Textbook definition from wikipedia: "Leading AI textbooks define the field as the study of "intelligent agents": any device that perceives its environment and takes actions that maximize its chance of successfully achieving its goals." The agent in this video certainly qualifies. Also, every talk I've gone to about machine learning has clearly made this point: the modern self-learning neural stuff is called "machine learning", the term "artificial intelligence" is a much broader concept that includes hard-coded algorithms. That should be enough, but I'll also point out that in most computer games where you playing against "an AI" or "the AI", as is very commonly said, those AIs are almost always hard-coded. Very few computer games having neural-net-based AIs. So as much as you might want to argue that Code Bullet's bot is not AI, you're at odds with the definition used across most academic literature as well as common vernacular, which is about as close to being "wrong" as possible.
@scepticusverisimillimenonm8450
@scepticusverisimillimenonm8450 4 года назад
I think your algorithm is not perfect since whenever it has to take a chance it should take into account the value of information of uncovering a square so that the risk is "worth it". E.g. in the first move all squares are valued equally but the center might have a higher value of information than a corner.
@francogiaretta9286
@francogiaretta9286 3 года назад
You are right, it seems to be much more challenging to build an alghorytm for that
@PaulBurg
@PaulBurg 3 года назад
A corner actually is more likely to have useful information, since there are only 3 neighbors which could have a bomb, meaning it if more likely to expand. Knowing how many bombs are around a single square isn't useful information, knowing how many bombs are around a grouping of squares is.
@PJOZeus
@PJOZeus 3 года назад
@@PaulBurg having less neighbours means a lower chance to expand, not a higher one - each square has the same probability to have a bomb at the very start, since it is not 100%, the more squares, the less chance there is that all of them (surrounding the original pick) are a bomb Although if the AI was truly perfect, it would take in the probability of a blind guess compared to a logical guess of squares which do not currently have a definitive answer
@erwinsmith5921
@erwinsmith5921 3 года назад
@@PJOZeus along with that, there is also the possibility of a 50/50 guess occurring
@wilsonliang3044
@wilsonliang3044 6 лет назад
It’s 3:00 am. Who needs sleep when I can listen to that soothing voice.
@justiceforjoggers2897
@justiceforjoggers2897 6 лет назад
2 am here, I agree
@valtrialastname2712
@valtrialastname2712 6 лет назад
Cola BotelsOVA 3:11, I’m closer
@btat16
@btat16 6 лет назад
Wilson Liang Funny thing is, it’s 3:00 over here as I’m writing this
@dxnny162
@dxnny162 6 лет назад
4:47 is when it starts.
@bananabus4208
@bananabus4208 6 лет назад
Daniel Gonzalez thanks bro
@L0j1k
@L0j1k 6 лет назад
Thanks bro.
@itzm1c155
@itzm1c155 6 лет назад
u r lifesaver.
@onlyme8780
@onlyme8780 6 лет назад
Thank You!!! When I saw skip to ??? I knew my savoir would be in the comments
@madcalicoa1204
@madcalicoa1204 6 лет назад
0:00 is when it starts if you have an attention span longer than a gold fish's
@7own878
@7own878 4 года назад
Look: You need to tell the code how many bombs there are. Then you give every tile the worth: 1-(nbombs):(ntotalfields) That means when you are in a 50:50 situation the bot just skips that and goes to another tile so it has the chance to uncover maximum space.
@jimgeary
@jimgeary 5 лет назад
Your Bayesian method is mathematically perfect for one move, but it only minimizes the chance of boom for one turn. The “best”algorithm would minimize it for the sum of all future turns, which may (may not) mean different choice.
@jihwan990706
@jihwan990706 5 лет назад
Jim Geary can you explain it further? Since I don’t think one move would matter for the future, it’s just whether the bomb is there or not, no? I do want to know what you mean by “taking future turns into account”
@jimgeary
@jimgeary 5 лет назад
SulfurRingROKer The goal isn’t to minimize stepping on a bomber this turn. It is to minimize stepping on a bomb for this and all future turns, so there may be paths that “go around” a second hazard if they work out, whereas perhaps some choices only delay a sure future death lotto ticket.
@jihwan990706
@jihwan990706 5 лет назад
But do those options even exist in minesweepers? Each turn is a clear cut, just being successful if you don’t click on a bomb and unsuccessful if you do, and I doubt having a “successful turn” can ever backfire in minesweepers as every square clicked on without a bomb is a positive hint for future turns
@TheHuesSciTech
@TheHuesSciTech 4 года назад
Jim, thank you. I was trawling through the comments to see if anyone else had noticed this; it's sad how far I had to scroll :-(
@TheHuesSciTech
@TheHuesSciTech 4 года назад
@@jihwan990706 One simple example is that you may have a situation in the top right corner of the board where you can fit either 1 or 2 mines, but can't tell which configuration it is. Meanwhile, there's more solving to be done at the bottom left. If the AI solves the bottom left, such that only the top right corner is left, it can use the readout of the number of mines remaining to infer which of those two configurations is correct. However, if the probability of death at the top right is initially lower, the AI will take a totally pointless and worthless risk doing the top-right first, and will then still have the gauntlet of the bottom left to contend with, which has an overall higher chance of death than taking on the gauntlet first and then taking advantage of the extra info to get a free win at the top right. However, as much as I enjoyed contriving this example, the reality is that it's not on me or Jim to provide a specific clear-cut example. The idea that you have the overall highest probability of success by always picking the option that has the immediately lowest probability of killing you, without considering the knock-on effects, is obviously short-sighted. Such an algorithm is called a greedy algorithm (yes, this is a actual technical term you can look up), and the onus is actually on you or CodeBullet to *prove* that the greedy algorithm is actually optimal. Mathematically rigorously. (I mean, that would be the case in an academic scenario, I'm not saying every youtube video needs a peer-review worthy proof)
@tomburris8380
@tomburris8380 6 лет назад
Would've been a bit more interesting if for the larger maps there were more bombs, good video!
@jasonllorente6818
@jasonllorente6818 4 года назад
How to beat Code Bullet’s AI: *Step 1:* Turn off the AI *Step 2:* Activate your AI. *Step 3:* Win.
@JeyPeyy
@JeyPeyy 5 лет назад
Awesome stuff! However, I feel like speed could be improved a bit. Sometimes it goes from one place to another for no good reason. If two or more squares have the same (highest) probability, it should go for whichever is the closest to the cursor right now.
@gregorykrajeski6255
@gregorykrajeski6255 5 лет назад
I used to play by starting with the lowest density of bombs allowed and increasing by one each time I won a game. I had an excel spreadsheet which did all of the calculations you describe here. My one reason why your game is not perfect: The first move should always be a corner because corners have the greatest chance of having zero bombs and allowing you to start your actual logic. Sometimes the second, third, and fourth moves should also be corners depending on the density of bombs and outcomes of previous moves. Sides also preferable to random squares for the same reason. All that said, when you get a very dense board, there is nothing like clicking somewhere at random and seeing an 8.
@Metatr0n
@Metatr0n 5 лет назад
"The first move should always be a corner" Wrong. In a corner you're opening up the field only to 2 sides, on the walls you're opening up the field only to 3 sides, while starting in the middle of the board, you're opening up the field to all 4 sides. Starting in a corner or wall limits your possibilities.
@gregorykrajeski6255
@gregorykrajeski6255 5 лет назад
@@Metatr0n Perhaps your argument is valid for low density maps. You want to maximize your chance of the first square to be a zero, thus the corner. I'm sure one could tweak the program to run at various density maps and with a random first move vs a corner first move and see which leads to the lowest expected value of moves on squares with a nonzero probability of being a bomb over the course of a game. Or the highest actual winning percentage. Or the highest likelihood to win defined as the product of the odds of a square being safe for each move made. Or some other reasonable success metric.
@idontido6303
@idontido6303 5 лет назад
@@gregorykrajeski6255 Even in high density map, there's still an equal chance that the edge have 2 bombs near it thus locking you too. In fact a higher chance since it only need 2 bomb to lock it in higher density.
@gregorykrajeski6255
@gregorykrajeski6255 5 лет назад
@@idontido6303 In a high density map, you know that your first move will never be a bomb. So if there is a 60% chance of any cell being a bomb, then the chance that an interior square gives you any information is low. Mostly you will be surrounded by 3's, 4's, 5's, and 6's. A corner only has three adjacent cells, so you have a 36% chance of only having one bomb adjacent, giving you a 67% chance of surviving the second move. Lower the density of bombs and you will get a 0 far more often on a corner than anywhere else, again maximizing your chance of surviving the second move.
@jackfinan9060
@jackfinan9060 4 года назад
@@gregorykrajeski6255 You're supposed to start in the center. The center squares never have mines. If you get a bad start and get locked into the center, then you can apply this logic.
@kaidjango
@kaidjango 3 года назад
Anyone else watching because they miss his videos?
@nou5962
@nou5962 5 лет назад
I don't think so... I see little issue... The problem is that the first move is random and if there is number '1' chance that you click at the bomb is 1:8, but chance that bomb is any where else is (30*16-1)/99:1 = about 1:4,48 that means its safer to click any where around the '1' but your AI had '1', but then clicked randomly else. My math is correct only if I consider that you use standrart Expert mode 30×16 with 99 mines. (I might be wrong just please someone tell me something) sorry for gramma and I love your videos :)
@niranjanc5108
@niranjanc5108 5 лет назад
windows_x_seven yes that is how minesweeper works
@ytzu5055
@ytzu5055 5 лет назад
Unless the AI stores data from prior games, this is the best the AI can do, barring calculating the probability of each guessed click opening a large pocket.
@Winasaurus
@Winasaurus 5 лет назад
@windows_x_seven Hmm after reading your answer and the others I think the first click is always an empty square and it moves the mine if there would have been one there maybe?
@rustymilk9444
@rustymilk9444 5 лет назад
@windows_x_seven i think the first square is always safe and after your first click its then randomised , at least thats what i did in my mine sweeper
@jaivardhansingh9414
@jaivardhansingh9414 5 лет назад
windows_x_seven The original comment is talking about the second click not the first
@theannilators7479
@theannilators7479 6 лет назад
Making a perfect ai is easy Just make it so it can see all of the mines
@nabayanchaudhury7323
@nabayanchaudhury7323 6 лет назад
That would technically be cheating because you would have to modify the game files to remove the tile filter over squares, something that could be done.
@theannilators7479
@theannilators7479 6 лет назад
Never said the AI couldn’t cheat
@mr.wolf1216
@mr.wolf1216 6 лет назад
fair point
@dayvie9517
@dayvie9517 6 лет назад
It's funny how many people here claim that this is not an AI algorithm. But the fact is that search Algorithms which use heuristics like A* are already called AIs. This program is clearly not machine learning, a minmax-Algorithm, a sat-solver or a neural network but even those are just fields of the discipline which is called AI. The only reason why I would disagree with that being an AI - if I had to (which alot of peope seem to do, lol) - is that it is very specialized and doesn't use a general AI algorithm. This weak argument is the strongest argument against that being an AI. So why disagree?
@Josiahhhhhhh
@Josiahhhhhhh 6 лет назад
THANK YOU. I’m getting triggered reading all of these “that’s not an AI” comments with tons of likes 🙄
@soonts
@soonts 6 лет назад
I once worked on AI for a console game. Compared to this video, the algorithms we used were simpler mathematically, and slightly more complicated software wise.
@soonts
@soonts 6 лет назад
The bots were not too intelligent. In some edge cases they were quite stupid actually. However, the “AI” term is widely used for algorithms controlling NPCs in videogames. Just search “AI programmer” and you’ll see half of the links are related to game development. Videogames don’t do deep learning. One reason is games have better things to do with the GPUs. Another reason is game designers want to design player experience, so they want to control AI behavior for that. Deep learning kind of AI essentially does whatever it pleases; it’s hard to design good player experience on top of that.
@jikojj3680
@jikojj3680 6 лет назад
AI is learning hence the term ML, this doesnt. The whole idea is no or utility only hard coding. As Geohot said: if statements kill ppl. Now it might b that in Unity or Game maker u find a* pathfinding under AI tab, but its not actually it, AI is ML, in game development u mostly simulate an itelligence, thats why u all r so confused. Its an awesome program but think about this, if this is AI then so is any modern fusebox.
@StaffanPalm
@StaffanPalm 6 лет назад
As John McCarthy, who coined the term “Artificial Intelligence” in 1956 said: “as soon as it works, no one calls it AI anymore". If a intelligent person stops learning, is that person no longer intelligent? Machine learning is just a subfield of artificial intelligence, but indeed a crucial one.
@keltonmckee8348
@keltonmckee8348 6 лет назад
4:47 is where it begins
@keltonmckee8348
@keltonmckee8348 6 лет назад
np
@TheRealOwen1230
@TheRealOwen1230 6 лет назад
No it begins at 0:00
@Youmu_Konpaku_
@Youmu_Konpaku_ 6 лет назад
It begins at 7:46 my friends
@S1lv3r1
@S1lv3r1 6 лет назад
No. I want to see the programming. I am a proud nerd.
@jennifermccarthy2415
@jennifermccarthy2415 6 лет назад
thx m8
@noutkleef4458
@noutkleef4458 6 лет назад
You could speed this up by having the AI finish a section before making a big mouse movement to a different section in the field. You could achieve this by taking the product of (-2 * abs(0.50 - the probability of this square being a bomb) + 1) and (the distance the cursor has to travel), and then travel to the smallest product of all calculated squares. This will minimize travel time
@AndrewKay
@AndrewKay 6 лет назад
This will not minimise travel time - what you've described is just a heuristic. Minimising the total move distance requires solving the Travelling Saleman Problem, but it's actually a bit worse than TSP since each click can create new places that need to be clicked and you don't know in advance where those will be.
@purpleice2343
@purpleice2343 6 лет назад
If you use SendMessage() function (windows only), you don't need to move the mouse This is a function I commonly use in my recent projects as I am learning how to reverse engineer games, and lately was writing a simple bot for it: It's from C project, but I'm 99% sure that this would compile with C++ compiler as is with no changes needed. void mouse_left_click(HWND window, int x, int y) { SendMessage(window, WM_LBUTTONDOWN, 0, (y
@noutkleef4458
@noutkleef4458 6 лет назад
I agree, for the best possible path this would require solving a variant of the TSP. My solution was simply something I had quickly thought of to counter the apparent problem of inefficient travelling. For a simple speedup, I think my solution would be fitting.
@forgetfulfunctor6416
@forgetfulfunctor6416 3 года назад
I'd be curious to see what this AI looks like playing non-euclidean minesweeper or even just minesweeper on weird topologies; n-dimensional minesweeper algorithms would be cool too.
@korosensei4873
@korosensei4873 2 года назад
Hexagonal minesweeper?👀 Ngl that game is cool
@Lain013
@Lain013 5 лет назад
A minor fix: prioritize marking fields by % and then by proximity to previously opened field to avoid unnecessary jumps all over the place.
@realflow100
@realflow100 5 лет назад
its just for visualization. the AI can be much faster than that. it doesnt matter where its moving. its slowed down for visual effect in the video on purpose limiting the AI's speed so we can see it. otherwise the whole 64x36 grid would be completed within a second
@Pat6578
@Pat6578 6 лет назад
How does the AI deal with a 50/50 scenario where you're down to 1 bomb, and it could be in either of the final two untouched squares?
@danielyuan9862
@danielyuan9862 2 года назад
The AI first calculates the probability that the bomb could be in each square, and once it calculates 50-50, it will choose a square at random (or the first square idk)
@faladu9991
@faladu9991 3 года назад
you could improve solving time by having the ai chose the tile closer to its cursor if multiple tiles have the same 0% chance of being a bomb (maybe by making your evaluation algorythm starting to calculate the probabilities around the just clicked tile) currently it often clicks a tile then moves somewhere far away then come back for the next move. And afaik the winning method is to be the fastest so that does seem like a bad behaviour for a "perfect" ai.
@TheXev
@TheXev 6 лет назад
Does the AI operate at the speed shown in the videos? Truth be told, I'd pay money for a screensaver that featured your AI playing mind sweeper... and I haven't really used screensavers for several decades.
@supercables251
@supercables251 6 лет назад
The AI could solve the whole board in less than a second.
@hellterminator
@hellterminator 6 лет назад
+CB LS Doubt it. The time complexity of the approach described in this videio grows with the binomial coefficient of board size and number of mines. That's almost a factorial. I very much doubt the last few games weren't sped up.
@flatfingertuning727
@flatfingertuning727 6 лет назад
If one identifies groups of independent squares, and assumes all squares without any visited neighbors are equally probable, computing probabilities doesn't seem all that hard. If one assumes all non-bomb squares are connected, and excludes all cases where they aren't, that would massively complicate the probability connections, but I doubt it would improve winning percentage nearly as much as identifying which guesses would--if successful--eliminate the need for other guesses.
@red_freckle
@red_freckle 6 лет назад
Several? So you haven't used a screensaver in more than thirty years?
@supercables251
@supercables251 6 лет назад
I was referring to just the AI, yes if you count how long it takes to click, read the number, and otherwise interact with a game, it would take much longer. But if it was written efficiently in a compiled language, and didn't have a significant interface delay to the game its self, it could run in
@poland7974
@poland7974 3 года назад
Who is watching this in 2020/2021
@titusfortunus2916
@titusfortunus2916 10 месяцев назад
lmao that audio quality. I'm glad it's here for prosperity, and I'm glad his mic improved over the years.
@Blazier
@Blazier 6 лет назад
I believe this is still not perfect. In the lategame when you have to start clicking squares with a more than 0% chance of being a bomb, you're better off picking a square with a higher probability of being a bomb if it gives you more information about the rest of the bombs, rather than a lower probability square that gives you very little information. Consider a case where you can either take one 50% chance to solve a whole area, or two 33.3% chances. You're mathematically better off taking the single 50% chance than the two 33.3% chances, which is a 44.4% chance of living.
@danpowell806
@danpowell806 6 лет назад
If the two 33% chances are independent of each other, then there's a 4/9 chance of getting them both- but if they're related to each other or to the same square, then the simple math isn't right. It's the /beginning/ where the algorithm is dumb- if it stats with a single 1, it should take an adjacent square for most densities, and for the remaining densities it should go one block distant.
@L2M2K2
@L2M2K2 6 лет назад
And, also the end. Or, what rules it does use for solving which tile to take in case of a tie? (At non-zero risk, that is.) Perfection would likely require ”infinite” look-forward, i.e., it is not even sufficient to simulate the likelihood of getting that individual (sub-) areas solved (unless one can guarantee that that sub-area contains exactly N mines in any case, then it is not coupled to remaining areas). But, now I'm splitting the hairs...
@Baalor204
@Baalor204 4 года назад
I picture the Super Saiyan 3 transformation dialogue going on during the end "crushing." :) And this is to go even further beyond!
@rogersmith2161
@rogersmith2161 5 лет назад
@Code Bullet Clicking on a safest square is a good strategy, but it is far from perfect. You need to make a click which maximizes your chances of winning, not just minimizes chances of instant death. This is harder but gives a better result (and more fun). Example: you have a positions with only one bomb and three remaining squares. One square is completely surrounded by bombs and two others surrounded by bombs together. Which square you need to click? Your algorithm says it does not matter - the chances of bomb being on any square is the same (1/3). But it DOES matter. If you click on a single square your chances of winning is 2/3*1/2=1/3 (you can die instantly or, if you survive, you will have to guess second time with 1 bomb on two remaining squares). But if you click on one of adjoined squares your chances of winning is 2/3 (you will either die instantly, or win, since your move will reveal the remaining bomb location). Hate to bring you down to earth, pal, but you still not reached a perfection :) PS. Creating a good mineweeper strategy with the goal of maximizing the chances of winning is interesting enough task, worth the usage of Machine Learning (brute-force probabilistic approach may be impossible due to combinatorial explosion in the strategical plannig process). But i think creating strategy which emulates what expert human players do is even more interesting. Humans play to get the best possible time, and they can abandon game if beginning is not looking promising. I'd say we limit a total number of clicks which our algoritm can do in evaluation session (but still enough to play about hundred average games) and the target metric should be something like minimal number of clicks in succesful game (our algorithm can abandon the game at any time if it will decide that continuing it is counter-productive). Now THAT is an interesting challenge!
@overratedpancake9034
@overratedpancake9034 5 лет назад
Well... He just got an AI that plays at 100% win rate, that's perfect enough I guess...
@rogersmith2161
@rogersmith2161 5 лет назад
@@overratedpancake9034 No, he did not. 100% win rate is impossible in minesweeper (for example, your can always die at the first click). And it's not so hard to improve winning chances of his algorithm - just plan the strategy for TWO of your next clics instead of one and you beat it. And the perfect algorithm have to plan until the end of game (which may be impossible with brute-force approach). So, no perfection yet. Correction: many minesweeper versions place bombs AFTER the first click, so you cannot die instantly. Still, situations where you have to guess (and have chances to die) are very common if you have enough bombs for the selected field size.
@Atlessa
@Atlessa 5 лет назад
@@rogersmith2161 "(for example, your can always die at the first click)" Errr... no. You can't. The bombs are only placed AFTER your first click is registered, and that first square is ALWAYS safe. You just disqualified yourself from this topic.
@rogersmith2161
@rogersmith2161 5 лет назад
@@Atlessa "The bombs are only placed AFTER your first click is registered" That is exactly what i said, learn to read. And "Still, situations where you have to guess (and have chances to die) are very common if you have enough bombs for the selected field size." You just disqualified yourself from any possible topic.
@Mr.Pallanza
@Mr.Pallanza 4 года назад
Today: A.I. becomes a perfect Minesweeper. Tomorrow: A.I. becomes a perfect *_Populationsweeper_*
@theultimatehoomanperson6701
@theultimatehoomanperson6701 4 года назад
Code Bullet was actually playing minesweeper because you can see the mouse
@carterlyng4577
@carterlyng4577 6 лет назад
You should make it so that it doesn't flag the bombs, but just remembers it to save time.
@PipeRiosL
@PipeRiosL 6 лет назад
carter lyng occupies memory. Flagging let the ai to ignore them
@TheVergile
@TheVergile 5 лет назад
@@PipeRiosL so what? Even a 100x100 playing field of minesweeper only has 10.000 locations, which would each only need a single bit (bomb/no bomb) to map. That would take just a bit more than a single kilobyte to store. How much Ram do you have in your PC? 8GB? 16GB?
@danmerillat
@danmerillat 5 лет назад
@@TheVergile That would take longer, you have to flag all the bombs to 'win' anyway, so you'd have to add a final pass to flag them all.
@TheVergile
@TheVergile 5 лет назад
@@danmerillat what? you win as soon as you opened every non-bomb field. the flags are just there to help you as a player.
@HendraParwata
@HendraParwata 5 лет назад
That wouldn't entertaining at all The flags and cursor intentionally shown to make it looks more human
@SnaykEyes77
@SnaykEyes77 4 года назад
That was mine blowing.......
@TheMaplestrip
@TheMaplestrip 6 лет назад
Very cool. If love to see it deal with a field with a larger ratio of bombs. I wonder at what point the odds of it losing become greater than the odds of it winning.
@vassvik
@vassvik 6 лет назад
This would be related to a field called "percolation theory". The point at which it becomes impossible to win (except by shear random luck, picking all the non-bomb squares blindly in sequence) is when the density is equal to the "percolation threshold".
@philippefutureboy7348
@philippefutureboy7348 5 лет назад
Now go claim the 1M dollar prize offered by the Clay Mathematics Institute (well if you can find a P solution)
@UnionParkPlumbing
@UnionParkPlumbing 5 лет назад
I was going to mention this!
@outsidercain3038
@outsidercain3038 5 лет назад
what's that about ? And P solution ?
@hydrochloricacid2146
@hydrochloricacid2146 4 года назад
While CB's program here was impressive in its own right, it isn't hugely difficult to build either. That would suggest that they are more interested in an P algorithm, and that this does not qualify.
@johnweber4504
@johnweber4504 4 года назад
The only way to make it better would be to figure out how the computer generates the field and use what has been solved to solve the random chance bits
@TAYKONG
@TAYKONG 6 лет назад
I love minesweeper! It's my favorite video game. You could say I'm a gamer.
@naikrovek
@naikrovek 6 лет назад
Plain old coding is not an "AI" it's an algorithm.
@WolfrostWasTaken
@WolfrostWasTaken 6 лет назад
The truth ^
@computercat8694
@computercat8694 6 лет назад
See the above comment threads.
@theguythatlies505
@theguythatlies505 5 лет назад
First time play showing: *loses* Bot:BUT I AM PERFECT!!!!
@TheAIEpiphany
@TheAIEpiphany Год назад
A piece of code: Coding Bullet: "Look, an AI"
@ahhyesstoinks4058
@ahhyesstoinks4058 4 года назад
Finally my uncle who is bored with his office job every 1 hour before leaving hour can now see the end of minesweeper
@IamCoalfoot
@IamCoalfoot 4 года назад
6:12 It missed a spot. Top-left corner. ;P Then again, the only way to know if that's a bomb is to clear the rest of the field and count the bombs, but since the game didn't give a 'win' screen, it was probably safe lol.
@SYST3MGL1TCH
@SYST3MGL1TCH 9 дней назад
It's so weird not seeing the talking tv head man.
@kitchenjail3546
@kitchenjail3546 5 лет назад
Planning a vacation in Europe be like: *Europe-shaped minesweeper grid*
@kitchenjail3546
@kitchenjail3546 5 лет назад
electric_hiccup 707 or that
@imbadgamer9182
@imbadgamer9182 2 года назад
he's come a ling way with his animations
@42scientist
@42scientist 6 лет назад
Loved it ! But you could improve its speed if you could make it move the cursor a bit less
@England91
@England91 6 лет назад
inixix rudess this isn't the perfect ai as the pros do this without flags like my mum does
@dustyartz4108
@dustyartz4108 6 лет назад
You could just up the mouse speed. The AI is moving as fast as the mouse sensitivity is.
@Sagolel4797
@Sagolel4797 6 лет назад
for the ai the flags are important to speed up computations as you don't have to account the possibility of a tile being safe if it's flagged
@ArnabAnimeshDas
@ArnabAnimeshDas 3 года назад
The numbers looked so nice. I always thought that how many big numbers you can get. Kind of like a lottery.
@flatfingertuning727
@flatfingertuning727 6 лет назад
I don't think your strategy is sufficient, since correctly guessing that a square does not have a bomb doesn't mean one wins the game. If one square has a 2/5 chance of containing a bomb, but correctly guessing it would guarantee victory, while another square has a 1/5 chance of containing a bomb, but correctly guessing it would still leave one with a 50-50 guess, optimal strategy should favor picking the first since it would yield a 60% chance of victory, vs. 40% for picking the second.
@MattMcConaha
@MattMcConaha 6 лет назад
I don't know the exact odds of different scenarios happening in minesweeper, but from my experience playing, it seems that most guesses are true 50/50's, where no amount of logic could help you pick which of the two are more likely. Though an exception in the case where your 50/50 is directly on the top left corner, in which case due to the programming of the game, the corner tile is more likely to be a mine, because if you click a mine on the first click of the game, the game will move that mine to the top left corner instead. Most of the time when you are in a situation of guessing between two tiles which don't have equal odds, you can either work your way back to that position from another angle (i.e. you don't need to guess) or you can guess a nearby tile with smaller odds of getting a mine, and that can help you determine between the two that you are looking at. And sometimes the number of mines that you have remaining can help sort things out. But in conclusion, yes, whatever you said should be implemented in order for the program to play "perfectly." But it also needs to have a lot more stuff added in addition.
@lipid9119
@lipid9119 6 лет назад
Bruh you forgot to update the "skip to ???"
@CodeBullet
@CodeBullet 6 лет назад
yep my bad
@mateuszodrzywoek8658
@mateuszodrzywoek8658 5 лет назад
Jokes on your AI, i beat minesweeper with 3 moves in 0 seconds
@neilgorman6502
@neilgorman6502 3 года назад
If you wanted to make the bot more accurate give it a better chance then 50/50 by taking the remaining squares that have not been flagged as bombs vs the number of bombs there are almost always more safe squares than there are bombs remaining. By selecting a random square discluding the ones that are known to be 50/50 situations. You can drastically increase the probability of hitting a numbered square which depending on the number the square you select ends up being will still likely have a higher percent chance of being attached to a safe square if it doesn't you go back to the random option.
@neilgorman6502
@neilgorman6502 3 года назад
For example with 400 squares and 99 bombs. If you've opened 300 squares and found 74 bombs you have 100 squares remaining and only 25 bombs. There's already a 3:1 ratio of safe squares to bombs. Now let's say you've ended up here because you have 5 50/50 scenarios. You cross the 10 squares creating them out as options. This leaves you with 90 squares definitively taking out the 5 bombs as well as 5 squares but now with 90 squares and only 20 bombs we have further improved our chance of selecting a safe square. So I guess what I'm saying is until you add that into the bots calculations I suppose I might be a better (although slower) minesweeper player than your ai.
@MidnightBloomDev
@MidnightBloomDev 6 лет назад
Dear ai children, This is where our grandad was born
@traininggrounds9450
@traininggrounds9450 6 лет назад
How does the probability method work exactly? It still seems like you would have to implement logic to get it to choose the right boxes.
@helenehodges3789
@helenehodges3789 4 года назад
Plot twist: He programmed it so he can get past a mine field to get to area 51 and get the aliens
@doommaker4000
@doommaker4000 4 года назад
I thought all the 51 area stuff finally died down....
@reecegarthwaite4905
@reecegarthwaite4905 4 года назад
@@doommaker4000 it did...
@DatDeadMemer
@DatDeadMemer Год назад
0:38 dang cell not only stole piccolos regeneration, but his minesweeper app as well
@jackazadian9558
@jackazadian9558 6 лет назад
It seems like the only thing holding your algorithm back is the speed of the mouse. Maybe figure out a way to remove that factor from the equation, or simply increase the speed of the mouse pointer in your settings. If that makes it faster, could you upload a video of the updated version for some extra orgasmic fast minesweeper wins? PS: nice video.
@the.starman
@the.starman 6 лет назад
But whats his name? The name of our hero?😯
@drdca8263
@drdca8263 6 лет назад
Starman cell?
@mcblaggart8565
@mcblaggart8565 6 лет назад
+drdca Honestly, that's a pretty good choice. For at least two reasons.
@data_5674
@data_5674 6 лет назад
I will call is Craig
@the.starman
@the.starman 6 лет назад
Maby GLaDOS ? Because I like her like GLaDOS
@pauhull
@pauhull 6 лет назад
WHAT ABOUT PENUS OR VAGENE
@ragerancher
@ragerancher 4 года назад
6:10 I could just imagine him also coding in the minesweeper to play an "oooooooooh" sound as it moved the mouse across to the final corner.
@ubertoaster99
@ubertoaster99 6 лет назад
Save time by not flagging the mines, you don't need to. I never bother(ed) on the smallest grid.
@purpleice2343
@purpleice2343 6 лет назад
The time used is negligible, the only reason it still takes considerably longer is because he moves a mouse. Using this function: void mouse_left_click(HWND window, int x, int y) { SendMessage(window, WM_LBUTTONDOWN, 0, (y
@ubertoaster99
@ubertoaster99 6 лет назад
What's negligible? We're looking for PERFECTION here! :o)
@whatd0605
@whatd0605 4 года назад
There such a dramatic difference between code bullet's older videos and newer videos lol
Далее
I Created a PERFECT SNAKE A.I.
24:04
Просмотров 11 млн
A.I. Solves a 55 x 55 x 55 Rubik's Cube
16:00
Просмотров 16 млн
+1000 Aura For This Save! 🥵
00:19
Просмотров 5 млн
DESTROYING Guitar Hero with an AUTOCLICKER
14:26
Просмотров 1,8 млн
BREAKING Storm The House with an AUTO CLICKER
11:24
Просмотров 13 млн
AI Learns to Play Tag (and breaks the game)
10:29
Просмотров 3,5 млн
Making a Calculator using ONLY MARBLES
11:46
Просмотров 2,8 млн
Minesweeper Opening Strategy: The Classical
11:51
Просмотров 249 тыс.
HUMAN BENCHMARK TEST vs AUTOCLICKER | Visual Memory
9:14
AI Learns to Play SUIKA GAME
13:46
Просмотров 3,7 млн
Using A.I. to DOMINATE NERDS in TETRIS
31:16
Просмотров 7 млн