Maze solving with wall follower algorithm [right-hand rule]

Поделиться
HTML-код
  • Опубликовано: 29 авг 2024
  • How to solve a maze with wall follower method.
    github.com/fer...

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

  • @DiamondButter
    @DiamondButter Год назад +294

    Very interesting how the end result is the double-traced side being entirely enclosed by the correct path, with no exceptions

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

      What you would expect as there is no way to turn left out of the correct path when following right hand rule

    • @twelnor1104
      @twelnor1104 Год назад +37

      @@grapetoad6595 it's something you don't really think about until the knowledge is presented to you. It was a "hmm interesting" moment for me too.

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

      Equivalently, the fact that there's a path through the maze means that the wall on the left is completely seperated from the wall on the right.
      If you stick to the right wall you can never touch the left wall.

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

      @@Ailtir Also a thing I've never had articulated in my head before. Thank you!

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

      would be a way to improve efficiency; if you entirely close off a path, you don't have to search it.

  • @HABIB31022
    @HABIB31022 Год назад +89

    This is how I explore caves in minecraft: hug the right wall and place torches to the right.
    It has never failed me

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

      Great idea, I hope you don't mind if I steal it

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

      I do the same. Then I know rightside torches = in and left = out.

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

      Exactly what I am doing since I got lost in my first cave in minecraft... a decade ago

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

      I put torch on floor.if I run into torch, I'm in a loop

  • @cdmcfall
    @cdmcfall Год назад +20

    I used to draw mazes where the goal was to reach the center because of this trick. Right and left-hand methods will bring you back to the origin.

  • @lukasjetu9776
    @lukasjetu9776 Год назад +100

    he literally went trough the entire left side of the maze, but the ending path was actually very short

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

      That's why you wanna use a heuristic function such as how far the end goal is in x, y distance

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

    Imagine doing the right-handed path trick, and finding out the very first left turn would’ve led straight to the finish

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

    I've always thought of this as the brute force way of solving mazes

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

      I would have The Proclaimers stuck in my head _THE WHOLE TIME_

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

    To be fair, this method worked by a human would’ve completely eliminated the bottom left portion of the maze as soon as it hit the bottom.

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

      @@yannickpit6886 I don’t know about you but the first thing I do is scan for the exit, takes maybe 10-20 seconds depending on the size of the maze.

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

      @@yannickpit6886 Yeah, that's what I was thinking too. Because this is the easiest way to solve video game dungeons. Just hug one wall. Left or right, it doesn't matter. I used to hear left as a child, some people know it as right, but the main gimmick is that if you're in a maze, putting a hand on a wall and then walking forward, never losing sight of the wall, you'll always find the exit.

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

      Assuming its top-down view, yes. A human would instantly see that the entire left is closed off and go the other way.

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

      @@Nekufan1000000 well that is not entirely true, one can make mazes that do block left/right hand rule but its more complex and in game design its not really favourable unless complex mazes is its gimmick and you have tools that help you mark walls or the like

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

      @@Nekufan1000000 Only in a two-dimensional maze I think. If you add the option of stairs and ladders, this wouldn't work any more.

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

    Mazes are a brilliant way yo test a software engineer. But recruiter done get it!!
    A recent test for a job, what set a maze task, One had to code, but you did not see the examples in advance, Great! loved it. Pass was one had to pass the most complex in less that 30 seconds.
    For me it was 30 milliseconds.
    I had zero feedback,

  • @pastasketti
    @pastasketti Год назад +85

    You should do a right and left competition with randomly generated mazes

    • @andrasfogarasi5014
      @andrasfogarasi5014 Год назад +23

      Due to the (almost) symmetric nature of the problem, there would be no difference.

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

      on average it would be a 50/50 win rate

  • @asheep7797
    @asheep7797 Год назад +64

    I'm guessing this method always turns the right-most unmarked way.

    • @regularsalamander
      @regularsalamander Год назад +44

      no it just sticks to the wall to its right. so any time it can turn right, it does, and then turns around it it's in a dead end. it's a simple way to do a depth first search without having to remember where you've been, it works without marking the path

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

      or left

    • @L-sillybrained
      @L-sillybrained Год назад +4

      you keep your hand on the wall to your right at all times

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

      Yes, it does. That's one way to describe it.

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

      @@regularsalamander This is exactly the method I use to find my way out of complex tunnels in video games.

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

    Imagine grabbing the exit and entrance, then pulling them outwards until they’re straight. Pretending that the walls don’t have insides and the walls were only the parts visible whilst inside the maze, then you’d be left with 2 straight lines, the right wall and the left wall.

  • @Anonymous-yn6og
    @Anonymous-yn6og Год назад +1

    LEFT-HAND RULE, JACK

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

    the way how he was so close to the exit in the beggining of the video and then turned away and started wandering around was extremely dissatisfying lol

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

    This technique was used by the old "Windows 3D Maze Screensaver."

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

    I always disliked when people told me to solve mazes by picking a side and following it, and this video demonstrates why perfectly.
    I don't want to have to deal with half of the entire map.

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

      When people say that they're talking about real mazes, like a corn maze where you can't see the exit. With this strategy you're guaranteed to eventually reach the end, with no strategy you have a chance of reaching the end faster but you could also end up just wandering around without a clue

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

      Would you rather deal with half the map or wander aimlessly all over the entire map?

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

    Best part is that at 0:16 was very close to end end if it weren't programmed to follow the rule lol

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

    Also interesting is that if the choice was "use left hand algorithm" the entire maze would have been explored.

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

      This assumes no loops and the entrance and exit are on the edge

  • @MACAYCZ
    @MACAYCZ 2 года назад +14

    Yeah, i programmed this in asm:D

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

    Most tame dungeon crawler dungeon

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

    I'm having MAJOR flashbacks to the Atari 2600 game "Maze Craze" while watching this.

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

    you could also do it in the water/hydraulics flow way

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

      That is a better way, although you need a map of the maze to do it.

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

      @@paulgreen9059 ie breadth first search, just remember where you "flowed the water flood tree search"

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

    This algorithm has only one big flaw… it just makes sense if the maze has no circular paths

    • @dec.breeze5747
      @dec.breeze5747 Год назад

      Maybe let it go gack when meet the visited place. Just like the DFS algorithm.

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

      @@dec.breeze5747 I was thinking on other but if that would the case, it wouldn’t visit again the turquoise zones, it would be only green.

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

      But it will eventually get back on track right? Unless the exit is in the middle of the room.

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

      The only way a circular path would cause this algorithm to fail is if you started on a circular path with the inner wall on the right. Starting from the entrance of the maze, this is an impossible scenario.

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

      Here's the thing: the wall(s) that are directly connected to the entrance will *never* be a circular loop because it will always connect to the exit.

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

    What if your start point is random in the map? A simple loop or path that connects back to itself can really mess with these.
    Eg a maze that does -not- look like a tree.

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

      Game called Zork did this."you dropped into a maze of twisty passages all alike"

  • @anomolisagag2270
    @anomolisagag2270 5 месяцев назад

    frieren and hero party deffo use this algorithm to solve any dungeons, but at the last turn to the final spot, they changed the algorithm to opposite hand to get the 100% exploration🤣

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

    bro forgor the right side was a thing until he checked the left side

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

    Definiteley a way, but at a maze with islands this can lead to problems

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

    this is how i play darksouls

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

    Any algorithms for island type mazes? I mean like separated walls

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

    It was I have been done as an assignment on the Introduction of programming in the first programming course.

  • @contessa.adella
    @contessa.adella Год назад +1

    BTW…Of course “Left hand Rule” works exactly the same. I prefer keeping left…its how we drive in UK😁

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

    Would be better if you used another color than blue...too close to the green.

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

    You could paint with different colors where the red dot passed multiple times:
    green: 1
    cyan: 2
    Blue: 3, etc.

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

    0:17 NOOOOOOOOOOOOOO

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

    Backtracking??

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

    Bruh just easy use right hands or left hands

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

    that one reactos screensaver:

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

    And people think this will take over the world.
    Funny.

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

      What are you on about?

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

      @@Invi--- i mean how can something so dumb scare us

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

      @@aadik4458 This video isn't about giving scares

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

      @@Invi--- yes i understand
      But the general idea of technology giving scares is what I have targeted in my above comment
      My reason to say that is if this video (not at all intellectual) is technology, how could this take on humanity
      Think about it

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

      @@aadik4458 The power technology can have it's pretty much limited to what humans can give it so yeah this may be weak but who knows what could follow next

  • @dec.breeze5747
    @dec.breeze5747 Год назад

    DFS

  • @a180combatbowsergamepro6
    @a180combatbowsergamepro6 2 года назад +3

    this rule makes no sense

    • @azPeeko
      @azPeeko 2 года назад +87

      Yes it does lmao, it’s literally a way of ensuring that you cover every piece of the maze which guarantees a way out whereas if you turned left and right aimlessly it would be far harder to find the exit

    • @shem7146
      @shem7146 2 года назад +57

      because you're like 9 probably haven't even developed object permanence yet

    • @a180combatbowsergamepro6
      @a180combatbowsergamepro6 2 года назад

      @UChrOcy7LgPKOhCRn3BaIthw I guarantee I'm smarter than you'll ever be

    • @a180combatbowsergamepro6
      @a180combatbowsergamepro6 2 года назад

      @UChrOcy7LgPKOhCRn3BaIthw You weren't supposed to reply to it idiots.

    • @crazyayhan7533
      @crazyayhan7533 2 года назад +6

      i think the toughest part of this algorithm is at 0:43 when the robot passes the same tile 2 times but doesn't paint it blue. It is the most essential part of the algorithm and I don't quite understand how it does that.