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

 Wreck out! (Posted on 2006-04-03)
Supposing you are in a labyrinth, but you have a map and know where you are, there are many algorithms that will find a way out, if there is one.

Now, imagine you are allowed to wreck walls and make holes in them, so as to pass through. If you wreck enough walls, you are certain to be able to leave the labyrinth!

The problem: find an algorithm that determines the MINIMUM number of walls that should be broken in order to escape. Of course, it should also determine WHICH walls to break!

 See The Solution Submitted by Federico Kereki Rating: 4.1429 (7 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Solution | Comment 4 of 6 |
Since you have a map, "color" it in the following manner. "Color" the outside and any area inside that can reach the outside without breaking a wall as "zero". "Color" any area inside that can reach an area "colored" "zero" by breaking only one wall as "one". "Color" any area inside that can reach an area "colored" "k" by breaking only one wall as "k+1". Say you find yourself in an area "colored" "n". By breaking walls that get you from an area "colored" "k" to an area "colored" "k-1", you only have n walls to break to get outside.
 Posted by Bractals on 2006-04-03 14:47:02

 Search: Search body:
Forums (0)