The Dumbest Way To Solve A Maze - Numberphile

  Рет қаралды 378,274

Numberphile

Numberphile

Күн бұрын

Featuring Matt Henderson. Check brilliant.org/... for Brilliant and get 20% off their premium service (episode sponsor)
More links & stuff in full description below ↓↓↓
Matt Henderson on Twitter (he posts lovely animations there): / matthen2
Matt Henderson Numberphile Playlist: bit.ly/MattHen...
Computerphile: / computerphile
Numberphile is supported by the Mathematical Sciences Research Institute (MSRI): bit.ly/MSRINumb...
We are also supported by Science Sandbox, a Simons Foundation initiative dedicated to engaging everyone with the process of science. www.simonsfoun...
And support from The Akamai Foundation - dedicated to encouraging the next generation of technology innovators and equitable access to STEM education - www.akamai.com...
NUMBERPHILE
Website: www.numberphile...
Numberphile on Facebook: / numberphile
Numberphile tweets: / numberphile
Subscribe: bit.ly/Numberph...
Videos by Brady Haran
Patreon: / numberphile
Numberphile T-Shirts and Merch: teespring.com/...
Brady's videos subreddit: / bradyharan
Brady's latest videos across all channels: www.bradyharanb...
Sign up for (occasional) emails: eepurl.com/YdjL9

