All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Maze Master (Posted on 2004-06-21) Difficulty: 2 of 5
Given a two dimentional maze which only has one path from entrance to exit, develop an algorithm that discovers the no-dead-ends route from start to finish.

No Solution Yet Submitted by Gamer    
Rating: 4.3333 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Hansel & Gretel solution | Comment 11 of 12 |
Use the always-turn-right rule but like Hansel & Gretel drop bread crumbs as you go.  Drop a bread crumb at the entrance to each "room" (a room is a square in the maze), and at the exit (next to the room where you're going next). 

When you find a dead end, turn around & start picking up bread crumbs, continuing to follow the turn-right rule.  When you enter a room if you find a bread crumb at that entrance, pick it up; otherwise drop one.  When you leave a room, if you find a bread crumb at that exit, pick it up; otherwise drop one there.

This will leave a trail of bread crumbs, two crumbs in each room, that defines the no-dead-ends route.  The advantage of this technique over the earlier posts, is that you don't have to back track.  You only travel through the maze once.

Edited on February 22, 2005, 4:46 am
  Posted by Ken Haley on 2005-02-22 04:30:14

Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2019 by Animus Pactum Consulting. All rights reserved. Privacy Information