Maze solving with dead-end filling algorithm

Поделиться
HTML-код
  • Опубликовано: 25 янв 2019
  • How to solve a maze with dead-end filling method.
    github.com/ferenc-nemeth/maze...
  • НаукаНаука

Комментарии • 287

  • @DutchBlackMantha
    @DutchBlackMantha Год назад +1067

    This won't filter out any wrong paths that loop back on themselves though. It will only work an mazes that have a tree-structure.

    • @gara8142
      @gara8142 Год назад +35

      precisely what I was thinking

    • @mikechurvis9995
      @mikechurvis9995 Год назад +39

      True. I think what this would be most useful for is quickly reducing the worst-case search space for a directed DFS like A*. I'd have to see how the performance compares; this seems like iterations of a 3x3 kernel over a matrix, known to be fast and parallelizable. I'd wager this only gives performance gains on extremely large mazes with lots of loop-backs; A* tends to be very efficient out-of-the-box.

    • @asdfghyter
      @asdfghyter Год назад +12

      @@mikechurvis9995 as we saw in the video, it can be very linear and slow in the end if we have a long dead end. maybe we could use some kind of hybrid approach where both the search and the dead-end elimination are done in parallel, so we aren’t forced to wait for those.
      btw, if we have unlimited parallelism isn’t dijkstra’s algorithm as fast as A*? but maybe it’s harder to parallelize than the dead-end elimination?
      maybe another alternative would be to simply limit the number of iterations before switching to A*, either by a fixed number based on the size of the maze or by a limit on the minimum number of dead ends

    • @monopalle5768
      @monopalle5768 Год назад +14

      It only claims to BE a dead-end filler 🙂

    • @crawkn
      @crawkn Год назад +6

      True but it's a very simple algorithm, and the additions necessary to detect and fill dead-end-loops would be simple too.

  • @cxemphren8879
    @cxemphren8879 Год назад +931

    Wonder what it would look like with multiple working paths.

    • @brandonallen2301
      @brandonallen2301 Год назад +90

      I think it would fully preserve them with nothing extra. If you wanted to get the shortest path you could breadth first search after getting all the working paths, and then whichever path reaches first, you can trim the rest.

    • @wizrom3046
      @wizrom3046 Год назад +25

      Multiple good paths? Was exactly what I wondered. Since only dead ends are removed, right up till they hit a 3-4 junction, the multiple paths would be preserved.
      Then the A-B travel would have to chose from the multiple paths but this is not implemented.
      Since the multiple paths are all valid, itmwould still travel from A to B just fine, but there is no mechanism to determine the best of multiple paths, nor choosemthe best path...
      I do like this algorithm because it doesnt need to be recursive, it could even be done sequentially instead of simultaneously as seen in the video. That means it can be done with an incredibly simple, and reliable, tiny bit of code.

    • @mericet39
      @mericet39 Год назад +10

      Since this algorithm just trims off the dead ends, and working paths are the only ones which are ultimately not dead ends, they would all be preserved.

    • @darrennew8211
      @darrennew8211 Год назад

      @@brandonallen2301 You can still do that without trimming the dead ends, though.

    • @landon5030
      @landon5030 Год назад

      @@brandonallen2301 22²22222²22222221111111222222222222222²2222222222222²²22²2222²²222222222222222222²2²²222222222222222222222222222222222²²222ww area WW2 ww was a ass wàwww ass wwwww a áwwwww see ãwàw was wwwwwwwwwwww ass wáw saw2222222222222²²²²222222222222222222222²2222222222222222222222⅔wwwww we wwwwww3w3 wew was wewa33aw www we 3w3 was awa

  • @xwtek3505
    @xwtek3505 Год назад +328

    This algorithm can be implemented as a celular automaton.
    4 states: endpoint, path, deadend, black.
    Neighbor: von neumann
    Rule: path with one or zero neighboring path and not near to any endpoints becomes a deadend.

    • @Pystro
      @Pystro Год назад +1

      Or just use a 2x2 square of path for the endpoints and you can simplify it down a bit more.

    • @xwtek3505
      @xwtek3505 Год назад +8

      @@Pystro I want to preserve the looks of the maze, though. Strictly speaking, only two states are necessary, which can be expressed with B/S234V in Golly's notation

    • @Vgamer311
      @Vgamer311 Год назад +5

      All algorithms can be implemented as a cellular automation

    • @solsystem1342
      @solsystem1342 Год назад

      If there are multiple paths this algorithm would break.

    • @Anaklusmos42
      @Anaklusmos42 Год назад +6

      2 rules are necessary :
      -if the cell is black, it stays black
      -if a cell is adjacent to 3 black cells, the cell become black

  • @mightymarlin97
    @mightymarlin97 Год назад +65

    So basically, going left at the start instead of straight is a single move that would cost everything

    • @drakebalzer2098
      @drakebalzer2098 Год назад +1

      What maze do you start from the bottom right in? English is read left to read top to down, mazes are designed following that rule.

    • @puzzlemaster_6797
      @puzzlemaster_6797 Год назад +17

      @@drakebalzer2098 they're referring to the perspective when you enter the maze from the top left

    • @panda4247
      @panda4247 Год назад +1

      @@drakebalzer2098 you don't solve mazes from the end?

    • @toddkes5890
      @toddkes5890 Год назад

      And a right-hand turn towards the end would take you on another journey the wrong way.

  • @darkdrow66
    @darkdrow66 Год назад +51

    Started off interesting but the plot kinda slowed down towards the end of the second act.

  • @ygalel
    @ygalel Год назад +4

    I don't care if this is not the most efficient or not this is by far the most satisfying

  • @darrennew8211
    @darrennew8211 Год назад +113

    I must admit this is an algorithm I haven't seen before, and I've seen a lot of algorithms about mazes.

    • @Vextrove
      @Vextrove Год назад +6

      It's one I came up with as a child

    • @oldguydoesstuff120
      @oldguydoesstuff120 Год назад +2

      @@Vextrove I was going to say the same thing. It's how I solved mazes as a 10 year old. Color in the dead ends until you reach a T intersection that hasn't been colored in. Of course, as a human you can periodically look to see if the solution has become clear before you finish coloring it all in. It actually made mazes too easy and uninteresting.

    • @Vextrove
      @Vextrove Год назад +1

      @@oldguydoesstuff120 Yeah. I did it to bide my time during boring parts of my life

  • @realkingofantarctica
    @realkingofantarctica Год назад +154

    I never thought about it, but filling in dead-ends, even if only partially, is a much more consistent way of solving mazes than just trial and error.

    • @BobBob-kr5wr
      @BobBob-kr5wr Год назад +4

      I always did it with a pencil myself lol.

    • @obscurereference6298
      @obscurereference6298 Год назад +1

      but it knows when to stop and not interfere with the correct route which we would not know how to do.

    • @BobBob-kr5wr
      @BobBob-kr5wr Год назад +3

      @@obscurereference6298 Well we can start by filling our way from the simple ends to the bigger ones. We just can't do it as quickly as the AI can.

    • @Kikkerv11
      @Kikkerv11 Год назад +1

      @@obscurereference6298 No, the algorithm stops at intersections!

    • @TheMisterGuy
      @TheMisterGuy Год назад

      @@obscurereference6298 "but it knows when to stop and not interfere with the correct route which we would not know how to do."
      We can recognize any dead space by looking around it. Any space that's not the entrance or exit is a dead end if it doesn't have at least two open spaces next to it. Watch carefully and see which spaces it blocks off every time.

  • @jackthehacker05
    @jackthehacker05 Год назад +7

    Those are massive offshoots, this is one evil maze.

  • @maltheopia
    @maltheopia Год назад +2

    1:18 = Awesome, they FINALLY fixed the soda machine. Time for some Sprite.

  • @CadeTrigon
    @CadeTrigon Год назад +28

    The definition of knowing where to go by knowing where not to go. Neat algorithm though.

    • @wizardbrandon3544
      @wizardbrandon3544 Год назад +21

      the missile knows where it is becuase it knows where it isnt

    • @Stiathirs
      @Stiathirs Год назад +7

      @@wizardbrandon3544 The missile knows where it is at all times. It knows this because it knows where it isn't. By subtracting where it is from where it isn't, or where it isn't from where it is (whichever is greater), it obtains a difference, or deviation. The guidance subsystem uses deviations to generate corrective commands to drive the missile from a position where it is to a position where it isn't, and arriving at a position where it wasn't, it now is. Consequently, the position where it is, is now the position that it wasn't, and it follows that the position that it was, is now the position that it isn't.
      In the event that the position that it is in is not the position that it wasn't, the system has acquired a variation, the variation being the difference between where the missile is, and where it wasn't. If variation is considered to be a significant factor, it too may be corrected by the GEA. However, the missile must also know where it was.
      The missile guidance computer scenario works as follows. Because a variation has modified some of the information the missile has obtained, it is not sure just where it is. However, it is sure where it isn't, within reason, and it knows where it was. It now subtracts where it should be from where it wasn't, or vice-versa, and by differentiating this from the algebraic sum of where it shouldn't be, and where it was, it is able to obtain the deviation and its variation, which is called error.

  • @cooperfeld
    @cooperfeld Год назад +2

    Congrats to this creative approach! It is specialized for dense mazes of limited, rectangular size on a regular, square grid.
    I think you can use this algorithm for multi-path mazes with some small modifications: a) Find and store all branches b) While filling dead-ends, stop at the first branch.
    In the remaining maze you could choose the shortest path (avoiding loops). Cost-wise, you still have square complexity of the initial dead-end scan.

  • @MazeMe
    @MazeMe Год назад +1

    I was kind of expecting a jump scare scream at the end lol

  • @Stirling96
    @Stirling96 Год назад +4

    This is the hardest maze I've ever tried to solve, usually I solve mazes with just my eyes but damn this maze confuses my eyes like an optical illusion.

  • @parkaparid7549
    @parkaparid7549 Год назад +2

    If Jack Torrence had access to this technology, Danny would be a goner...

  • @AgileSnowWeasel
    @AgileSnowWeasel Год назад

    Having visibility of the whole maze to find the ends is quite the luxury of course.

  • @gianlucatartaro1335
    @gianlucatartaro1335 Год назад +36

    Omg the designer of this maze is so evil. The fact that the very first path has a 50/50 chance of leading you on the most elaborate dead end the world has ever seen is insane 😂 Even solving from the end first, there’s a huge elaborate dead end not too far from the end either 😅

    • @bogdyee
      @bogdyee Год назад +3

      its a random generated maze most likely where only one path leads to the end.

    • @AgileSnowWeasel
      @AgileSnowWeasel Год назад +4

      I bet there's a talking worm at the beginning who will be all too happy to send you the wrong way because you phrased your question wrong.

  • @fiddleriddlediddlediddle
    @fiddleriddlediddlediddle Год назад +1

    This doesn't make the Jerma teacher noise. B-tier algorithm.

  • @tisibutasimplechocopancook7923
    @tisibutasimplechocopancook7923 Год назад +6

    also helps when making mazes as to check if they have multiple solutions :]

  • @1kreature
    @1kreature Год назад +35

    That is very cool!
    What optimizing is done on the pass-handling? I assume it runs through pr row or column unless run on a parallel processing architecture?
    Once there is no more dead ends on a row there will not ever be until the row above or below have been changed so it can be skipped.

    • @darrennew8211
      @darrennew8211 Год назад +14

      It looks like once you find the initial set of dead ends, you only have to check if the cells around the current dead ends are now dead ends. I.e., each step involves trimming off the dead end, finding the single adjacent cell that was open, and marking that as a new dead end. No need to scan the entire maze once you've done the first scan. Just track where the dead ends are.

  • @professionalaccount8012
    @professionalaccount8012 Год назад +1

    Is this visual ASMR that people have been telling me about..? I never understood slime or carvings... but this: this is art.

  • @arglebargle17
    @arglebargle17 Год назад +1

    This is funny. Back in college in 1980, I was on a programming team competing with a bunch of teams in the midwest. Four programmers, Four problems, Four hours, and ForTran. One of the problems was to find a path through a maze like this. Everyone at the contest knew mazes were solved via recursion but ForTran IV doesn't support it. The students tackling the problem were all trying to implement their own form of recursion. After the contest was over and nobody solved that one, I took a look at it and slapped my forehead. I saw this fill-in algorithm immediately. Could have coded it in 10 minutes. Ah, well, we came in fourth behind 3 teams of grad students, so we didn't feel too bad.

  • @TriumVee
    @TriumVee Год назад +2

    I've seen mazes filled with gas in a simulation as the dead ends would back pressure and solve the maze

  • @CatNigga
    @CatNigga Год назад +1

    The algorithm was cool, but I did not expect the maze to fall apart like that

  • @BlackCat-hm2sf
    @BlackCat-hm2sf Год назад +2

    this is how I solve the mazes that would be a part of the kids menus at restaurants lol
    Use one color to figure out the correct path, and every dead end I find gets filled in with a different color (usually red and green like in the video lol)

  • @jacobwoolcutt4590
    @jacobwoolcutt4590 Год назад +1

    Sometimes I'll buy a variety puzzle magazine and I'll work out the mazes this way. It's very relaxing!

  • @iamfinky
    @iamfinky Год назад +1

    This is amazing. Thanks for sharing!

  • @cicik57
    @cicik57 2 года назад +5

    this is way better then dfs, thanks

  • @srh2301
    @srh2301 Год назад +2

    Limitation of this algorithm is, that the computer needs the "full picture" to apply the algorithm. It's not like a "mouse" which has only a subjective view and needs to optimize its algorithm from "inside" of the maze.

  • @JustAPersonWhoComments
    @JustAPersonWhoComments Год назад

    3 mandalorians are stuck in a maze. 2 of them are arguing with each other. “This is the way” “No, this is the way” they keep saying to each other. Then the third flies up and out of the maze with his jetpack. “No that’s the way” the second says to the first

  • @AlexSmashX3
    @AlexSmashX3 Год назад +1

    It's like a Castlevania map is getting erased.

  • @breezdonferguson2277
    @breezdonferguson2277 Год назад +1

    When you can’t solve the cereal box maze

  • @Jamesington1214
    @Jamesington1214 Год назад +1

    Weirdly I thought there was going to be a jumpscare at the end

    • @panda4247
      @panda4247 Год назад

      AAAAAAAAAAAAAAAAAAAARHG!!!!!!

  • @Aflay1
    @Aflay1 Год назад +1

    This video made me anxious as fuck.

  • @ghb323
    @ghb323 Год назад +4

    simple explanation: you cut off paths to a dead end. Up to when there are 2 or more branches that would be a choice.

  • @thaias9654
    @thaias9654 Год назад +1

    Imagine doing this maze and being on that one long dead end

  • @CZpersi
    @CZpersi Год назад

    If you cannot see the top-down layout of the maze, you are back to guessing or “always turning left”. This algorithm could be useful after the first run to make the next pnes more effective.

  • @FurryEskimo
    @FurryEskimo Год назад

    That’s pretty similar to how I solve puzzles irl. Is it considered efficient? I think I use a combination of this method, the trick about the right most path (when applicable), and segmenting the puzzle so large swaths of it can be ignored all at once, but for a computer that might technically be less efficient.

  • @Pao-vo8mf
    @Pao-vo8mf Год назад +1

    answer me this immediatly, goddess of mazes: how do you come up with these magic maze solving tricks?

  • @joshuaunderwood7
    @joshuaunderwood7 Год назад +2

    Great work

  • @GL_099
    @GL_099 Год назад +28

    This is how I used to solve mazes. I'd take a pencil and carefully black out all the dead ends. It was much more satisfying that way.
    Yeaah I was a weird kid.

    • @SorakaOTP462
      @SorakaOTP462 Год назад

      You are still weird.

    • @RealRomplayer
      @RealRomplayer Год назад +3

      I'm sorry to tell you this, but you are actually a robot with this algorithm implemented to your AI.

    • @tigerdalandan
      @tigerdalandan Год назад +2

      Clever, not weird.

    • @duetopersonalreasonsaaaaaa
      @duetopersonalreasonsaaaaaa Год назад +1

      But the best kind of weird kid, we would've had a lot of fun as weird kids with mazes together haha

  • @mogarbobac1472
    @mogarbobac1472 Год назад +2

    That was beautiful

  • @mspeir
    @mspeir Год назад +1

    I get that this was slowed down for animation purposes, so how does it compare to the depth first search algorithm?

  • @WhatTheBleep24
    @WhatTheBleep24 Год назад +2

    Hey Vsauce, Micheal here. How in the he-
    Btw I am programmer. This is easy to make but challenging to come up with.

  • @platinvm_
    @platinvm_ Год назад +1

    The missle knows where it is.. by knowing where it isn't

  • @VodShod
    @VodShod Год назад

    could you have an algorithm that checks for forks and dead ends, then do something like filling the path between dead ends and the closest fork, then start over and repeat?

  • @KingOf_B
    @KingOf_B Год назад

    In O() notation what’s the runtime complexity given and nxn maze?

  • @gideon_kang1
    @gideon_kang1 Год назад +19

    who else thought that the white stuff were walls?

    • @DreadEnder
      @DreadEnder Год назад +16

      No that wouldn’t make sense considering the layout

    • @drjvoices
      @drjvoices Год назад +3

      @@DreadEnder some people think diffrent

    • @DreadEnder
      @DreadEnder Год назад +10

      @@drjvoices no I mean if the white was walls then it wouldn’t make sense because some black parts make islands which wouldn’t make sense if it was a path

    • @gideon_kang1
      @gideon_kang1 Год назад +3

      @@DreadEnder I'm talking at in first glance

    • @DreadEnder
      @DreadEnder Год назад +2

      @@gideon_kang1 alright

  • @RF-Ataraxia
    @RF-Ataraxia Год назад +1

    It turned into a Castlevania map

  • @ModeratelyAmused
    @ModeratelyAmused Год назад +2

    This is how I pictured it going from the title. My question is that once all of the dead ends are detected, does the program scan the entire maze again for new dead ends or did it map the dead end points and then start making decisions for only those points of interest. The first would be a shorter code but more steps. The longer code should be less steps.

    • @toddkes5890
      @toddkes5890 Год назад

      From the first 20 seconds of the video, it looks like the algorithm tries to find all the dead ends first, then parses back from them until it reaches a white square that is bordered by 2+ white squares.

  • @empireempire3545
    @empireempire3545 Год назад +1

    I guess the question is how it compares to A* and JPS

  • @mv6041
    @mv6041 Год назад

    Is there a 4k HD version of this?

  • @dorbie
    @dorbie Год назад +1

    I get that this is illustrative, but every branch choice should be held in a tree and the branch elided when a dead end is reached, no need to backtrace. Also scanning the maze for dead ends is not a benefit as you must still walk the maze to get the connectivity so you might as well walk the maze and discover the dead ends as you go and pop back to the branching point.

  • @steliosstamatialis8169
    @steliosstamatialis8169 Год назад +1

    I can't look at maze videos on the internet without thinking that there's gonna be a screamer popping up 😬

  • @Topshy_Kretts
    @Topshy_Kretts Год назад +1

    Could you make it so each of the dead ends fill in a different color

  • @asayeah844
    @asayeah844 Год назад

    Inside my head I was going..."wonka, wonka, wonka, wonka"

  • @ic6406
    @ic6406 Год назад

    Is it faster than always taking right turns?

  • @killmeister2271
    @killmeister2271 Год назад +4

    i love coding and i love algorythms; this makes me want to make one of my own. i wonder if there's a faster approach?

    • @FROZENbender
      @FROZENbender Год назад

      one problem with this approach is that it struggles with loops. so that would be a nice challenge to try to solve

    • @DarmaniLink
      @DarmaniLink Год назад

      A* is a million times better

  • @gamer_x403
    @gamer_x403 Год назад +4

    Seems slow, but I guess the upside is that it can be done in parallel, so no matter how large the maze is, you can always just throw more threads at it.

    • @ifroad33
      @ifroad33 Год назад +1

      Sounds possible, but there would be a lot of overhead due to synchronization issues. If a dead end branches out to two dead ends, then those two dead ends would meet up and only one of the threads are going to continue from that point. I think OpenMP's tasks implementation would be great for such a problem, but I am unsure if you would actually see any speedup when using huge numbers of threads.

    • @chrisanderson7820
      @chrisanderson7820 Год назад +2

      Vastly easier for an organic brain as well.

    • @lombas3185
      @lombas3185 Год назад +1

      @@ifroad33 Yeah, I think thinking of the maze as a matrix and using a gpu would be better in this case.
      Basically, you would:
      1) Create a matrix with 0 for walls, 1 for paths and 2 for the starting and ending cell.
      2) Then, you would add the surrounding values (paths) for a new (temporary) matrix, not adding the original value of the cell in question.
      3) Once you do this, substract 1 for each value.
      4) Multiply the matrix with the original one. Any value that's 0 is now a wall, any other value is a path.
      5) Finally, set every cell that's not 0 to 1, and the starting and ending cells to 2, and compare the new matrix to the old one . If they are the same, end the task. If not, repeat from step 2
      This was a fun problem! If you read this, please tell me if you find any improvements/flaws with my process.
      Anyway, have a nice day!
      Edit: I've found a problem -> The starting and ending cells shouldn't be 2. Instead, we should make their values = 1 after each iteration, before returning the matrix

    • @ifroad33
      @ifroad33 Год назад +1

      @@lombas3185
      The only thing with the algorithm I can see is wrong is step 3) where you want to perform matrix multiplication. I know what you are referring to, because you are trying to multiply each separate value from the temporary matrix, with the values in the original matrix. But matrix multiplication refers to another operation which works a bit differently.
      The only thing I can come up with as an optimization (which you might already be aware of) is the ability to combine some of the steps without any synchronization barriers between. For example, if you can guarantee that every thread that works on specific areas of the maze in step 4) will be working on the same areas in step 5) you would not need to wait for all the threads to finish step 4) before going on to step 5). The same goes for every step in the algorithm I think, except going from step 5) back to step 2) because you would have to store the current iteration's temporary matrix into the original matrix so that you count the new paths and walls from the walls that are generated from the first iteration.
      Some very interesting topics that can be observed from this problem is how to properly schedule your GPU to perform this task optimally. By distributing the work to too many threads, the algorithm might perform worse due to how the GPU delegates different tasks to different blocks. Every place where threads have to wait for eachother (referred to as barriers) requires synchronization between threads, and GPUs offer quick communications between threads that are in the same block, which makes it possible to efficiently make use of barriers. But if threads appear in different blocks, the barriers must rely on global memory which may cause the program to run slower due to latency.
      I am currently taking a master course in low level parallel programming(Sweden, Uppsala University), and using GPUs for parallelization is a very relevant subject in that course. Once I've finished my assignments, and have some spare time over I will absolutely sit down and try to implement your algorithm and see if I can get it to work and maybe come up with some more optimizations that can be done. I am far from a professional in this field, but I am very interested in it since I am a real nerd haha.
      Let me know if you thought of something that I missed, or if you think I am wrong about something. Thanks for the nice comment! Have a great day.

    • @lombas3185
      @lombas3185 Год назад

      @@ifroad33 Hi! Wow, I didn't expect a follow-up to be honest, but I really enjoyed your insight, and I'd love to see it implemented when you've got the time. I'm just getting started with GPUs and have barely started getting my hands dirty, so my knowledge was only from theory.
      With that said, I thought of a way to implement this with bitwise operations (I'm implementing it in python without the gpu operations for the moment), so only boolean matrixes would be necessary and the performance way better. I'm not going to explain everything again, but here's how an iteration would look like, just in case you prefer it
      i=index : int
      r=row size : int
      1=path
      0=wall
      An outer wall of 0s should be added to speed up the logic and avoid out of bounds exceptions
      Initial matrix = λ
      1=Staring and ending cells
      0=Every cell but the starting and ending ones
      Starting and ending cells-Matrix = Φ
      A = Left cell (A[i] = λ[i-1])
      B = Top cell (B[i] = λ[i-r])
      C = Right cell (C[i] = λ[i+1])
      D = Bottom cell (D[i] = λ[i+r])
      More-than-two-paths-next-to-cell - Matrix = Ω = A(B+C+D)+B(C+D)+CD
      Resulting Matrix = Π = λ AND Ω OR Φ
      If Π λ :
      -> Iterate again(λ=Π)
      Else return λ

  • @baphomet1149
    @baphomet1149 Год назад +4

    bro, one left turn at the begining and your like fucked for a good day if it was a real maze

    • @wizrom3046
      @wizrom3046 Год назад +1

      You gotta trick those "left hand wall rule" smartasses.
      But points lost for not tricking the right hand rule guys too...

    • @kalahatze
      @kalahatze Год назад +2

      @@wizrom3046 But the second longest path is on the right hand wall

    • @wizrom3046
      @wizrom3046 Год назад

      @@kalahatze hahaha youre right of course! 👍

  • @OneLetterShor_
    @OneLetterShor_ Год назад +2

    0:05 1:18 keep clicking these 2 timestamps one at a time

  • @DusanPavlicek78
    @DusanPavlicek78 Год назад +1

    Beautiful! 😀

  • @evilemu2599
    @evilemu2599 Год назад +3

    if you took the first left 💀

  • @buster5661
    @buster5661 Год назад

    Oh Jesus, you would of been stuck in that maze for life if it was real

  • @rondohunter8966
    @rondohunter8966 Год назад

    When I fed this into my HAL 2000 computer he said it was a star system in, GN-z11, a high-redshift galaxy found in the constellation Ursa Major. He has plotted a course but I can't get anyone to go with me.

  • @bartolhrg7609
    @bartolhrg7609 Год назад

    When double tapping on phone (to go backwards or forwards), you can see original maze

  • @Abelhawk
    @Abelhawk Год назад +1

    It’s really interesting to think that no space in a maze matters except for the one path from start to finish.

  • @rootsharp9946
    @rootsharp9946 Год назад +1

    it's like doing every possible wrong until you make it right. Sounds like edison...

  • @BenjaminSteber
    @BenjaminSteber Год назад +1

    The very first turn of this maze goes to the furthest dead end. Just mean.

  • @NikkiTheViolist
    @NikkiTheViolist Год назад

    I remember doing this exact same thing on mazes when I was, like, 6

  • @vincentxie3090
    @vincentxie3090 Год назад

    It's isn't to hard too escape this maze but you should always remember the paths

  • @vice.nor.virtue
    @vice.nor.virtue Год назад +1

    It's interesting that if you take the correct course there's only 8 points where you could make a wrong turn. I thought it would be more for some reason.

  • @cat1196
    @cat1196 Год назад

    Crazy how I solved it in less than a minute.

  • @sayochikun3288
    @sayochikun3288 Год назад +5

    Not efficient but very cool to watch!

    • @XerosOfficial
      @XerosOfficial Год назад

      I believe this works as a concurrent algorithm, and may be faster in many cases, the same way that Bitonic Sort can also be faster in many cases despite being a less efficient algorithm all in all.

    • @sayochikun3288
      @sayochikun3288 Год назад

      @@XerosOfficial i doubt. This algorithm "requires" to collapse almost every single cell to decide where to go.

    • @sayochikun3288
      @sayochikun3288 Год назад

      @@piisfun for sure no doubt in that. But.. using two algorithms to "efficiently solve the maze" is kinda not that impressive. Also larger the maze is, more cycles this algorithm would use to "make the maze easier" for other algorithm. Its just waste of calculation cycles in my opinion. Definitely one of the coolest to watch tho.
      I would like to be proven wrong by comparing calculation cycles between a well known maze solving algorithm vs This + well known maze solving algorithm. (In few different sized mazes)
      Comparison as in "which method setup accesses(read & write) to the maze cells more than the other in total"

  • @0xDEAD_Inside
    @0xDEAD_Inside Год назад

    Awesome!

  • @huggjgfjughj
    @huggjgfjughj Год назад +3

    what language do you use?

    • @veud
      @veud Год назад +3

      C++, you can view the GitHub page

  • @fraktal852
    @fraktal852 Год назад +1

    So amazing...

  • @ianfarquharson2933
    @ianfarquharson2933 Год назад +1

    wow amazing!

  • @istora9158
    @istora9158 Год назад +1

    that's a-maze-ing

  • @TryingToExist973
    @TryingToExist973 Год назад +1

    Dang that’s cool :D

  • @Unfoundrumors
    @Unfoundrumors Год назад

    Can you get it to play minesweeper yet?

  • @NonisLuck
    @NonisLuck Год назад

    Is this a new windows 95 screensaver?

  • @hughjaanus6680
    @hughjaanus6680 Год назад

    Amazing.

  • @Cedobi
    @Cedobi Год назад

    this project is a very simple concept with a difficult implementation
    if (sides == 3) close

    • @thezouave7636
      @thezouave7636 Год назад +1

      You could totally make this algorithm that way.
      bool closed = true;
      while (closed) {
      closed = false;
      for(int y = 0; y < num_rows; y++) {
      for (int x = 0; x < num_columns; x++) {
      if (maze[y][x].sides() == 3) {
      maze[y][x].close();
      closed = true;
      }}}
      Note this would be horribly inefficient, but if you just want to solve small mazes and/or just want get something working that you can check other algorithms against, this wouldn't be too bad.

  • @Timmzy27
    @Timmzy27 Год назад

    This was nice

  • @chrismwinand
    @chrismwinand Год назад

    Oddly satisfying but could look better if it started pathing as it backed deadends

  • @monopalle5768
    @monopalle5768 Год назад

    NEAT. I've only ever used A-star.

    • @empireempire3545
      @empireempire3545 Год назад +1

      Which you should, this is most likely much slower than A*

    • @monopalle5768
      @monopalle5768 Год назад

      @@empireempire3545 Thank you, that answers my next question: Should we run this first on maps to exclude tiles BEFORE doing path finding 🙂

  • @DarkVoidIII
    @DarkVoidIII Год назад +3

    Flood fill tools used in paint apps work much the same way, only they don't worry if it's a dead end, they just look for identical adjacent squares and fill them in with the selected color. All this is doing is adding a little extra code that visually shows the pruning of the dead ends. Flood fill tools don't care if it's a maze or a space with objects in it or a large open space, they just fill it in until they can't find any more spaces to fill.

  • @Lexifocs
    @Lexifocs Год назад

    Holly sht. For you know, i throught that would be screamer in the end of the video

  • @-HUN_
    @-HUN_ Год назад

    Is it mandatory to use algorithms to find the exit? I found it in 6 seconds without using algorithms

    • @ic6406
      @ic6406 Год назад +1

      I like the stupidity of this question

  • @Umi_Oni
    @Umi_Oni Год назад +1

    Is this how we terraform mars

  • @JermoMetGames
    @JermoMetGames Год назад

    This is an easy maze. Just always go right and down. You'll get there asap

    • @Uuugggg
      @Uuugggg Год назад

      Literally the first step going right is wrong

    • @JermoMetGames
      @JermoMetGames Год назад

      @@Uuugggg but the down is correct XD

  • @mariowario5945
    @mariowario5945 Год назад +1

    My brain when playing pacman but 1000x faster and in realtine

  • @Ray-xy1bp
    @Ray-xy1bp 2 года назад +4

    I need further explanation

    • @goldenspade5812
      @goldenspade5812 2 года назад +11

      It marks all the dead ends, and then moves backwards until it reaches an intersection, where it blocks off that direction in the intersection. By doing this, it prevents the path from going towards the dead end. If a dead end leads to an intersection which had a direction blocked off, that just means the intersection leads to two dead ends, so it continues. What remains is the path. This also works if there are multiple paths.

    • @thehammurabichode7994
      @thehammurabichode7994 Год назад +4

      snek

    • @michaelweiske702
      @michaelweiske702 Год назад +1

      The algorithm does a pass of all the pixels/blocks in the maze, and it searches for white pixels with 3 adjacent black pixels. When it finds them, it colors the white pixels red. After the initial pass, it goes to every red pixel, turns is black, then checks the neighboring pixels to find a white pixel. It checks to see if that white pixel is adjacent to 3 black pixels, and if it is, it turns that white pixel red. It repeats this until there are no more red pixels.

    • @wizrom3046
      @wizrom3046 Год назад

      @@michaelweiske702 ... how does the computer know what the red colour is if it is colourblind and can only see two binary colours; black and white?
      Do you need a special computer? 🤔

    • @michaelweiske702
      @michaelweiske702 Год назад

      @@wizrom3046 computers are not color blind. Every pixel does not have 1 value, they have 3: R, G, and B. These values vary between 0 and 1 to create every possible hue. 'White' is defined as when the values equal . 'Black' is defined as . 'Red' is defined as . Therefore, if a computer wants to find a 'red' pixel, it just needs to find pixels that have a value of .
      Edit: some more color examples from this system include:
      Green:
      Blue:
      Yellow:
      Orange:
      Violet:

  • @starpawsy
    @starpawsy Год назад +1

    WOw I would have given up a long time ago.

  • @JohnSmith-td7hd
    @JohnSmith-td7hd Год назад +1

    I used to do this with pencil :)

  • @Victoryshout_nz
    @Victoryshout_nz Год назад +1

    So humans never need to think for themselves ever again.

  • @sammysimpleton
    @sammysimpleton Год назад +1

    why did this make me feel sad?

  • @firstnamelastname442
    @firstnamelastname442 Год назад

    me tricking the algorithm by making some dead ends double thick

  • @denischen8196
    @denischen8196 Год назад

    0:35 There are now only 2 dead ends. Why isn't the algorithm speeding up?