Пікірлер: 558
@numberphile
@numberphile 2 жыл бұрын
Check Brilliant (episode sponsor): brilliant.org/numberphile Matt Henderson on Twitter (he posts super animations there): twitter.com/matthen2 Matt Henderson Numberphile Playlist: bit.ly/MattHendersonPlaylist
@jamescollier3
@jamescollier3 2 жыл бұрын
Make pressure, so they go the right way slightly more often than the wrong way each loop
@MichaelMantion
@MichaelMantion 2 жыл бұрын
Who imports numpy as numpy. Everyone I know imports numpy as np. He might want to use numba to speed up his code.
@Anonymous-df8it
@Anonymous-df8it 2 жыл бұрын
It would still work with only one particle... if you want an even dumber way!
@chrisvandermerwe8321
@chrisvandermerwe8321 2 жыл бұрын
L
@diegofrota
@diegofrota 2 жыл бұрын
What programming languages are Matt Henderson using to produce those beatiful animations? Can anyone tell me?
@KasranFox
@KasranFox 2 жыл бұрын
finally, the maze-solving equivalent of bogosort
@WinterDew.Studio
@WinterDew.Studio 2 жыл бұрын
This is the first thing which came to my mind
@rewanthnayak2972
@rewanthnayak2972 2 жыл бұрын
What mught be the sorting equivalent of lightning maze solver??🤔
@HyperHrishiHD
@HyperHrishiHD 2 жыл бұрын
Since you were first to say it then you get likes
@yuvalne
@yuvalne 2 жыл бұрын
+
@dagothur8037
@dagothur8037 2 жыл бұрын
now throw a NEAT instead of pure randomness and now its NEATboggosolver!
@superscatboy
@superscatboy 2 жыл бұрын
I once made a "rat with a terrible memory" maze-solving AI: It could do perfect A-star, but it only knew about walls it had "seen" (had a line of sight with), and at random it could forget a wall that it previously knew about.
@HappyBeezerStudios
@HappyBeezerStudios 2 жыл бұрын
That sounds intriguing. I'd love to see the results.
@wolfmoz2232
@wolfmoz2232 Жыл бұрын
2. that
@PC_Simo
@PC_Simo Жыл бұрын
@@wolfmoz2232 3. that.
@aaroncroft7514
@aaroncroft7514 Жыл бұрын
4. that
@wojtekburzynski654
@wojtekburzynski654 Жыл бұрын
" A-star, but it only knew about walls it had "seen" "so kinda like D-star?
@MuJoeTheMean
@MuJoeTheMean 2 жыл бұрын
Interestingly, this concept actually has real world application in the world of mechanical engineering. Labyrinth seals are a type of seal in which a fluid is contained simply by making the leak path very long and torturous for the fluid particle to escape out of. This simulation is a pretty good demonstration of how surprisingly difficult it can be for a particle to escape when it just has random collisions to guide it. You can imagine that if designed to be intentionally difficult (narrow, long passages with lots of turns), a maze like this could do an excellent job at stopping leaks. They are most commonly used to seal spinning axels, where a normal seal may not be suitable due to friction or durability concerns. In these applications, the path usually makes many trips to and away from the axle so that centrifugal motion of the fluid can help prevent any leakage as well.
@jasonrubik
@jasonrubik 2 жыл бұрын
Now, that's a fun fact !
@NickACrowley
@NickACrowley 2 жыл бұрын
Is that the same principle used in a Tesla valve?
@Kwauhn.
@Kwauhn. 2 жыл бұрын
@@NickACrowley That's the first thing I thought of! Is there a telsa valve such that particles escaping through it at a specific initial preassure is statistically impossible?
@MuJoeTheMean
@MuJoeTheMean 2 жыл бұрын
@@NickACrowley It's similar. In a Tesla valve, the side path ways reverse the momentum of some fluid and then send it back into the main stream, so it's like you're subtracting the velocities from each other (that's not strictly true in a physics sense, but it's the right idea). The end result is fluid flow with an average velocity much closer to 0. Labyrinth seals rely much more on random chance instead of intentionally 'subtracting' velocity.
@finnaustin4002
@finnaustin4002 2 жыл бұрын
@@Kwauhn. no, Labyrinth seals mostly used for high viscosity fluids like grease. All they do is make the path much longer and higher friction than a straight path
@donaldasayers
@donaldasayers 2 жыл бұрын
I have a 3D cube maze, it's in the form of a 5x5x5 cube, transparent and you roll a ball through it. But if you blow through it, the correct path steams up. This is exactly the same method.
@DaedalusYoung
@DaedalusYoung 2 жыл бұрын
Similar, in your cube there is air. If you blow through it, the air in the 'wrong' path can't escape, you're pushing it into a dead end. Your breath will take the path of least resistance. Since this model doesn't simulate air pressure, or any interaction between the molecules, there is the same resistance going into a dead end as there is following the correct path (none at all), where in the real world there is a difference in resistance. That makes your real world example more efficient than this model.
@oddlyspecificmath
@oddlyspecificmath 2 жыл бұрын
So basically if I'm ever trapped in a huge cube, follow the breeze, or perhaps the condensation...
@thekingoffailure9967
@thekingoffailure9967 2 жыл бұрын
@@oddlyspecificmath light some incense
@hamjudo
@hamjudo 2 жыл бұрын
Long ago, my robotics club had a maze solving competition for small autonomous robots. Before the contest began, I put a toy into the maze. It was a battery powered sphere with a picture of Santa Claus on it. There was a motor driven offset weight inside the Santa Ball. The Santa Ball would roll in a straight-ish line until it hit an obstacle. Then it would bounce in a random direction and continue on. The actual robots moved much more slowly. Even though they didn't ever retrace their path, they were much slower. Fortunately, the Santa Ball was disqualified. It was store bought, not built by a contestant. Thus one of the robot builders got the official first place prize.
@bobson_dugnutt
@bobson_dugnutt 2 жыл бұрын
A local engineering competition had a remote controlled robot challenge. You got points for completing various tasks. Then some points for time. The year before I participated, the team from my school just made basically a RC car and went straight for the finish without doing any of the tasks. They got first place. Needless to say they changed the scoring grid for the following year.
@Triantalex
@Triantalex 8 ай бұрын
??
@jeffreydemattos5619
@jeffreydemattos5619 2 жыл бұрын
I like your idea of solving a maze with gas pressure. this is mathematically very simple to simulate, and even a bad simulation would be very fast. For example, you could assign a fixed pressure of 1 to the maze entrance and zero to the maze exit. All the other cells start with zero pressure. Then iteratively calculate the pressure for every cell as the average of the pressures of adjacent connected cells. The length of the shortest path is simply the number of iterations it takes for the cell adjacent to the exit to get some non-zero pressure. And the shortest path would simply be from the beginning to the cell with the next highest pressure for each step and so forth. For larger mazes, processing time could be saved by keeping a list of all the cells with some positive pressure and in each iteration, add to the list the cells adjacent to the ones that have already been calculated at least once. Unfortunately this is not much different than simply enumerating the entire maze search, with the exception that you only have to store one value (the pressure) for each cell.
@TheEternalVortex42
@TheEternalVortex42 2 жыл бұрын
This is basically the Bellman-Ford algorithm for finding shortest paths.
@DeenBoi
@DeenBoi 2 жыл бұрын
I didn't expect the word 'sperm' being mentioned in a Numberphile video
@moth.monster
@moth.monster 2 жыл бұрын
A different kind of -philia?
@interbeamproductions
@interbeamproductions 5 ай бұрын
numberphallic
@trevorgreenough6141
@trevorgreenough6141 2 жыл бұрын
Is simulating a molecule hard or easy? Yes, it is hard or easy.
@recompile
@recompile 2 жыл бұрын
As they did in this video? Very easy. Though it looks like he over-complicated things quite a bit...
@eragonawesome
@eragonawesome Жыл бұрын
"that depends, do you want the big effects or the really tiny ones?"
@Triantalex
@Triantalex 8 ай бұрын
??
@SgtSupaman
@SgtSupaman 2 жыл бұрын
2:24 Well, by definition, the dumbest way to solve a maze has to work because it would have to solve it, so this could still be the dumbest way. On the other hand, the dumbest approach to a maze would be to just stand still. That, however, can't be called the dumbest way to solve a maze, because it never solves the maze.
@jasonrubik
@jasonrubik 2 жыл бұрын
Semantics to the rescue ! In the best way possible ! :)
@TheJunky228
@TheJunky228 2 жыл бұрын
turn around and exit at the entrance! 4d chess solution to a maze
@jasonrubik
@jasonrubik 2 жыл бұрын
@@TheJunky228 that's a big brain move
@JimBalter
@JimBalter 2 жыл бұрын
It depends on what "way" means. Not all ways to solve a problem work.
@DqwertyC
@DqwertyC 2 жыл бұрын
It's like the Jack Sparrow meme: "This is, without a doubt, the worst way to solve a maze!" "Ah, but it does solve the maze."
@imallfordabulls
@imallfordabulls 2 жыл бұрын
The guests in Roller Coaster Tycoon mazes be like:
@cyndicorinne
@cyndicorinne 2 жыл бұрын
This approach to solving problems is quite effective as it is interesting. In computer science there are many algorithms which emulate physical processes. It is always a pleasure watching Numberphile because of its closeness to the field. Thank you 🙏 for another awesome video!
@thecakeredux
@thecakeredux 2 жыл бұрын
I love the merge between logic and programming and creativity. It's how I conceptualized creating code forever, but this illuminates that intersection so well. I'm amazed.
@martincohen8991
@martincohen8991 2 жыл бұрын
Considering that each particle has to keep track of its path, this would require a tremendous amount of storage.
@thumper8684
@thumper8684 2 жыл бұрын
If the simulation is deterministic you can recover all the data from the initial conditions.
@HappyBeezerStudios
@HappyBeezerStudios 2 жыл бұрын
How they are stuck in the first third and the density becomes progressively lower reminds me of mazes in Roller Coaster Tycoon. The way the pathfinding works causes the guests to practically get stuck (and walk back) on specific layouts with a very slim chance to move further.
@shohamsen8986
@shohamsen8986 2 жыл бұрын
This problem of maze solving screams calculus of variation. The function that minimizes the distance between the beginning and the end point subject to the wall constraints. I would model the walls as lines (some thickness) of infinite potential. So that functions intersecting the walls have answer infinite. Im sure someone must have thought about it (it would be a shame if nobody tried this tool with 500 years of research backing it up).
@leodarkk
@leodarkk 2 жыл бұрын
One of our professor at the university made us code exactly this, while of course also explaining the mathematics. It was 10 years ago and still one of my favorite algorithm, I was kind of blown away by it. As far as I remember, it also gives a very beautiful visual representation of the answer as a gradient (?), with as you said, the walls with value infinite. So yes, you are not the first to think about it, but it is indeed an awesome idea!
@shohamsen8986
@shohamsen8986 2 жыл бұрын
@@leodarkk sounds about right. I would sincerely hope I'm not the first person to come up with this idea. like i said there is 500 years of research behind these subjects.
@frankfahrenheit9537
@frankfahrenheit9537 2 жыл бұрын
Like letting an electric current flow through the maze. Pour carbon power onto the floor, same conductance everywhere, except walls which are modelled as conductors with zero conductance. Solve poisson equation of the electric field with boundary condition entry maze=1V, exit maze=0V, constant conductance everywhere except where wall present.
@rianantony
@rianantony 2 жыл бұрын
If you wanted to find the dumbest way, it'd be fun to wait for every single molecule gets out. And then highlight the path taken by the single last one to find the exit
@cyndicorinne
@cyndicorinne 2 жыл бұрын
A-maze-ing demonstration of this physical approach to problem solving, which for me as a computer scientist is always cool to see.
@johndododoe1411
@johndododoe1411 2 жыл бұрын
If you were an actual CS, you would know how entirely bogus the arguments are.
@Muhahahahaz
@Muhahahahaz Жыл бұрын
@@johndododoe1411 if you were an actual human, you would have kept this to yourself
@philippelepilote7946
@philippelepilote7946 2 жыл бұрын
30 years ago, I had the idea to "inflate" a grid of walls with random strength in order to create a "simply connected" maze. I eventually wrote the algorithm in Visual Basic for Excel, associated to the "follow-the-right-hand-wall" solver. So happy to discover that somebody else finally blew into a maze !
@valovanonym
@valovanonym 2 жыл бұрын
Je serais intéressé par les détails de ton algorithme!
@philippelepilote7946
@philippelepilote7946 2 жыл бұрын
@@valovanonym My algo is very basic. Hereafter is its pseudo-code. Unfortunately YT prevents me from giving a link in the comment so that I cannot share the Excel file. // First assign a random number to the walls of each cell For each cell in the grid assign a random value to the right and bottom walls // and taking care of grid borders Do some init While all cells have not been inflated // Loop until all cells are inflated, and each time, explode the less resistant wall on the border of the already inflated cells Do some init For each inflated cell in the grid // Find the cell whose wall (left, top, right or bottom) is the less resistant if its left/top/right/bottom cell is not inflated yet // and taking care of grid borders if the left/top/right/bottom wall is the less resistant already seen // the cell is a candidate to explode one of its walls if none of the walls already seen had the same strength remember the current cell else // Bring a little randomness randomly choose between the current cell and the other already remembered cell and remember it end end end end //for // all inflated cells have been visited : explode the less resistant wall delete the left/top/right/bottom wall of the remembered cell mark the new left/top/right/bottom cell as inflated continue end //while Bon amusement
@PlayerSalt
@PlayerSalt 2 жыл бұрын
I thought I was stupid for always turning left , which surprisingly would have got me out of this maze fairly quickly , at least quickly enough
@Aaron-cs3xl
@Aaron-cs3xl 2 жыл бұрын
So long as you don't run into a loop, which shouldn't be possible if the exits are on the outside of the maze, it will always get you through the maze.
@lonestarr1490
@lonestarr1490 2 жыл бұрын
@@Aaron-cs3xl And the maze is purely 2-D without "wormholes".
@kindoflame
@kindoflame 2 жыл бұрын
That is called the Left-Hand Rule, and it actually works very well. If the maze is simply-connected, meaning all the walls touch one another, then you are guaranteed to eventually reach the exit.
@George4943
@George4943 2 жыл бұрын
@@kindoflame And, of course, the Right-Hand-Rule works equally well in such mazes.
@NLGeebee
@NLGeebee 2 жыл бұрын
@@George4943 only for British mazes ;)
@user-pw5do6tu7i
@user-pw5do6tu7i 2 жыл бұрын
Interviewer: i see you made a maze solver, did you use AStar? This guy: *I wrote a physics engine*
@redryder3721
@redryder3721 2 жыл бұрын
It would be interesting to see what sort of maze design results in the Brownian motion taking the longest time to reach the exit. Would it simply be a zigzag path using 100% of the area of the maze or would it look more like a Tesla valve?
@freshrockpapa-e7799
@freshrockpapa-e7799 2 жыл бұрын
A Tesla valve wouldn't be anything interesting since the particles don't interact with each other.
@dmitryrybin7831
@dmitryrybin7831 2 жыл бұрын
Heuristically longer path means longer exit time, hence you want your maze tree to be a path, which results in zig-zag path maze (the zig-zag pattern can be altered aswell).
@glenneric1
@glenneric1 2 жыл бұрын
I'm thinking zig zag with as few straight-aways as possible. Though maybe a succession of ever smaller chambers with a single entry and exit for each. Would be interesting I agree.
@landsgevaer
@landsgevaer 2 жыл бұрын
@@glenneric1 Maybe as many straight-aways as possible, since on a diagonal you can reach the next box with an average step size of sqrt(1/2), whereas on a straight path the required distance is 1. Atoms don't have memory regarding their direction, and straight alleys doesn't allow you to cut corners, so to say.
@mitchellsteindler
@mitchellsteindler 2 жыл бұрын
A particle could never reach the exit... so forever
@scottbarrie1279
@scottbarrie1279 2 жыл бұрын
I would love to see how adding more molecules decreases the average time of the fastest exit
@jvdw843
@jvdw843 2 жыл бұрын
+ as a function of the length of the shortest exiting path.
@charleslivingston2256
@charleslivingston2256 2 жыл бұрын
Since he has the molecules just doing a random walk, doubling the number of molecules would cut the average time in half. If he were using pressure, I would expect the average time to drop more than that. [Edit: not true. See responses]
@jursamaj
@jursamaj 2 жыл бұрын
@@charleslivingston2256 Can't be just the inverse of the number of molecules. There is a non-zero minimum to cross the maze. Rather, I'd expect it to exponentially decay towards the minimum.
@mitchellsteindler
@mitchellsteindler 2 жыл бұрын
@@jursamaj yes
@landsgevaer
@landsgevaer 2 жыл бұрын
@@charleslivingston2256 It doesn't work like that, I fear. That would mean you could find an arbitrarily quick/short path by having an arbitrarily large number of atoms, but the shortest path doesn't have length zero. It even doesn't qualitatively scale like that when you have few atoms. Unimpeded brownian motion spreads according to a gaussian bell curve; twice as many samples doesn't get you twice as far then.
@anon6514
@anon6514 2 жыл бұрын
Matt has the best job. I love making simulations like this.
@CharlesVanNoland
@CharlesVanNoland 2 жыл бұрын
While it *is* random if people become successful, the odds become more in their favor the more they act on opportunities - and the trick to opportunities is recognizing them when they are there, which most people don't.
@xapemanx
@xapemanx 2 жыл бұрын
I confirmed this simulation; i created the same maze in a liquid and then placed my sperm on one end. amazing
@flleaf
@flleaf 2 жыл бұрын
i love the internet
@flamencoprof
@flamencoprof 2 жыл бұрын
Sorry to burst your bubble, but that solution is not forthcoming. Sperm are attracted to progesterone, which is secreted from the egg's companion cells. Sperm are not randomly swimming in every direction.
@NickCombs
@NickCombs 2 жыл бұрын
Often with optimization problems, it's a good idea to start with the dumbest solution as a sort of sanity check.
@invisibules
@invisibules 2 жыл бұрын
Or we could build the maze out of copper strips, and connect a battery between the start and end point. Use a magnetic compass to find the path, or turn the current up and watch it glow. This would even work if there were loops, like the air blowing method.
@kilimanjarocruz660
@kilimanjarocruz660 2 жыл бұрын
It's lovely that this 'demonstrates' both the pressure drop that a gas would have in such a flow and the statistical origin of the ideal gas law. Awesome.
@lucassippel7516
@lucassippel7516 2 жыл бұрын
Looks like they get halfway quite quickly. You could also diffuse gas from the exit and then check pairwise between particles from opposite ends for line of sight. Then stitch a forward path and backward path together for a complete solution. Pairwise checking might be inefficient so you could limit it to particles which are past some predefined halfway - like a vertical line down the middle of the maze. This is the sort of thing that is only obvious when you have an appropriate visualization. Always love watching these animations!
@Novalarke
@Novalarke 2 жыл бұрын
The best (but slow) way to solve a maze: pick a wall, follow it. You will never get lost.
@theblinkingbrownie4654
@theblinkingbrownie4654 2 жыл бұрын
But what if _3D_
@Hermaniac8
@Hermaniac8 2 жыл бұрын
(as long as the maze doesn't have loops)
@andvil01
@andvil01 2 жыл бұрын
@@Hermaniac8 No. You can only be stuck in the loop If you follow the inner wall of the loop. If you stick to one wall in the beginning you will never touch the inner wall off the loop. The outer wall must have an opening to the end.
@Novalarke
@Novalarke 2 жыл бұрын
Actually, I don't think that matters, as any wall loop would have to be free floating in the maze matrix, and thus defined by the outer housing which will have to be a left or right wall. But if you have a link to a maze that beats the "choose a wall" method, I'd totally dig that.
@Novalarke
@Novalarke 2 жыл бұрын
@@andvil01 - exactly, that's what I thought as well.
@Joecoleman84
@Joecoleman84 2 жыл бұрын
It's hard to explain, but brain feels refreshed by this.
@blindleader42
@blindleader42 2 жыл бұрын
I like how the automatic captions deal with Matt's accent and translates his "Brownian motion" as "brainy in motion"...🤔 Hmmm. Maybe the machine is on to something. 🙃
@marklonergan3898
@marklonergan3898 2 жыл бұрын
"...or i could do it in the dumbest way... So i switched over to python..." Shots fired!
@GeofreySanders
@GeofreySanders Жыл бұрын
Yeah I felt that one.
@PetraKann
@PetraKann 2 жыл бұрын
If the simulation ran infinitely, would all the particles find their way out of the maze?
@itismethatguy
@itismethatguy 2 жыл бұрын
Yeah i guess unless there's a place they can get stuck and keep going in cycles
@MKVideoful
@MKVideoful 2 жыл бұрын
Do not forget, some infinities can be bigger than other infinities.
@MKVideoful
@MKVideoful 2 жыл бұрын
You will end up with infinity amount of success particles and also with infinity amount of failed particles. The failed infinity amount will be bigger.
@dontbothertoreply9755
@dontbothertoreply9755 2 жыл бұрын
Yes, as all paths will be taken.
@charleslivingston2256
@charleslivingston2256 2 жыл бұрын
If there exists a path through the maze, every random walk will eventually exit
@PunmasterSTP
@PunmasterSTP 2 жыл бұрын
That was…a-maze-Ing. 😎
@dominiquelaurain6427
@dominiquelaurain6427 2 жыл бұрын
Random waks in the plane is an amazing subject. I like that "physic view" of the problem, because it is local to every particle (with its path as only memory data). I will qualify the idea more like "the blindest way" to solve a maze because same as many people in a maze with no light (bumping to a wall, and maybe another people, is the only information). There are less blind ways, if you imagine people has a lamp ligntening to the random direction, people can accelerate to the next lightened wall. Another extension is for the random step : you can imagine a lattice drawn over the maze and people are only at vertices.
@U014B
@U014B 2 жыл бұрын
This is even more brute force than brute force, and I'm all for it.
@gurgleblaster2282
@gurgleblaster2282 2 жыл бұрын
I could listen to him describe things for days lol.
@phileo_ss
@phileo_ss 2 жыл бұрын
This video reminded me of a friend who, thirty years ago, wrote a computer programme that made random seven-storey mazes in which you can walk around in and collect various items to earn points or maps to help you solve the maze.
@Noobinski
@Noobinski 2 жыл бұрын
Mazing!
@giddyjigga
@giddyjigga 2 жыл бұрын
I'd love to see all the paths overlayed to see how densely some areas were explored while other areas were only superficially discovered.
@MCLegoboy
@MCLegoboy 2 жыл бұрын
1:06 Oh... I mean it's apt, but your enthusiasm is on a whole other level there. XD
@MrLoukizz
@MrLoukizz 2 жыл бұрын
The hair dryer approach is actually the exact same as the gas approach because the hair moves (just like the expanding gas) to the point of lowest pressure. But to simulate pressure you would need to simulate particle collision with each other or calculate the local gas density in any other fashion and map it onto the labyrinth (for example counting the number of particles per square). However this approach might still fail because of turbulences ;-)
@yoxnod
@yoxnod 2 жыл бұрын
This video reminded a paper by Bennett of 1982 where he described concept of Brownian computer which solves problems by random motion, and most interestingly, he argued that RNA is basically a natural Brownian computer
@boelwerkr
@boelwerkr 2 жыл бұрын
forget "bumping" in each others. Make a repelling force. If the molecule go below a defined distance a repelling force dependent of their distance is applied (you could also make it an attraction force beyond that "0-point" to hold the cloud together). This way you can use "wrong" but much faster distance/repelling calculation. It works really great for "emulating" pressure dispersion.
@George4943
@George4943 2 жыл бұрын
There ought to be a quantum computer solution to maze solving which does "all the paths" at once.
@GGoAwayy
@GGoAwayy 2 жыл бұрын
If you can represent the problem as a quadratic unconstrained binary optimization
@liweicai2796
@liweicai2796 2 жыл бұрын
It isn't going to be faster, since you nonetheless have to obtain information of the whole map, the complexity can't be lower than linear to the size of the map, which classical computers can already do.
@johndododoe1411
@johndododoe1411 2 жыл бұрын
Quantum computers should not be allowed to exist. No honest person should forward the research into their creation and use.
@mrosskne
@mrosskne 2 жыл бұрын
@@johndododoe1411 Why?
@johndododoe1411
@johndododoe1411 2 жыл бұрын
@@mrosskne Currently, quantum computer algorithms exist that will break even encryption and signature tech widely deployed. We need to hold back quantum computer creation until everyone has non-NSA post-quantum encryption protecting everything they've done since birth. Which won't be this century.
@Martial-Mat
@Martial-Mat 2 жыл бұрын
You could add an evolutionary "movement with purpose" parameter to this. On a grid with right angled cells, you can immediately simplify by limiting the movements to 45 degree increments, and by eliminating "back on yourself" as an option, you could speed up the solution by 12.5%. If rather than adding a wind modifier, you added a weak suction modifier, you could refine still further.
@gedstrom
@gedstrom Жыл бұрын
I still remember a maze generation program that I coded in Basic back in 1978...45 years ago! I had a lot of fun with it in my very first personal computer.
@rg8766
@rg8766 2 жыл бұрын
"...or I could, you know, solve the maze in the dumbest way. So I switched over to Python..." :)
@FuncleChuck
@FuncleChuck 2 жыл бұрын
Oh so that’s how my city’s roads and utilities were planned! I always wondered.
@caparn100
@caparn100 2 жыл бұрын
3:50 I think the example of putting a fan to create wind is really just the same as adding a lot more molecules to the maze.
@longleaf1217
@longleaf1217 2 жыл бұрын
only if you program in the collisions between each of the molecules which would have the same effect of creating higher pressure where there are more molecules. He mentioned the he has it programmed now each molecule just ignores all the others like they aren't there. so there is no pressure in the system. all adding more molecules might do is find the solution faster purely as a result of it being more likely you have a lucky molecule. the point of having a fan is just to create high and low pressure, which is the same effect you would get with the collisions.
@jursamaj
@jursamaj 2 жыл бұрын
No, the way he has it implemented, the molecules have no effect on each other, so more molecules doesn't actually matter. The wind would change the distribution of the random steps, making each molecule more likely to step towards the exit.
@caparn100
@caparn100 2 жыл бұрын
@@longleaf1217 That sounds like a much more lengthy running and complicated program. It would be much simpler if each particle, for each move, just picked a random adjacent cell to the one it's in that it hadn't been in before and doesn't have a wall along the side then to get the result just select the particle that exists the maze first.
@ChrisLee-yr7tz
@ChrisLee-yr7tz 2 жыл бұрын
@@jursamaj What would the 'wind' be and how would it interact with the molecules? What would makes the wind different to the path finding molecules? Surely the whole idea of a wind is just having the molecules interact and flood the maze with more of them?
@bable6314
@bable6314 2 жыл бұрын
@@ChrisLee-yr7tz The wind would literally just be a net force in the direction of the exit that gets weaker as a particle gets further from the start.
@V1ctoria00
@V1ctoria00 2 жыл бұрын
Collision physics is in so many video games. Look at "oxygen not included" great example of a game where you could literally use gas to fill a maze.
@handreieiacasa
@handreieiacasa 2 жыл бұрын
Great, now we know that in order to escape backrooms we just need to turn ourselves into a gas
@cbuchner1
@cbuchner1 2 жыл бұрын
How to solve a maze with a fart
@markkaidy8741
@markkaidy8741 2 жыл бұрын
Program a maze to solve for large prime numbers (one path to the prime) and then use it for solving unknown primes. This method may be invaluable.
@squatty9994
@squatty9994 2 жыл бұрын
turn those paths into wall sized art, they are really awesome.
@djayers
@djayers 2 жыл бұрын
Love it. How can you not go "wheeee!" at the start, "go on, go on..." towards the end :)
@djayers
@djayers 2 жыл бұрын
I would think the bouncing-ball/gas approach could be an efficient solution (hard to prove), and probably isomorphic to the fluid dynamics approach
@Martial-Mat
@Martial-Mat 2 жыл бұрын
Given enough time, EVERY molecule would eventually get out by sheer random chance. Imagine if you were betting on a particular molecule and it randomly got all the way to the exit cell, before bouncing off a wall and working all the way back to the start position!
@MaryamMaqdisi
@MaryamMaqdisi 2 жыл бұрын
That’s hilarious to me fsr
@Martial-Mat
@Martial-Mat 2 жыл бұрын
@@MaryamMaqdisi :)
@mustelidify
@mustelidify 2 жыл бұрын
I'm interested in letting all the molecules escape and looking at the path of the LAST molecule to escape and what proportion of the maze area it traversed.
@azyfloof
@azyfloof 2 жыл бұрын
Now we just need Steve Mold to built a maze out of clear perspex and blow smoke through it to see if the smoke "solves" the maze :D
@punkdigerati
@punkdigerati 2 жыл бұрын
You've described survivorship bias with the random billionaire biography bit.
@JohnLeePettimoreIII
@JohnLeePettimoreIII 2 жыл бұрын
dumbest way: smash it to powder with a hammer, then throw the maze-powder in the air while loudly declaring, _"I win!!"_
@mekkler
@mekkler 2 жыл бұрын
Maybe that concept could be applied to the traveling salesman problem.
@aveenmahabal
@aveenmahabal 2 жыл бұрын
pick a direction (left or right) always make that turn and follow to the end and exit
@dovos8572
@dovos8572 2 жыл бұрын
doesn't work in every maze (it depends on what/where the goal is)
@Math.Bandit
@Math.Bandit 2 жыл бұрын
That fails if there is a loop though, right?
@dovos8572
@dovos8572 2 жыл бұрын
@@Math.Bandit if the maze is from outside to outside then it works even with loops. it can fail if the goal or start is somewhere isnide the maze and all starting walls aren't connected to the outside wall.
@Math.Bandit
@Math.Bandit 2 жыл бұрын
@@dovos8572 Even if it's from outside to outside, wouldn't it fail to a very simple "around a block" type of loop, where you're making the same four left (or right) turns around a single area over and over again?
@zebfross
@zebfross 2 жыл бұрын
Love this guy's stuff! Always fascinating
@redountilgreat
@redountilgreat 2 жыл бұрын
Idea: Apply a value of zero to every square of a maze. Create pressure and sucktion on entry and exit at every iteration: Add one at the entry square and substrackt one at the exit square. Let both spread until they connect. Interesting? Wonna try? I can't code well enough. Have fun.
@WhiteSpatula
@WhiteSpatula 2 жыл бұрын
If you had a maze where every wall was a mirror, and you shone a laser into it from the starting point, sweeping around to test all possible angles of entry, I wonder what sort of correlations would manifest between successfully exiting the maze and the maze’s key attributes such as block size (vs laser width), overall dimensions, and complexity. I think it might also be fun to see a geometry wiz or a billiards pro venture some guesses beforehand.
@b.a.r.c.l.a.y
@b.a.r.c.l.a.y 2 жыл бұрын
i wanna know this too i imagined more like a circle, with its circumference made of infinite points, and all of them bouncing around the walls until it reaches the end i wonder what the pattern of the circle would look like if every point that went to the exit was colored differently
@GodwynDi
@GodwynDi 2 жыл бұрын
Didn't they do a similar video on that already? The illumination problem is the one I was thinking of. Box where it is impossible for light to reach all of it from a single source.
@randy7894
@randy7894 2 жыл бұрын
Cool thing about Matt is that he also sees art in algorythms.
@alienmoonstalker
@alienmoonstalker 2 жыл бұрын
Great content! I am now motivated to try the fluid dynamics method to solving the maze.
@velsni
@velsni 2 жыл бұрын
just done, it works nicely with CFD
@LIA-52
@LIA-52 2 жыл бұрын
9:23 Nice word choice, seeing how you're guessing with a gas simulation.
@sumantchopde9039
@sumantchopde9039 Жыл бұрын
Just today I had a test where I had to simulate maze-solving using Monte-Carlo simulations. This algorithm is quite cool too!
@robertmchugh2001
@robertmchugh2001 2 жыл бұрын
Well done … thanks for walking through the code!
@HappyBeezerStudios
@HappyBeezerStudios 2 жыл бұрын
"Every batch will eventually have a winner" I'd go so far to say every particle eventually finds the exit, given enough time.
@RickJaeger
@RickJaeger 2 жыл бұрын
2:39 You're telling me the dumbest way of solving a maze is farting at the entrance? Yeah, okay, I guess that comports.
@cmuller1441
@cmuller1441 2 жыл бұрын
This is exactly what you do when you make coffee with a percolator...
@traywor
@traywor 2 жыл бұрын
You could increase the random direction moving, the more molecules are nearby, to simulate pressure, while, when the pressure drops, it keeps going more often until it hits a wall.
@alexmcmahon2810
@alexmcmahon2810 Жыл бұрын
"That's harder to program." Yeah, running a molecular dynamics simulation on your maze would be a pretty horridly inefficient (but awesome) to way traverse a maze.
@Veptis
@Veptis Жыл бұрын
what about a random Fourier series? As a cyclist. I often plan my routes not to be the shortest or "fastest" but with the least or no traffic lights so I don't have to stop. It's a navigation problem which is finding the optimal path through a graph. But all nodes (road intersections) with traffic lights get removed.
@FransHenskens
@FransHenskens 2 жыл бұрын
This would be a more accurate representation of "pressure" in a gas if the molecules stuck in a pathway gave an indication of how many other molecules are around them. Pressure increases as more molecules are constricted in a confined space. If you wanted to keep the pathing algorithm the same, you could have the update mechanism change the direction of travel of a particle enters a cell reactive to a pressure vector updated by its surrounding cells.
@ferretyluv
@ferretyluv 2 жыл бұрын
But then he’d have to incorporate rheology formulas.
@TaohRihze
@TaohRihze 2 жыл бұрын
11:30 and around it, the maze does not seem to match the particles. If you notice the lower left part and the upper left is separated, yet there is a LOT of molecules going down into the area.
@valj137
@valj137 2 жыл бұрын
I checked! The particles are following the maze that's shown at the very beginning of the video 0:09, NOT the maze that is at 11:30. I think that's just one of the other mazes he had simulated. But for the particles' paths he showed the beginning maze. :)
@guyincognito.
@guyincognito. 2 жыл бұрын
1:20 Thinking that success is just luck of the draw will guarantee your own failure.
@Spencer0616Gaming
@Spencer0616Gaming Жыл бұрын
you could improve this by giving each particle a radius and allowing particle collision, it seems the current method doesn't use a realistic gas particle as they do not interact with one another. This could possibly increase the variation in trajectories of the particles thus acting much more like a high-low density situation and possibly speeding up the solution time. As it stands you may as well use one particle with a minutely curved taken path. Given one particle or a set number I would assume that there will always exist some maze that can effectively capture every particle in an infinite loop, the curve on the trajectory for a perfect maze finder is questionable but would be interesting to learn more about. Supposing every maze has a specific curve that makes it solve the maze the fastest. Thank you for the videos
@vsikifi
@vsikifi 2 жыл бұрын
Long ago I wrote a program that generated similar mazes but with a somewhat different algorithm: I started with a rectangular grid with all the possible walls present. I picked a random cell and then I did a random walk starting from that cell that knocked down the walls along the route it traversed, This random walk avoided going to already visited cells. When it ended up in a situation where it couldn't move into any direction without hitting a visited cell of maze edge, I picked a new random unvisited cell and started a new random walk from there but avoiding only cells visited by that walk. When it hit a cell visited by an earlier walk, it knocked down that wall and stopped. Then I repeated this until there was no more unvisited cells. The end result was a similar maze with unique routes between every cell pair but no loops.
@Jkauppa
@Jkauppa 2 жыл бұрын
gas pressure simulation is fast, breadth first style propagation, or also electric current
@Jkauppa
@Jkauppa 2 жыл бұрын
if you have max 1 particle in cell pressure, you expand in new cells always, through known path
@Jkauppa
@Jkauppa 2 жыл бұрын
ironically most of your science is done this way you just demonstrated, rip
@Jkauppa
@Jkauppa 2 жыл бұрын
you claim to be smart but you are not, complex is not always better than simple, monte carlo random walk simulations is what you just demonstrated
@Jkauppa
@Jkauppa 2 жыл бұрын
ok so first construct a tree of all possible connections, then find the shortest path to the exit
@Jkauppa
@Jkauppa 2 жыл бұрын
cause of law is trash ways of doing things
@honeybee9455
@honeybee9455 2 жыл бұрын
Instead of moving in a random 360 direction per tick, why doesn't it move in a random cardinal direction?( Per tick moving up, down, left or right and not some random theta). Would this be less computationally taxing?
@johnchessant3012
@johnchessant3012 2 жыл бұрын
Love this guy!
@nathanielmoreland5271
@nathanielmoreland5271 Жыл бұрын
I hope to see matt in another video he's so rad. Should bring him back again. and again.
@jasminecruickshank2343
@jasminecruickshank2343 2 жыл бұрын
I love “this one became a billionaire and wrote a biography about all the great decisions it made but really it was just random”
@jasminecruickshank2343
@jasminecruickshank2343 2 жыл бұрын
Shout out to the triggered capitalists
@kevnar
@kevnar 2 жыл бұрын
I wonder if it would be better or worse if particles repelled each other. They would expand down the maze, filling every path until one of them got to the exit.
@FloydMaxwell
@FloydMaxwell 2 жыл бұрын
This isn't the dumbest way, but rather the random way, to solve a maze. The guaranteed / deterministic way...is to put your right hand on the maze wall, and never take it off. Eventually you will find the exit.
@landsgevaer
@landsgevaer 2 жыл бұрын
Depends a bit, only if the maze is planar and the start & finish are both on the "outside". Doesn't work to reach the exit if you get lost in a cave system.
@pepsalt
@pepsalt 2 жыл бұрын
been following this guy on twitter for so long, nice to see he made it :D
@LiamPilot120
@LiamPilot120 2 жыл бұрын
There’s a bug in his code, looks like molecules can cross walls.
@CamAlert2
@CamAlert2 2 жыл бұрын
this is more something akin to a computerphile video
@nhillery1
@nhillery1 2 жыл бұрын
Brady - I’m surprised you didn’t ask about the particle that finished second (or closest, since I guess the simulation stopped before it could finish). We could only dream of being the winner, but it feels so much more realistic that we finish close.
@thecarman3693
@thecarman3693 2 жыл бұрын
If a maze has no free walls (walls that do not touch the outer perimeter through continuous contact) it can always be solved by keeping (remaining in contact) to either wall from the entrance. I have also found that many mazes can be solved more easily by traveling through them in reverse.
@Henrix1998
@Henrix1998 2 жыл бұрын
3:50 that's a Steve Mould video idea if I have ever seen one
@sleepib
@sleepib 2 жыл бұрын
I wonder what the best strategy is for picking a simulation depth. If you cut off the simulation early you have more chances to get lucky, but you also risk cutting whatever path gives you the best result so far, or in extreme cases might never find a solution.
@fegolem
@fegolem 2 жыл бұрын
It reminds me of when Gandalf chose the path in Moria. The right path smelled less bad.
@justicejeremy6010
@justicejeremy6010 Жыл бұрын
it's amazing how they stretched this video into 15 minutes
Two Candles, One Cake - Numberphile
14:22
Numberphile
Рет қаралды 289 М.
Are there 10^272,000 Universes? - Numberphile
15:05
Numberphile
Рет қаралды 298 М.
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 7 МЛН
когда не обедаешь в школе // EVA mash
00:57
EVA mash
Рет қаралды 2,7 МЛН
БЕЛКА СЬЕЛА КОТЕНКА?#cat
00:13
Лайки Like
Рет қаралды 1,6 МЛН
The Hydra Game - Numberphile
21:54
Numberphile
Рет қаралды 443 М.
How can a jigsaw have two distinct solutions?
26:23
Stand-up Maths
Рет қаралды 427 М.
The Lightning Algorithm - Numberphile
12:24
Numberphile
Рет қаралды 543 М.
The Lazy Way to Cut Pizza - Numberphile
14:26
Numberphile
Рет қаралды 259 М.
An Integration Conundrum - Numberphile
14:32
Numberphile
Рет қаралды 218 М.
Absolute Primes - Numberphile
14:27
Numberphile
Рет қаралды 129 М.
History Summarized: Gilding the Nile
11:08
Overly Sarcastic Productions
Рет қаралды 10 М.
The FAKE words in the dictionary
14:25
RobWords
Рет қаралды 436 М.
The Light Switch Problem - Numberphile
18:31
Numberphile
Рет қаралды 607 М.
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 7 МЛН