What School Didn't Tell You About Mazes

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ม.ค. 2025

ความคิดเห็น • 848

  • @mattbatwings
    @mattbatwings  7 หลายเดือนก่อน +169

    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 6 หลายเดือนก่อน +3

      You cooked in this video

    • @SukiYaki1904
      @SukiYaki1904 6 หลายเดือนก่อน +5

      why was this posted this 6 days ago

    • @GrowMode_YT
      @GrowMode_YT 6 หลายเดือนก่อน +1

      ​@SukiYaki1904 It was privated. You can even see Capo with a comment 6 days ago

    • @lucamastermanYT
      @lucamastermanYT 6 หลายเดือนก่อน +1

      I was like the 450th person to watch this video, its my pb

    • @lucamastermanYT
      @lucamastermanYT 6 หลายเดือนก่อน +1

      and i was the 179th liker

  • @commNder0
    @commNder0 6 หลายเดือนก่อน +996

    i love how matt started out as a minecraft professional redstone player to teaching us the beauty of a maze

    • @error.418
      @error.418 6 หลายเดือนก่อน +28

      The computer science pipeline

    • @spitefulginger
      @spitefulginger 6 หลายเดือนก่อน +24

      @aghaalipatrickstarNo, he is. He just makes a SoME submission for 3Blue1Brown each year.

    • @gylbard8237
      @gylbard8237 6 หลายเดือนก่อน

      of math

    • @TaxMax5678
      @TaxMax5678 6 หลายเดือนก่อน +1

      He's one of the lucky ones who do what they love

    • @eneaganh6319
      @eneaganh6319 6 หลายเดือนก่อน +2

      He still is mainly a Minecraft TH-cam, this is for SoME

  • @captainluma7991
    @captainluma7991 6 หลายเดือนก่อน +1165

    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 6 หลายเดือนก่อน +38

      It is the captainluma!

    • @carterstach6034
      @carterstach6034 6 หลายเดือนก่อน +50

      I actually saw lumas video before this one came out lol! 8:37

    • @error.418
      @error.418 6 หลายเดือนก่อน +30

      Great work on "origin shift!" Going to have lots of fun playing with it.

    • @Anunak255
      @Anunak255 6 หลายเดือนก่อน +8

      nice

    • @vibaj16
      @vibaj16 6 หลายเดือนก่อน +4

      @@carterstach6034 same

  • @muno
    @muno 6 หลายเดือนก่อน +368

    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 6 หลายเดือนก่อน +1

      Agreed

    • @donaldhobson8873
      @donaldhobson8873 6 หลายเดือนก่อน +1

      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 6 หลายเดือนก่อน +1

      Gamedev moment

    • @theramendutchman
      @theramendutchman 3 หลายเดือนก่อน +1

      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!

  • @epicboy330
    @epicboy330 6 หลายเดือนก่อน +1360

    Now we need the headache video about 3D mazes

    • @jindmen
      @jindmen 6 หลายเดือนก่อน +120

      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 6 หลายเดือนก่อน +44

      A 3D maze would work the exact same way

    • @gamingcat6668
      @gamingcat6668 6 หลายเดือนก่อน +20

      @@jindmen 4d :>

    • @austinneilson2870
      @austinneilson2870 6 หลายเดือนก่อน +23

      It's a tree, which means it works the exact same in every dimension.

    • @dadamaldasstuff1816
      @dadamaldasstuff1816 6 หลายเดือนก่อน +21

      It would work with 1d mazes too. It just wouldn't be fun.

  • @gralkekd1574
    @gralkekd1574 6 หลายเดือนก่อน +465

    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 6 หลายเดือนก่อน +57

      "...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 6 หลายเดือนก่อน +30

      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 6 หลายเดือนก่อน +23

      ​@@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 6 หลายเดือนก่อน +11

      @@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 6 หลายเดือนก่อน

      ​@@Nevir202 I dont want to sound rude but math isnt created, its discovered

  • @SirPogsalotCreates
    @SirPogsalotCreates 6 หลายเดือนก่อน +119

    "first, we need to define what a maze is."
    "...we're just gonna make it up"

    • @mattbatwings
      @mattbatwings  6 หลายเดือนก่อน +94

      welcome to all of math

    • @SirPogsalotCreates
      @SirPogsalotCreates 6 หลายเดือนก่อน +17

      @@mattbatwings valid

    •  5 หลายเดือนก่อน

      @@mattbatwings fr

  • @p2beauchene
    @p2beauchene 6 หลายเดือนก่อน +161

    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 6 หลายเดือนก่อน +19

      Wow, a teacher that's learning about minecraft?! Finally someone that understands why people (at least I) like to play Minecraft.

    • @p2beauchene
      @p2beauchene 6 หลายเดือนก่อน +16

      ​@@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 6 หลายเดือนก่อน

      @@Diamondsword85_RS Is my avatar clear enough to you ?
      I'd appreciate feedback.

    • @p2beauchene
      @p2beauchene 6 หลายเดือนก่อน +5

      One of my student even drew a Creeper on my whiteboard, minding every pixel.
      I was amazed and delighted.

    • @Programmmeroexe
      @Programmmeroexe 2 หลายเดือนก่อน

      Hpw do you have redstone ?​@@p2beauchene

  • @malevolentmoose
    @malevolentmoose 6 หลายเดือนก่อน +97

    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  6 หลายเดือนก่อน +35

      that is very cool! this made me realize how versatile of a tool it really is.

    • @_Dearex_
      @_Dearex_ 6 หลายเดือนก่อน +3

      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 6 หลายเดือนก่อน +4

      @@_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 6 หลายเดือนก่อน +2

      ​@@_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_ 6 หลายเดือนก่อน +10

      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.

  • @DankeMart
    @DankeMart 6 หลายเดือนก่อน +206

    Why the hell did I not realise it was mattbatwings until the 9th minute 😭

    • @Mustafa-6331
      @Mustafa-6331 6 หลายเดือนก่อน +7

      You're not alone.

    • @John17TheOGmp4
      @John17TheOGmp4 6 หลายเดือนก่อน +10

      I saw mattbatwings and I click

    • @guestIdk-ni9hb
      @guestIdk-ni9hb 6 หลายเดือนก่อน +11

      Same; I thought this was 3b1b

    • @idiot528
      @idiot528 6 หลายเดือนก่อน

      @@guestIdk-ni9hb Bro how do you not remember what grants voice sounds like

    • @aimaniskandar476
      @aimaniskandar476 6 หลายเดือนก่อน +2

      same

  • @Misstborn
    @Misstborn 6 หลายเดือนก่อน +16

    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.

  • @Soluna7
    @Soluna7 6 หลายเดือนก่อน +45

    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 6 หลายเดือนก่อน +7

      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 6 หลายเดือนก่อน +1

      ​@@illusionx1797Wouldn't the ends of the rectangle be dead ends?

    • @illusionx1797
      @illusionx1797 6 หลายเดือนก่อน +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 6 หลายเดือนก่อน +4

      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 6 หลายเดือนก่อน +4

      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

  • @RaPsCaLLioN1138
    @RaPsCaLLioN1138 6 หลายเดือนก่อน +39

    I just came across Luma's algorithm the other day. Been working on compacting.

  • @eagle32349
    @eagle32349 6 หลายเดือนก่อน +41

    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 6 หลายเดือนก่อน

      I didn't get it, but is seems there is some interesting in there somewhere. mind explaining more?

    • @ThomasMcMillin
      @ThomasMcMillin 6 หลายเดือนก่อน +13

      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 6 หลายเดือนก่อน

      ​@@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.

  • @arthurhill8185
    @arthurhill8185 6 หลายเดือนก่อน +25

    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 6 หลายเดือนก่อน +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.

  • @Matteo-dk1ee
    @Matteo-dk1ee 6 หลายเดือนก่อน +4

    I saw the Captainluma's video just a week ago, it's so cool to see you talk about this alg too

  • @HakanBasbay
    @HakanBasbay 6 หลายเดือนก่อน +110

    3mattbat1wings

    • @thatcatthatalwayseatsyourchees
      @thatcatthatalwayseatsyourchees 6 หลายเดือนก่อน +2

      3matt1batt

    • @0xABADCAFE
      @0xABADCAFE 6 หลายเดือนก่อน +2

      Winning

    • @gregorybrannin-mooser4686
      @gregorybrannin-mooser4686 6 หลายเดือนก่อน +6

      3blue1brown reference

    • @MisonGD
      @MisonGD 5 หลายเดือนก่อน +1

      What’s that a 3 blue 1 brown reference

    • @MisonGD
      @MisonGD 5 หลายเดือนก่อน +1

      @@gregorybrannin-mooser4686aww you beat me to it

  • @PinkPandaKatie
    @PinkPandaKatie 6 หลายเดือนก่อน +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.

  • @purpleskrim6935
    @purpleskrim6935 6 หลายเดือนก่อน +2

    11:12 "if there's any game-developers out there who want an ever changing maze" :me who thought of using it before hand

  • @SuperMaramau
    @SuperMaramau 6 หลายเดือนก่อน +4

    This is the first time I've seen a video of yours. I'm impressed by the quality and clarity of your explanations. Subscribed!

  • @JordanMetroidManiac
    @JordanMetroidManiac 6 หลายเดือนก่อน +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.

  • @jadengames.3662
    @jadengames.3662 6 หลายเดือนก่อน +2

    2:43 you just gave me an idea for a interactive 3d maze.

  • @Awes0meBadger23
    @Awes0meBadger23 6 หลายเดือนก่อน +40

    School, could you actually help me for once?

    • @Arch-mv5te
      @Arch-mv5te 6 หลายเดือนก่อน +1

      fr man

    • @prohakerofficial
      @prohakerofficial 6 หลายเดือนก่อน +3

      No :D
      Instead, we are going to teach you the most useless stuff ever!

    • @error.418
      @error.418 6 หลายเดือนก่อน +11

      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 6 หลายเดือนก่อน +1

      @@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 6 หลายเดือนก่อน +1

      @@error.418 I learned some of that through a summer program last year, it was cool

  • @frankhooper7871
    @frankhooper7871 2 หลายเดือนก่อน +1

    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

  • @greenguydubstep
    @greenguydubstep 6 หลายเดือนก่อน +58

    i can see the sebastian league inspiration here

    • @RubyPiec
      @RubyPiec 6 หลายเดือนก่อน +25

      I myself see 3b1b inspiration tbh, but thats probs because its using Manim

    • @zeldek
      @zeldek 6 หลายเดือนก่อน +6

      lmao I wouldn't be surprised if both of them made a video about it

    • @deleted_handle
      @deleted_handle 6 หลายเดือนก่อน +2

      just like crabs they are all evolving into the same style.

    • @sealpup3775
      @sealpup3775 6 หลายเดือนก่อน

      I see that 😂

    • @Asymmetrization
      @Asymmetrization 6 หลายเดือนก่อน +1

      I see zach star ​@@RubyPiec

  • @jonipaliares5475
    @jonipaliares5475 6 หลายเดือนก่อน +1

    This was actually so cool, and you sure got talent for making 3b1b style explainers!

  • @Lazauya
    @Lazauya 6 หลายเดือนก่อน +2

    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 6 หลายเดือนก่อน +1

    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 6 หลายเดือนก่อน

      There’s a lot of big words in there on purpose. For research opportunities. If anything, excuse my inaccuracies.

  • @Flupus
    @Flupus 6 หลายเดือนก่อน +5

    Hello mattbat, love your content bro. Keep uploading!

  • @Herpling8
    @Herpling8 6 หลายเดือนก่อน +1

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

  • @qfurgie
    @qfurgie 6 หลายเดือนก่อน +1

    saw Luma’s videos a few weeks ago and was so impressed

  • @hjagu1323
    @hjagu1323 6 หลายเดือนก่อน +2

    Really nice too see a mattbatwing video in a kind of three blue one brown style. This video was awesome!!

  • @geochonker9052
    @geochonker9052 6 หลายเดือนก่อน +7

    Better teacher than any college professor. Excited for the new videos!

  • @infernopyromaniac
    @infernopyromaniac 6 หลายเดือนก่อน +1

    I love captain luma so glad you made a video showing off origin shift to more people!

  • @davidoliver7510
    @davidoliver7510 5 หลายเดือนก่อน +1

    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.

  • @ThinkWithGames
    @ThinkWithGames 6 หลายเดือนก่อน

    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

  • @HuntCard24
    @HuntCard24 6 หลายเดือนก่อน +1

    3:08 you missed your chance to say "How many options is too much options"

  • @hears__
    @hears__ 6 หลายเดือนก่อน +1

    Keeping this video as my oral presentation for next year, tysm

  • @DqwertyC
    @DqwertyC 6 หลายเดือนก่อน

    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.

  • @Kaepsele337
    @Kaepsele337 6 หลายเดือนก่อน

    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.

  • @spinnychairs6724
    @spinnychairs6724 6 หลายเดือนก่อน

    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

  • @XanTheXanadul
    @XanTheXanadul 6 หลายเดือนก่อน +1

    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.

  • @Inspirator_AG112
    @Inspirator_AG112 6 หลายเดือนก่อน +1

    *[**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.

  • @Air_Raider
    @Air_Raider 6 หลายเดือนก่อน +1

    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.

  • @SupersuMC
    @SupersuMC 6 หลายเดือนก่อน

    "Super-simple perfect maze"
    Shows an all-left-indents maze that Roller Coaster Tycoon's peeps' maze-solving algorithm struggles with.

  • @mitchratka3661
    @mitchratka3661 6 หลายเดือนก่อน

    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

  • @ricsirogi
    @ricsirogi 6 หลายเดือนก่อน

    Great video, you're awesome at this explaination style content, keep it up!

  • @keesakkermans7488
    @keesakkermans7488 6 หลายเดือนก่อน +15

    So when comes the video 'i made a maze generater whit only redstone' coming?

    • @error.418
      @error.418 6 หลายเดือนก่อน +10

      He pointed us to a good one in this video, by CaptainLuma. It's in the description, too.

  • @merlin2lmml45
    @merlin2lmml45 6 หลายเดือนก่อน +1

    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.

  • @mertaliyigit3288
    @mertaliyigit3288 6 หลายเดือนก่อน +1

    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

  • @lucamastermanYT
    @lucamastermanYT 6 หลายเดือนก่อน +1

    This video is really awesome, i really enjoy watching it, thx for the high quality content Matt, and you should start making shorts. lol

    • @lucamastermanYT
      @lucamastermanYT 6 หลายเดือนก่อน

      Lol, i was viewer like, um, 450 something.

  • @theminecraft4202
    @theminecraft4202 6 หลายเดือนก่อน

    your visualizations are really clean and nice to look at

  • @fuze9923
    @fuze9923 6 หลายเดือนก่อน

    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 ☺️

  • @traptoothpick8669
    @traptoothpick8669 6 หลายเดือนก่อน +1

    I'm falling in love with this type of stuff again

  • @lugui
    @lugui 6 หลายเดือนก่อน

    your inspiration on the 3B1B videos is really good

  • @ThomasDeSwert
    @ThomasDeSwert 5 หลายเดือนก่อน

    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

  • @GregBabineau
    @GregBabineau 5 หลายเดือนก่อน

    Great video! Love the dynamic maze algorithm. Wicked fricken cool.

  • @kephalopod3054
    @kephalopod3054 6 หลายเดือนก่อน +1

    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 4 หลายเดือนก่อน

      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

  • @justonechessguy
    @justonechessguy 6 หลายเดือนก่อน

    this is the type of 3b1b stuff I'd love to see you talk about. great new vid

  • @danielrhouck
    @danielrhouck 6 หลายเดือนก่อน +4

    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.

  • @EnorIII
    @EnorIII 6 หลายเดือนก่อน +1

    I was just recommended CaptainLuma's video explaining the algorithm 2 days ago, and now you made a video on it

  • @domin3k535
    @domin3k535 6 หลายเดือนก่อน

    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.

  • @Mateo-zi8ub
    @Mateo-zi8ub 6 หลายเดือนก่อน

    The animations are great, and everything was clearly explained. Good job!

  • @delofj
    @delofj 6 หลายเดือนก่อน

    I randomly stumbled upon CaptainLuma’s video about his Origin Shift algorithm yesterday
    And that’s great for you to give him some visibility

  • @thyrical
    @thyrical 6 หลายเดือนก่อน

    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!

  • @idkwhattoputherehelpme
    @idkwhattoputherehelpme 4 หลายเดือนก่อน

    my brain is fried, melted, cooked, burnt, baked, roasted, and grilled. and also amazed.

  • @poorman-trending
    @poorman-trending 6 หลายเดือนก่อน +1

    My 2¢ - loops makes a (large) maze more challenging and thus more interesting.

  • @sethhollistah8504
    @sethhollistah8504 6 หลายเดือนก่อน

    I used to hand draw mazes when I was a wee lil kid and wondered how people manage to fill entire books with them

  • @Romashka_Sov
    @Romashka_Sov 5 หลายเดือนก่อน

    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

  • @johnchessant3012
    @johnchessant3012 6 หลายเดือนก่อน +1

    That origin shift method is so cool!

  • @siesmec
    @siesmec 6 หลายเดือนก่อน

    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!

  • @Guys-s5v
    @Guys-s5v 4 หลายเดือนก่อน

    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 4 หลายเดือนก่อน

      He just talked about it in the video

  • @Miju001
    @Miju001 6 หลายเดือนก่อน

    Origin shift is such a cool concept! Thanks for bringing attention to it!

  • @Type3Kiryu
    @Type3Kiryu 6 หลายเดือนก่อน

    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.

  • @questionman5
    @questionman5 6 หลายเดือนก่อน +2

    Wow your videos have really gotten good! Mind sharing what you used to make the visuals?

  • @tyronorxy5646
    @tyronorxy5646 6 หลายเดือนก่อน +2

    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 6 หลายเดือนก่อน +1

      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 6 หลายเดือนก่อน

      @@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.

  • @alian714
    @alian714 6 หลายเดือนก่อน

    the origin shift algorithm is amazing. I love how a game inspired someone to come up with a novel algorithm to suit their needs

  • @kingwolf4805
    @kingwolf4805 6 หลายเดือนก่อน

    I love maths content like that !
    Continue like that 🔥🔥

  • @AgentM124
    @AgentM124 6 หลายเดือนก่อน

    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.

  • @cmentch
    @cmentch 6 หลายเดือนก่อน

    This video is Amazing! Keep up the great work!

  • @miltonthecat2240
    @miltonthecat2240 6 หลายเดือนก่อน

    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.

  • @b1tw0nder
    @b1tw0nder 5 หลายเดือนก่อน

    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.

  • @wiktorkaminski5095
    @wiktorkaminski5095 6 หลายเดือนก่อน +1

    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.🎨🖌

  • @fretzT_T
    @fretzT_T 6 หลายเดือนก่อน +1

    Goodluck with your submission. Waiting for your redstone to computer series.

  • @ВіталікБритан-х7ч
    @ВіталікБритан-х7ч 6 หลายเดือนก่อน +1

    Wow! 3Blue1Brown-style video?
    Good approach! I love it!

  • @Hubcat_
    @Hubcat_ 6 หลายเดือนก่อน

    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_ 6 หลายเดือนก่อน +1

      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 6 หลายเดือนก่อน +1

      @@Hubcat_ Yup! This is just a more computationally intensive, since you have to rebase every cell between the old origin and the new origin.

  • @raffiepro
    @raffiepro 6 หลายเดือนก่อน +1

    The specific word for that type of maze is labyrinth

    • @DqwertyC
      @DqwertyC 6 หลายเดือนก่อน

      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.

  • @glenneric1
    @glenneric1 6 หลายเดือนก่อน

    Use a minimum spanning tree with root starting in the middle-ish, random-ish node weights and two points on opposite sides as start and end and you'd have a pretty good algorithm.

  • @legendgames128
    @legendgames128 6 หลายเดือนก่อน +1

    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 6 หลายเดือนก่อน +1

      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.

  • @mcl_playz
    @mcl_playz 6 หลายเดือนก่อน

    8:35 griffpatch made a similar thing. it was for path finding tho

  • @minepokemine
    @minepokemine 5 หลายเดือนก่อน +1

    Does anybody know what animation software this is made in?
    I would like to try making something like this.

  • @karzanah
    @karzanah 6 หลายเดือนก่อน

    0:34 Me, suffering from severe Tetris effect from playing The Witness: *heavy breathing*

  • @zekejanczewski7275
    @zekejanczewski7275 6 หลายเดือนก่อน

    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.

  • @vNCAwizard
    @vNCAwizard 6 หลายเดือนก่อน

    There are very good reasons to have loops in a maze, given the rules for proceeding along any path.

  • @psyonide1394
    @psyonide1394 6 หลายเดือนก่อน

    One of the best visualization of DFS I’ve seen

  • @DarmiGames
    @DarmiGames 6 หลายเดือนก่อน

    bro you didn't have to burn out my eyes with the sponsor. I'm literally watching this almost at 2am😂 But other than that, really cool video. Interesting how the maze creating algorythms work. Next video could be about how maze solving algorythms work, as it's still sort of a mystery to me, yet we use it on a daily basis, for example in navigation)

  • @Gravy_Guzzler
    @Gravy_Guzzler 6 หลายเดือนก่อน

    i did the DFS thingy in scratch while ago, and then used it to remake a tank game, your video makes me want to try maze generation or somthin like that again

  • @funkdefied1
    @funkdefied1 6 หลายเดือนก่อน

    What an INCREDIBLE twist at the end

  • @hellohabibi1
    @hellohabibi1 6 หลายเดือนก่อน +17

    Bro I literally watched CaptainLuma's video like 5 hours before this video got published?! Is this a coincidence?

    • @kouroshahadzadeh5070
      @kouroshahadzadeh5070 6 หลายเดือนก่อน

      Noice…

    • @Misstborn
      @Misstborn 6 หลายเดือนก่อน

      I just watched it yesterday!
      Fun coincidences (or maybe it's picking up in the algorithm?)

  • @KatBeanGod
    @KatBeanGod 5 หลายเดือนก่อน

    ok but loops are good though
    unless your maze has mobs in it or loops in it, you can just always easily get to the end by always making right turns (or always making left turns)