What School Didn't Tell You About Mazes

  Рет қаралды 271,878

mattbatwings

mattbatwings

Күн бұрын

Пікірлер: 846
@mattbatwings
@mattbatwings 5 ай бұрын
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/mattbatwings You’ll also get 20% off an annual premium subscription.
@GrowMode_YT
@GrowMode_YT 5 ай бұрын
You cooked in this video
@SukiYaki1904
@SukiYaki1904 5 ай бұрын
why was this posted this 6 days ago
@CoolioGamingz
@CoolioGamingz 5 ай бұрын
6 days ago, and the video is 2 minutes ☠️
@GrowMode_YT
@GrowMode_YT 5 ай бұрын
​@SukiYaki1904 It was privated. You can even see Capo with a comment 6 days ago
@lucamastermanYT
@lucamastermanYT 5 ай бұрын
I was like the 450th person to watch this video, its my pb
@that0neguy_su-suru
@that0neguy_su-suru 5 ай бұрын
i love how matt started out as a minecraft professional redstone player to teaching us the beauty of a maze
@error.418
@error.418 5 ай бұрын
The computer science pipeline
@spitefulginger
@spitefulginger 5 ай бұрын
@aghaalipatrickstarNo, he is. He just makes a SoME submission for 3Blue1Brown each year.
@gylbard8237
@gylbard8237 5 ай бұрын
of math
@TaxMax5678
@TaxMax5678 5 ай бұрын
He's one of the lucky ones who do what they love
@eneaganh6319
@eneaganh6319 5 ай бұрын
He still is mainly a Minecraft KZbin, this is for SoME
@epicboy330
@epicboy330 5 ай бұрын
Now we need the headache video about 3D mazes
@jindmen
@jindmen 5 ай бұрын
We actually do not, apart from the definition of maze as a grid, nothing else changes. That is the neat part about trees, they preserve most of the characteristics no matter how many adjacent nodes each node has :)
@bryanfongo327
@bryanfongo327 5 ай бұрын
A 3D maze would work the exact same way
@gamingcat6668
@gamingcat6668 5 ай бұрын
@@jindmen 4d :>
@austinneilson2870
@austinneilson2870 5 ай бұрын
It's a tree, which means it works the exact same in every dimension.
@dadamaldasstuff1816
@dadamaldasstuff1816 5 ай бұрын
It would work with 1d mazes too. It just wouldn't be fun.
@captainluma7991
@captainluma7991 5 ай бұрын
I'm so glad you enjoyed the algorithm! I have been a big fan of your channel for a while now, so having my work featured in your video is so cool to me. Great video Matt!
@carterstach6034
@carterstach6034 5 ай бұрын
It is the captainluma!
@carterstach6034
@carterstach6034 5 ай бұрын
I actually saw lumas video before this one came out lol! 8:37
@error.418
@error.418 5 ай бұрын
Great work on "origin shift!" Going to have lots of fun playing with it.
@Anunak255
@Anunak255 5 ай бұрын
nice
@vibaj16
@vibaj16 5 ай бұрын
@@carterstach6034 same
@muno
@muno 5 ай бұрын
That changing-maze algorithm is actually so cool. Now part of me wants to make a game with a maze just so I can implement it LOL
@JoecountryGaming
@JoecountryGaming 5 ай бұрын
Agreed
@donaldhobson8873
@donaldhobson8873 5 ай бұрын
The purple dot is the player (who can move freely). All the enemies are stuck chasing the player through the maze, but they are faster than you.
@nxsus
@nxsus 5 ай бұрын
Gamedev moment
@theramendutchman
@theramendutchman Ай бұрын
Same here; perhaps via one that's not necessarily a perfect maze or maybe never one, and you need to have the maze change in a way that reveals macguffins or the exit!
@gralkekd1574
@gralkekd1574 5 ай бұрын
The fact that now there is the actual new graph algorithm, that was invented specifically to create randomly generated mazes in Minecraft really blows my mind. Like, imagine that someday in the future there is going to be some mathematical summit, and a mathematician starts their lecture with words: "So, there's this game called Minecraft..."
@Nevir202
@Nevir202 5 ай бұрын
"...imagine that someday in the future there is going to be some mathematical summit, and a mathematician starts their lecture with words: "So, there's this game called Minecraft..." If that hasn't ALREADY happened, given the insane math involved in the game, I'd be shocked.
@jursamaj
@jursamaj 5 ай бұрын
I mean, the fact that it happened for Minecraft doesn't have any effect on the algorithm. Notice how Luma's video, and this one, made very little reference to MC. That's because the setting is irrelevant. The algorithm is what it is, in any setting.
@gralkekd1574
@gralkekd1574 5 ай бұрын
​@@jursamaj That was kinda the point. Surely, the algorithm may found its applications in very different branches of science, math is math, but without Minecraft it could have never been created. There are examples when a solution to a certain problem was found in a completely irrelevant research (I believe, Veritassium addressed something like this in his video on theory of knots, but I may be wrong).
@Nevir202
@Nevir202 5 ай бұрын
@@jursamaj The conditions under which new math has been created are always relevant when discussing the creation of said math. What are you talking about?
@CorrectMyGrammarPls
@CorrectMyGrammarPls 5 ай бұрын
​@@Nevir202 I dont want to sound rude but math isnt created, its discovered
@malevolentmoose
@malevolentmoose 5 ай бұрын
One problem with using origin shift to generate mazes is that as long as it moves purely randomly, it might take an exteremely long time to reach some parts of the maze, if it's large enough. What I love though is that by manipulating the chances to pick the adjacent dots you could direct the root to go in certain directions or towards a specific point, effectively also creating a pathway that roughly leads that way. Then, how much you change those probabilities will affect how much the path twists and turns along the way. So, you can start from a random maze and carve paths through it, to make sure that the rough layout and structure fits your specific needs. There's just so many possibilities to modify and manipulate it, and it can be easily adapted for non-perfect, off-grid and any other mazes as well, as long as you can transform them into a graph. What I'd also note is that this isn't really an algorithm, and instead probably just an operation that takes a root directed tree and returns a root directed tree, but changed in some way. There's quite a lot of those, so someone has probably already discovered it a long time ago, just nobody's been really using it to generate or modify mazes.
@mattbatwings
@mattbatwings 5 ай бұрын
that is very cool! this made me realize how versatile of a tool it really is.
@_Dearex_
@_Dearex_ 5 ай бұрын
Also, couldn't you just use more origin points and calculate them seperately? As each step is always a perfect maze, just throw in more origins to randomize it more quickly
@suhaskanuganti7967
@suhaskanuganti7967 5 ай бұрын
@@_Dearex_ wait how would that work tho because if u have 2 origin points u have to consider what points go to each origin point and it may like become more complicated as u have to figure out which point refers to which origin point if u could explain it would really be appreciated also i really want veritasium to make a vid on this topic lmao
@malevolentmoose
@malevolentmoose 5 ай бұрын
​@@_Dearex_ Not really, cause you have to rearrange the tree each time you change the root so that all connections point towards it. I don't think it's possible to calculate them simultaneously, though reselecting the root once in a while is an option. Something you can do is keep a list of all unexplored dots, which then allows you to do a lot of different stuff, for example increasing the chance of moving in the direction of a cluster of unexplored dots, forcing the root to move to an unexplored dot if available (which makes it similar to a lot of maze generation algorithms), or reselecting the root as one of the unexplored dots if it's been running around the same area for too long already.
@pmnt_
@pmnt_ 5 ай бұрын
I have to disagree with calling origin shift "not really an algorithm". Purely random movement is the core of maze generating algorithms and "taking extremely long time to reach some parts of the maze if it's large enough" is true for depth-first-search and hunt-and-kill algorithms as well. DFS is a bit faster at the cost of memory. The difference is that origin shift produces a perfect maze after every iteration, whereas DFS and HAK produce only one perfect maze after the last iteration.
@p2beauchene
@p2beauchene 5 ай бұрын
I've been an algorithmics teacher for some years (after beeing a software engineer for more than 5), so I joined to learn about RedStone. I'm amazed by how much and quick I learned about algorithmics. Thanks.
@Diamondsword85_RS
@Diamondsword85_RS 5 ай бұрын
Wow, a teacher that's learning about minecraft?! Finally someone that understands why people (at least I) like to play Minecraft.
@p2beauchene
@p2beauchene 5 ай бұрын
​@@Diamondsword85_RS To be be clear I was a MineCtaft player way before I was a teacher, but my students were mostly gamers so the MineCraft analogies I used usualy landed.
@p2beauchene
@p2beauchene 5 ай бұрын
@@Diamondsword85_RS Is my avatar clear enough to you ? I'd appreciate feedback.
@p2beauchene
@p2beauchene 5 ай бұрын
One of my student even drew a Creeper on my whiteboard, minding every pixel. I was amazed and delighted.
@A_Random_Melon_Pult
@A_Random_Melon_Pult 4 ай бұрын
man I wish I had a teacher as cool as you
@SirPogsalotCreates
@SirPogsalotCreates 5 ай бұрын
"first, we need to define what a maze is." "...we're just gonna make it up"
@mattbatwings
@mattbatwings 5 ай бұрын
welcome to all of math
@SirPogsalotCreates
@SirPogsalotCreates 5 ай бұрын
@@mattbatwings valid
4 ай бұрын
@@mattbatwings fr
@DankeMart
@DankeMart 5 ай бұрын
Why the hell did I not realise it was mattbatwings until the 9th minute 😭
@Mustafa-6331
@Mustafa-6331 5 ай бұрын
You're not alone.
@John17TheOGmp4
@John17TheOGmp4 5 ай бұрын
I saw mattbatwings and I click
@guestIdk-ni9hb
@guestIdk-ni9hb 5 ай бұрын
Same; I thought this was 3b1b
@idiot528
@idiot528 5 ай бұрын
@@guestIdk-ni9hb Bro how do you not remember what grants voice sounds like
@aimaniskandar476
@aimaniskandar476 5 ай бұрын
same
@SolunaStarlight
@SolunaStarlight 5 ай бұрын
The "no looping" quality of a perfect maze is very interesting to me, because it basically means that perfect mazes and braided mazes (mazes with no dead ends) are mutually exclusive, because in order to avoid dead ends you have to make the maze loop back on itself in some points.
@illusionx1797
@illusionx1797 5 ай бұрын
not necessarily, an n×1 rectangle could be a perfect and braided maze. Also, for any grid, if you go place the start in the lower left corner, and go straight till the lower right corner, go up, continue until the left edge, etc. You would also geg a perfect and braided maze
@BryanLu0
@BryanLu0 5 ай бұрын
​@@illusionx1797Wouldn't the ends of the rectangle be dead ends?
@illusionx1797
@illusionx1797 5 ай бұрын
@@BryanLu0 if we place the start and ending points at the ends then no. However, as far as graph theory goes, there have to be at least two pendant vertices, which are nodes with one connection. If there are less than two, then the graph/maze has a loop. Basically, in graph theory, no looping and graphs with no "dead ends" ARE mutually exclusive, but in mazes not necessarily since we can place the end and starting points at the dead ends
@SgtSupaman
@SgtSupaman 5 ай бұрын
The only intersection between perfect mazes and braid mazes is just a singular path from start to finish, so it is trivial to the point that most would not consider it a maze (though I suppose it technically still would be). Practically speaking, yes, the two are mutually exclusive.
@triffid0hunter
@triffid0hunter 5 ай бұрын
A maze with exactly two cells adjacent to every cell except the start and end (eg a straight hallway, then twist it as you please) is both perfect and braided - but these are usually called labyrinths :P
@Misstborn
@Misstborn 5 ай бұрын
I'm pretty early in the video, but I just wanted to mention my favorite maze generating algorithm; the growing tree it's basically what Matt showed at about 2 minutes, drawing a path to a new cell and removing the wall that blocks that path. What's really nice about it is that by just changing 1 number, you can really change the outcome to all sorts of different things. That number being the percent chance that the next cell is adjacent to the current cell. If it's a high number, then you get long snaking pathways, whereas with a low number you get lots of short branches with numerous twists and turns.
@RaPsCaLLioN1138
@RaPsCaLLioN1138 5 ай бұрын
I just came across Luma's algorithm the other day. Been working on compacting.
@eagle32349
@eagle32349 5 ай бұрын
Crazy Maze Idea: Imagine the seed for a random number generator being the coordinates of the origin and that you can "open doors" between "rooms", but each rooms is randomized based its coordinates and the origin's. Now imagine that if you enter a room and close the door behind you, the origin becomes the new room! That means, every time you close the door behind you and then open it again, you enter a completely different room which is technically at the same position as before, but is in no way related to the previous state of the room. Now imagine you created a room generator based on a number, that number you can get from the randomizers and essentially create an actually infinite and unique backrooms-like experience, but it's just a maze, with special properties, but still just a maze!
@ShuAbLe
@ShuAbLe 5 ай бұрын
I didn't get it, but is seems there is some interesting in there somewhere. mind explaining more?
@ThomasMcMillin
@ThomasMcMillin 5 ай бұрын
I think I get it. So in this maze, the origin is the player. And as the player moves, so does the origin. The room that you just left would then be an outward vertex, so you remove it. And eventually when this vertex is effected again, it can be randomly generated into a new type of room to create what is simultaneously an infinitely changing maze, but it also adds infinitely changing rooms within the maze. That's actually brilliant.
@BryanLu0
@BryanLu0 5 ай бұрын
​@@ShuAbLeBasically, you can change the contents of the adjacent room by closing and opening the door. I don't actually think there are any implications for the maze, since the OP specified that the maze starts with all the doors open.
@PinkPandaKatie
@PinkPandaKatie 5 ай бұрын
I did a bit of research on maze generation many years ago when I was making a clone of the old Windows 3D Maze screensaver. The one I settled on was Kruskal, which is great at making perfect mazes because it can generate every possible one with equal probablility. All of the randomness is confined to a single shuffle: Step 1: Assign a unique number to each vertex. Step 2: Add all the potential edges to a list. Step 3: Shuffle the list. Step 4: Iterate the list: For each edge, compare the numbers of the vertices it would connect. If they are equal, skip to the next edge. If they are unequal, connect the two vertices, and change the numbers on the vertices so they are equal, as well as any connected neighbors. The way it works is that all verticies with the same number have exactly one path between them. because we don't join vertices with the same number and when we join two unconnected paths we set their vertices to the same number.
@arthurhill8185
@arthurhill8185 5 ай бұрын
huh. that origin shift algorithm is really cool. you could shuffle the maze *while someone is inside it* and still guarantee they can find a way out, I think.
@DqwertyC
@DqwertyC 5 ай бұрын
Yup! Or you could wire it up so someone is manually (instead of randomly) moving the origin around while someone else is trying to solve it, to make it a competitive challenge.
@HakanBasbay
@HakanBasbay 5 ай бұрын
3mattbat1wings
@thatcatthatalwayseatsyourchees
@thatcatthatalwayseatsyourchees 5 ай бұрын
3matt1batt
@0xABADCAFE
@0xABADCAFE 5 ай бұрын
Winning
@gregorybrannin-mooser4686
@gregorybrannin-mooser4686 5 ай бұрын
3blue1brown reference
@MisonGD
@MisonGD 4 ай бұрын
What’s that a 3 blue 1 brown reference
@MisonGD
@MisonGD 4 ай бұрын
@@gregorybrannin-mooser4686aww you beat me to it
@jadengames.3662
@jadengames.3662 5 ай бұрын
2:43 you just gave me an idea for a interactive 3d maze.
@greenguydubstep
@greenguydubstep 5 ай бұрын
i can see the sebastian league inspiration here
@RubyPiec
@RubyPiec 5 ай бұрын
I myself see 3b1b inspiration tbh, but thats probs because its using Manim
@zeldek
@zeldek 5 ай бұрын
lmao I wouldn't be surprised if both of them made a video about it
@deleted_handle
@deleted_handle 5 ай бұрын
just like crabs they are all evolving into the same style.
@sealpup3775
@sealpup3775 5 ай бұрын
I see that 😂
@Asymmetrization
@Asymmetrization 5 ай бұрын
I see zach star ​@@RubyPiec
@Awes0meBadger23
@Awes0meBadger23 5 ай бұрын
School, could you actually help me for once?
@Arch-mv5te
@Arch-mv5te 5 ай бұрын
fr man
@prohakerofficial
@prohakerofficial 5 ай бұрын
No :D Instead, we are going to teach you the most useless stuff ever!
@error.418
@error.418 5 ай бұрын
School taught me maze generating algorithms, we just need more schools to care, too. It's part of most computer science curricula under an algorithms course, usually combined with learning data structures, too. (Many places will call this class DSA: Data Structures and Algorithms)
@Arch-mv5te
@Arch-mv5te 5 ай бұрын
@@prohakerofficial student: man why the fuck do we need to learn why george washignton stepped for the 7593th time in 1742??? school: did you know that that computer mice are made out of plastic, and plastic is made from cellulose, coal, natural gas, salt and crude oil?
@katakana1
@katakana1 5 ай бұрын
@@error.418 I learned some of that through a summer program last year, it was cool
@JordanMetroidManiac
@JordanMetroidManiac 5 ай бұрын
That truly is a beautiful algorithm! My mind doesn’t get blown easily, but it did this time, probably because mazes are intuitively undirected trees, yet this algorithm uses directed trees to optimize what would likely have to be a brute force search on undirected trees to check if some modification to the maze preserves perfection. Thinking about it a bit longer, the brute force search on undirected trees requires a lot of calculations, but this algorithm makes all those calculations once (to determine the directions of the edges), stores those calculations as a “state”, and then reuses the state (which is equivalent to part of the brute force search) to quickly check if a modification can be made to the maze that preserves perfection.
@frankhooper7871
@frankhooper7871 19 күн бұрын
Over 40 years ago, I wrote a program to generate a random maze on a BBC-B microcomputer. No idea now how I did it LOL
@Matteo-dk1ee
@Matteo-dk1ee 5 ай бұрын
I saw the Captainluma's video just a week ago, it's so cool to see you talk about this alg too
@SuperMaramau
@SuperMaramau 5 ай бұрын
This is the first time I've seen a video of yours. I'm impressed by the quality and clarity of your explanations. Subscribed!
@DqwertyC
@DqwertyC 5 ай бұрын
Thinking about mazes as directed trees is actually super helpful. Each "cell" only really needs to know one piece of information, which direction it's facing. This also makes some algorithms more efficient, or at least more lightweight. For DFS, backtracking is managed by just going back into the cell the current cell is pointing towards, and you know you're finished when you've backtracked to the starting cell. A couple years back, I made a DFS generator in Minecraft that worked using just 5 command blocks, then later made an admittedly very ugly redstone maze generator that took over 10 minutes to run, but both relied on this idea of the cell remembering the direction it was facing to handle backtracking.
@jonipaliares5475
@jonipaliares5475 5 ай бұрын
This was actually so cool, and you sure got talent for making 3b1b style explainers!
@Lazauya
@Lazauya 5 ай бұрын
Luma's video was rec'd to me recently, and I saw this video in my feed I instantly thought of that. Neat!
@tylerbakeman
@tylerbakeman 5 ай бұрын
4:00, There are some words in math that we use for similar topics. If every cell only points to at least one other cell (because we’re ignoring moving backwards), then we have a Connected, Directed Graph. Since there are no loops: (no two cells can point to the same cell), then we have a Connected Directed Acyclic Graph (typically referred to as a DAG) DAGs are types of Tree-Spreads, which means we can represent all of the Cells in that DAG, using the standard tree in comp sci. Each Cell points (has an extroverted half-edge) to at least one other cell. Typically, moving backwards in graphs makes sense on paper, so making each Edge bi-directed,,, or having an Undirected Graph could be more powerful. So, consider making the model more complicated from a connected DAG, and turning it into an connected Undirected Acyclic Graph. There is also this notion of a Partial Order... (Posets are more specific and tend to create loops)… It might be helpful to refer to if you would like to create a label for each cell, or if you wanted to index them specially. Keep in mind, all of this graph stuff is luckily in a 2D Rectangular Affine Space. So you have all of the benefits and optimizations that come with that coordinate system. So, you can potentially use Quad-Trees and Marching Squares,,, whereas in other Graphs that might not be ideal.
@tylerbakeman
@tylerbakeman 5 ай бұрын
There’s a lot of big words in there on purpose. For research opportunities. If anything, excuse my inaccuracies.
@geochonker9052
@geochonker9052 5 ай бұрын
Better teacher than any college professor. Excited for the new videos!
@qfurgie
@qfurgie 5 ай бұрын
saw Luma’s videos a few weeks ago and was so impressed
@keesakkermans7488
@keesakkermans7488 5 ай бұрын
So when comes the video 'i made a maze generater whit only redstone' coming?
@error.418
@error.418 5 ай бұрын
He pointed us to a good one in this video, by CaptainLuma. It's in the description, too.
@hears__
@hears__ 5 ай бұрын
Keeping this video as my oral presentation for next year, tysm
@ThinkWithGames
@ThinkWithGames 5 ай бұрын
It's cool to see other people showing maze algorithms. I had done a bit with the depth first search way in the past, but that origin shift idea is cool too! Props to Luma
@Herpling8
@Herpling8 5 ай бұрын
Nice video. The origin shift algorithm is pretty nice, i didn't expected that. It can be really good for slightly changing already existing maze. For creating maze will be easier to use DFS. You can also use MST to create mazes like this. I thought you were going to use it before I saw the end :)
@hjagu1323
@hjagu1323 5 ай бұрын
Really nice too see a mattbatwing video in a kind of three blue one brown style. This video was awesome!!
@Inspirator_AG112
@Inspirator_AG112 5 ай бұрын
*[**06:41**]:* I think you can also make it do both directions across the edge that it hits, given that for each dot in those directions, they aren't already connected to another part of the path.
@Kaepsele337
@Kaepsele337 4 ай бұрын
I once did something similar. The algorithm I used was to use depth first search to create an initial maze. Those tend to be rather boring because it creates long non branching paths. To randomize it I cut a random path, which splits the tree into two new trees, but they have many points where they touch. So I choose one at random and connect the trees again. The resulting graph is still a tree. On each iteration a single wall is built and a single wall is removed.
@davidoliver7510
@davidoliver7510 4 ай бұрын
Actually a grid maze is really creative and cool. Watch Takeshis castle A grid maze. However the walls of the grid has doors in the walls. Not all sides has to have a door. Has a start. But one exit. True exit. Other exits are traps.
@Flupus
@Flupus 5 ай бұрын
Hello mattbat, love your content bro. Keep uploading!
@infernopyromaniac
@infernopyromaniac 5 ай бұрын
I love captain luma so glad you made a video showing off origin shift to more people!
@mhm6421
@mhm6421 5 ай бұрын
Bro I literally watched CaptainLuma's video like 5 hours before this video got published?! Is this a coincidence?
@kouroshahadzadeh5070
@kouroshahadzadeh5070 5 ай бұрын
Noice…
@Misstborn
@Misstborn 5 ай бұрын
I just watched it yesterday! Fun coincidences (or maybe it's picking up in the algorithm?)
@mertaliyigit3288
@mertaliyigit3288 5 ай бұрын
That last algorithm can be generalized. Instead of removing the target node's pointing edge, you can remove any edge on the path that goes to the root and reverse some of the edges
@XanTheXanadul
@XanTheXanadul 5 ай бұрын
The day before yesterday, I submitted my uni homework about a maze game. Yesterday, I watched the video by CaptainLuma, and today the algorithm decided to show me this. Now I really want to try out this algorithm.
@traptoothpick8669
@traptoothpick8669 5 ай бұрын
I'm falling in love with this type of stuff again
@kephalopod3054
@kephalopod3054 5 ай бұрын
To solve the maze, just make a printed circuit board with the path as copper lines, apply a voltage between start and finish (use a resistor to adjust the current), and use thermal imaging to see where the current flows, ergo is the solution.
@shalevforfor5550
@shalevforfor5550 2 ай бұрын
If you use recursive backtracking thingy in the frame that you touch the start point if you started from the end point you will get a list of the path of the solve of the maze
@SupersuMC
@SupersuMC 5 ай бұрын
"Super-simple perfect maze" Shows an all-left-indents maze that Roller Coaster Tycoon's peeps' maze-solving algorithm struggles with.
@EnorIII
@EnorIII 5 ай бұрын
I was just recommended CaptainLuma's video explaining the algorithm 2 days ago, and now you made a video on it
@remyashrym5134
@remyashrym5134 5 ай бұрын
Yeah same 😅
@lugui
@lugui 5 ай бұрын
your inspiration on the 3B1B videos is really good
@wiktorkaminski5095
@wiktorkaminski5095 5 ай бұрын
If this video was posted last year, I might have used this algorithm for my maze game for my university project. I think that multiple moving points are possible. So far my paint tests shows that It is possible with few more rules. Also the additional points can be teleported/added/removed easly according to the paint test.🎨🖌
@tyronorxy5646
@tyronorxy5646 5 ай бұрын
The problem with perfect mazes is that if you know the simple exploit of hugging the wall, it looses it's fun aspect. It just becomes the chore of running this "hug the wall" algorithm. It essentially makes it too easy. Disjoint mazes on the other hand, require good memory to solve. Getting stuck in loops is basically a skill issue. Although this is likely not the player's fault, and the maze is just not designed for their skill level: Just imagine a human trying to map the Backrooms in their head. One way I see for solving such mazes (using an algorithm) is that: You write down the turns you take (left-right), and use some sort of compression algorithm to store them efficiently. If you need to backtrack (because you've hit a dead-end) you erase the turns you had to back track through.
@AkiraTheCatgirl0
@AkiraTheCatgirl0 5 ай бұрын
Would disjoint mazes not be subject to the same exploit (or, rather, always solvable by the same algorithm)? If you get stuck in a loop, then you must come back to where you started, meaning you went outside the maze and thus finished it. An additional way to think about this is considering how a 'loop' is created. If a section of wall is connected to the outside, then it cannot be part of a loop. If it's not connected to the outside, then you will never hug it. Since the maze is (presumibly) finite, we will say it is n×m. Then, any sequence of nm moves must terminate in an end or have gone over a vertex of the maze multiple times.
@tyronorxy5646
@tyronorxy5646 5 ай бұрын
@@AkiraTheCatgirl0 It seems to me that in your explanation the player is viewing the maze from an omniscient ("outside") perspective. Which is the exactly where disjoint mazes fail to provide difficulty. For disjoint mazes to be difficult, the player must be located inside of them, where they cannot immediately tell if a section of walls is connected to the outside or not. For simplicity I will assume that our maze is single-floor, with no diagonals: Given the above restrictions, the maze has only 6 possible path configurations, where it is not immediately obvious that you went the wrong way (aka.: it's not a dead-end): - Left L - Right L - T - I (Straight) - X (Cross-junction) This is not a a lot of variety. In order to not go around in loops, the player must identify if they have already visited a vertex, for which they can't use the configuration of paths leading out from said vertex, because the lack of variety makes the player unsure if the vertex in question is an already visited vertex or just an identical one. And even though a human's vision is not limited to just a single vertex, the maze can also possess larger identical sections. (Large mazes will do just by pure chance.) This is why the player has to continuously map the maze in some way if they wan to identify longer loops. Mapping is the "algorithm" for solving disjoint mazes (from the inside), and - unlike hugging the wall - this "algorithm" requires skill to use. This skill being either good memory, or the skill to conserve space on the paper you use to map the maze.
@johnchessant3012
@johnchessant3012 5 ай бұрын
That origin shift method is so cool!
@fretzT_T
@fretzT_T 5 ай бұрын
Goodluck with your submission. Waiting for your redstone to computer series.
@idkwhattoputherehelpme
@idkwhattoputherehelpme 3 ай бұрын
my brain is fried, melted, cooked, burnt, baked, roasted, and grilled. and also amazed.
@Inspirator_AG112
@Inspirator_AG112 5 ай бұрын
*[**8:18**]:* Specifically: • O(n²) for equal width and height n. • O(w • h) for width w and height h.
@AndrewX981
@AndrewX981 5 ай бұрын
What is O function? And what is the area of the grid doing here?
@Inspirator_AG112
@Inspirator_AG112 5 ай бұрын
@@AndrewX981: Big-O notation.
@DqwertyC
@DqwertyC 5 ай бұрын
It's actually worse than that overall - each individual scan of the maze is O(n^2), but the number of times we have to scan through the maze is *also* O(n^2)
@AndrewX981
@AndrewX981 5 ай бұрын
@@DqwertyC Would that be O(n^2)^2 right?
@mitchratka3661
@mitchratka3661 5 ай бұрын
YOOO I THOUGHT I RECOGNIZED THE TOPIC, bro I watched Captain Luma's maze changing algorithm video and helped him pick the name, many other people suggested it but I was (supposedly) the first to suggest "Origin Shift" as a name. Soooo happy that you did a video on it since I love your content and loved this topic
@raffiepro
@raffiepro 5 ай бұрын
The specific word for that type of maze is labyrinth
@DqwertyC
@DqwertyC 5 ай бұрын
It depends on who you ask - some people use labyrinth interchangeably with maze, while others use it as a specific type of maze with no branching paths. "Perfect Maze" is the generally accepted term for a fully connected maze without any loops.
@legendgames128
@legendgames128 5 ай бұрын
Modified origin shift (as a maze generator): Start the root at the corner, with no connections from any cell to any other cell whatsoever. Apply the algorithm, which will add new connections from one cell to another. Stop when the root visits all cells. Or heck, why not generate the maze this way as the player is inside the maze and then keep going after? Though one of my complaints is that with every single perfect maze, it doesn't produce massive rooms like you'd see on DOOM, for example.
@DqwertyC
@DqwertyC 5 ай бұрын
That's basically describing another algorithm known as the Aldous-Broder algorithm. The only difference with Aldous-Broder is that once a cell is visited, it doesn't get changed again, but when we visit new cells they always point into the existing visited cells. From his original video, Luma actually started trying to make an Aldous-Broder maze generator, but didn't have a way to detect when every cell was visited, then came up with this as a solution. Something cool about Aldous-Broder and (I'm assuming) Origin Shift is that they generate a Uniform Spanning Tree, which basically mean any possible maze is equally likely to be generated. Most other algorithms are biased towards specific types of mazes, such as Depth First Search generating long, windy passages and Prim's algorithm generating lots of short dead-ends.
@Air_Raider
@Air_Raider 5 ай бұрын
Great video! Maze generation has always fascinated me. I hope you make a video on maze solving too. Btw, I also saw the ever changing maze video by CaptainLuma, when it came out. The origin shift algorithm reminds me somewhat of Langton’s Ant, probably because both are based on wandering points.
@ThomasDeSwert
@ThomasDeSwert 4 ай бұрын
here's an algorythm I made myself to generate a maze, first get the borders and the grid, then draw a line from start to finish randomly, then make branching paths trough the remaining walls, make sure you only get into each space once, boom, thats a maze
@Miju001
@Miju001 5 ай бұрын
Origin shift is such a cool concept! Thanks for bringing attention to it!
@poorman-trending
@poorman-trending 5 ай бұрын
My 2¢ - loops makes a (large) maze more challenging and thus more interesting.
@spinnychairs6724
@spinnychairs6724 5 ай бұрын
this is a really nice style of a video, if you did one of these for some of your complex machines im sure more people would understand them and it'd be really cool
@psyonide1394
@psyonide1394 5 ай бұрын
One of the best visualization of DFS I’ve seen
@theminecraft4202
@theminecraft4202 5 ай бұрын
your visualizations are really clean and nice to look at
@danielrhouck
@danielrhouck 5 ай бұрын
0:25 I think Iʼd take that bet (or at least bet Iʼve seen a variant of it). It looks exactly like a CaptainLuma video from 5 months ago I happen to have seen three days ago.
@Romashka_Sov
@Romashka_Sov 3 ай бұрын
School didn't show me how to make mazes, but I liked to draw them in childhood. Though they were too simple to solve, so I added "layers" in a later ones, with a rule that states "if one path goes under another, it must not make any turns while it is below said path". I had a full note of those mazes, unfortunately my mom threw it to a trash bin one day, and I stopped drawing them. It was fun tbh, maybe I should draw some in the future
@AlexSanta-jl9ke
@AlexSanta-jl9ke 3 ай бұрын
I saw somebody use DFS to create an AI in Minecraft(that did parkour)
@HuntCard24
@HuntCard24 5 ай бұрын
3:08 you missed your chance to say "How many options is too much options"
@GagnesterLOL
@GagnesterLOL 5 ай бұрын
The french canadian minecraft zephirr have made it before 😉 but, not exactly!!! The video: Le labyrinthe de Zephirr- Version téléchargeable [2012, 12, 25]
@remyashrym5134
@remyashrym5134 5 ай бұрын
Wow tah l'époque, c'est un ancien lui 😂
@GregBabineau
@GregBabineau 4 ай бұрын
Great video! Love the dynamic maze algorithm. Wicked fricken cool.
@funkdefied1
@funkdefied1 5 ай бұрын
What an INCREDIBLE twist at the end
@Natalia-jb7vv
@Natalia-jb7vv 4 ай бұрын
A GPS is really just a massive maze solving algorithm that takes traffic into account.
@delofj
@delofj 5 ай бұрын
I randomly stumbled upon CaptainLuma’s video about his Origin Shift algorithm yesterday And that’s great for you to give him some visibility
@justonechessguy
@justonechessguy 5 ай бұрын
this is the type of 3b1b stuff I'd love to see you talk about. great new vid
@siesmec
@siesmec 5 ай бұрын
This helps a lot! Me and my friends where making a maze game using Redstone, and we couldn't find a good algorithm for us, but this one seems perfect!
@fuze9923
@fuze9923 5 ай бұрын
This video is really great, I learned a few things that I always wanted to know and few new other useful stuff, thanks for the video ☺️
@Hubcat_
@Hubcat_ 5 ай бұрын
Instead of just moving the root by 1 each iteration, which results in nearby walls always changing unless it happens to move far down the path, you could move the root to a random node (reversing the direction of edges between the old and new root points so that it's still a legitimate root) and then move it randomly like before, this would let walls change anywhere in the maze rather than being a moving point
@Hubcat_
@Hubcat_ 5 ай бұрын
You could even choose which walls you want to open up by selecting one of the nodes by the wall randomly, moving the root node there, and then moving it through the wall like in the original algorithm
@DqwertyC
@DqwertyC 5 ай бұрын
@@Hubcat_ Yup! This is just a more computationally intensive, since you have to rebase every cell between the old origin and the new origin.
@thyrical
@thyrical 5 ай бұрын
Amazing video. I coded a perfect-maze generator in a video game recently, and it really racked my brain - visualizing it as a tree is brilliant!
@AgentM124
@AgentM124 5 ай бұрын
A few issues with the root maze. For very large mazes, you might need to run it for a very long time before it is properly randomized. Instead you could break up the maze in submazes and randomize those for a much shorter time. Then you will get a much better maze, then of course you may want to overlap the borders or the submazes for proper randomization there too. Also, it is a statistical higher chance to find changes near the root within the maze. So if you got a recent change in the maze you can kind of predict where the maze will definitely not change for a while. However, by instead picking a completely different root at random you can get less predictive changes. Though you'd have to recalculate all the directed edges.
@b1tw0nder
@b1tw0nder 3 ай бұрын
While the root would be the node where all arrows face towards, you could call any node with only one arrow that faces away an anti root. Antiroots would just happen to be mostly dead ends with the exception of of the start and/or end potentially on those nodes.
@ricsirogi
@ricsirogi 5 ай бұрын
Great video, you're awesome at this explaination style content, keep it up!
@ВіталікБритан-х7ч
@ВіталікБритан-х7ч 5 ай бұрын
Wow! 3Blue1Brown-style video? Good approach! I love it!
@Type3Kiryu
@Type3Kiryu 5 ай бұрын
I remember some maze site from the usless web site, my strategy noted that the RNG of the maze was always going to be an asshole. The rule was that if the path ahead didn't go back on itself in the most obscene and slow way possible, touching walls with the last part of the path, it was the wrong way. It worked 90% of the time.
@Guys-s5v
@Guys-s5v 2 ай бұрын
I have another method for making a tree: start by randomly walking until you hit a dead end where all the adjacent ones have been colored the same color (bear with me here), and then start a new path, and color it a different color than all the other paths. Merge the paths if they intersect and color them the same color. If a loop is created (just in case), undo your move and try another. Repeat until the board is filled. If there are still two or more differently colored paths, connect them. Use the loop procedure if a loop is created. Repeat until there is only one path. Then you're done.
@shalevforfor5550
@shalevforfor5550 2 ай бұрын
He just talked about it in the video
@PixelGamer2_
@PixelGamer2_ 5 ай бұрын
Didn't expect mattbatwings made this
@merlin2lmml45
@merlin2lmml45 5 ай бұрын
I really like this kind of style you’re drifting into. Trying make all the redstoners interested in technical engineering and stuff. As long as we’ll still be seeing at least 1 redstone vid per month im fine with it i like either style. Just as kind of a feedback for how youre trying to kinda move your fanbase.
@DoRealOfficial
@DoRealOfficial 5 ай бұрын
School never even told me anything about mazes to begin with
@miltonthecat2240
@miltonthecat2240 4 ай бұрын
Once you start messing with larger mazes, you naturally start thinking about difficulty. One way to make a difficult maze is to maximize the blind alleys in some sense. For example, a maze with long blind alleys more time-consuming to solve than a maze with very short blind alleys. And a maze with long branching blind alleys seems more difficult to solve than a maze with long blind alleys that don't branch. If you take a finished maze and think of all the paths as connected pieces of string, then visualize pulling the floppy string out of the maze grid and splaying it out in two or three dimensions, the most difficult mazes probably resemble the root system of a tree. One can then imagine various ways of defining an optimally difficult maze for a given grid size. And then defining a maze creation algorithm to maximize some aspects of difficulty.
@CornbreadFish
@CornbreadFish Ай бұрын
Is the thumbnail Rodrick’s maze?
@dominiquelaurain6427
@dominiquelaurain6427 4 ай бұрын
Well in 2D and your square lattice, with the Luma algorithm, you will surely have a period in the root vertex (Random walk theory on lattices)...which will not be the case in 3D. For the 3D maze, you can imagine "lifts" between different floors,...to have a little more complicated maze. You can base other mazes on Petri network (multi-walkers, for every "door" Dn it open only if there are at least Keys(n) walkers at the same side of a wall. You can case also on predator-prey model (some walkers open doors and some other walkers close doors).
@domin3k535
@domin3k535 5 ай бұрын
i am just shocked that a weak ago i was also serching for the maze generation in minecraft and it was the same film that you brought to your video and i am in love with thios video of like just explaining those things that you normally wouldn't search for. Minecraft redstone builders are just of limits.
@erniesulovic4734
@erniesulovic4734 5 ай бұрын
Labirynth is a board game where the "walls" change per turn/player. Graph Theory had some interesting parts in it when I studied it at Uni yet I am going back many years now. Discrete Maths of which Graph Theory was part of, was not really my kind of maths that I enjoyed that much. Oh btw, there is a 3D version of Labirynth which I have not gotten or played yet seems like fun
@veikkakarvonen831
@veikkakarvonen831 Ай бұрын
The game should've been called Maze instead as a labyrinth only has one path by definition... Loves that game, the Finnish version was called "Muuttuva Labyrintti", "the changing labyrinth".
@sethhollistah8504
@sethhollistah8504 5 ай бұрын
I used to hand draw mazes when I was a wee lil kid and wondered how people manage to fill entire books with them
@vNCAwizard
@vNCAwizard 5 ай бұрын
There are very good reasons to have loops in a maze, given the rules for proceeding along any path.
@firewalk1293
@firewalk1293 5 ай бұрын
I really love learning about these math/programming concepts
@zekejanczewski7275
@zekejanczewski7275 5 ай бұрын
I tried creating an infinite maze which generates as you explore it from a seed. The trouble is how do you make a maze localized, meaning each cell only needs to extract information a bounded finite distance away from itself to generate, I don't think such an algorithm is possible, and here is my reasoning. You can always look at larger and larger sections of the maze from one point to another. Intersections need to be further and further apart from each other. A 1 million tile maze will involve you passing through a suprisingly small amount of junctions to get from one point to any other point, at the very most, 16. When you reach a certian size of maze, either you must go back retroactively and change the dencity of your junctions, or have a lower and lower amount of junctions. A technical cheat I found was to create really simple 2×2 mazes, and then arange 4 of them in a 2x2 grid, then connect them together at random junctions. Then, get a 2x2 grid of THOSE mazes, and connect them randomly with a single connection. The information is stored in the X-Y position. Meaning there isn’t really locality, where each section of maze is indistinguishable. Still, at a glance, it looks convincing.
@Mateo-zi8ub
@Mateo-zi8ub 5 ай бұрын
The animations are great, and everything was clearly explained. Good job!
@GameJam230
@GameJam230 5 ай бұрын
A cool fact I figured out about the origin shift algorithm while watching this is that there's actually no requirement that you ONLY change the root node to an adjacent cell in the maze, you can actually pick any cell you want, and you just recursively follow the tree until you get to the old root. Once you do, swap the direction of the last connection in that path, and finally delete any incoming connections in your new root node just like before. The only reason why choosing adjacent cells was done was because it makes it really easy to build in redstone, because the root cell stores the fact that it's the root in itself and IT is responsible for passing that off to a neighbor, which it can do in only a single iteration, but the other approach would need a separate mechanism to store the current root node and the new one so that it can facilitate the recursive search back to the root again. It also means that it takes longer to move the root further away, and it gives no benefit if you do it every single time, you'd only really want to use it once in a while between a bunch of neighboring cells being picked as a way of quickly picking a new part of the maze to affect. This would be good in situations where the algorithm updates the top and right side tons, but the bottom-left corner remains unchanged for a while, as you could just force the root to move down there for more variability. But again, that's more useful for game devs than redstoners.
@boggers
@boggers 5 ай бұрын
I think I had the same idea but backwards... or maybe I'm just not following your explanation properly? As I see it, first you pick any random node as the new root, then you traverse from the new root back to the old root, following the arrows back and flipping every arrow along the way until you get to the old root. This makes no changes to the maze layout but all arrows now point toward the new root. Then from the new root you move to an adjacent root as with the normal origin shift method.
@GameJam230
@GameJam230 5 ай бұрын
@@boggers Yeah, I think I added a couple extra unnecessary steps because I was considering the additional step of DELETING connections that used in the original algorithm, however it is only needed when you have to consider the possibility of opening up a wall that was closed prior (as it would create multiple paths between two given nodes, which disobeys the rules of the maze state), however this is not needed when picking a random node as the new root becaude there is already exactly one path to its location from the old root, and so you can simply follow the path and flip the directions without worrying about closing paths that were created as a result of this (as none would be). As for why I did it backwards from you, there is a very good reason. When working with trees, all non-root nodes have exactly 1 parent, so it is easier to say thisNode.parent to go UP the tree TO the old root than it is to navigate DOWN the tree FROM the old root, as you may encounter branching paths to deal with.
@boggers
@boggers 5 ай бұрын
@@GameJam230 Heh, I think we are both talking about the exact same method, traversing from old root to new root, but you omitted the part about flipping the arrows along the way in your initial description. :) This all has got me interested to dust off an old maze gen algo that I came up with a while ago.
@GameJam230
@GameJam230 5 ай бұрын
@@boggers Not necessarily. I'm saying traverse from the NEW root to the OLD one, opposite of how you keep saying it.
@boggers
@boggers 5 ай бұрын
@@GameJam230 oops, I did indeed flip traversal direction in my follow up comment, my first comment was correct though.
@BryonLape
@BryonLape 4 ай бұрын
I did a video on Depth-First maze generation and wrote the program in AppleSoft BASIC.
@TriviaQuizocity
@TriviaQuizocity 5 ай бұрын
Bro went from minecraft videos to being the next 3blue1brown😂
The Fascinating Math behind Piston Extenders #SoME3
20:08
mattbatwings
Рет қаралды 731 М.
The Fastest Maze-Solving Competition On Earth
25:22
Veritasium
Рет қаралды 20 МЛН
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 23 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,4 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
I Made 2048 with just Redstone!
23:01
mattbatwings
Рет қаралды 756 М.
Simulating the Evolution of Rock, Paper, Scissors
15:00
Primer
Рет қаралды 2,2 МЛН
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 1,3 МЛН
Can water solve a maze?
9:09
Steve Mould
Рет қаралды 13 МЛН
I Made an AI with just Redstone!
17:23
mattbatwings
Рет қаралды 1,2 МЛН
The Bubble Sort Curve
19:18
Lines That Connect
Рет қаралды 671 М.
I Made Flappy Bird with just Redstone!
14:04
mattbatwings
Рет қаралды 302 М.
The BEST Way to Find a Random Point in a Circle | #SoME1 #3b1b
18:35
Building your INSANE Redstone ideas!
16:05
mattbatwings
Рет қаралды 408 М.
I Solved The World's Hardest Maze (with Code)
9:54
Green Code
Рет қаралды 208 М.
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 23 МЛН