|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Not maze Labryinth generation |
|
![]() guesst Member since: 7/3/2007 From: Lehi, UT, United States |
||||
|
|
||||
| Now, don't read the title and think you know what I'm talking about. I mean labyrinth generation, not maze generation. I'm distinguishing it by the definition that a maze is multi-branching and a labyrinth is a single winding path. What I'm going to try to figure out is how to fill a grid with a single winding path. There must be no empty spaces left. It can begin and end anywhere. The labyrinth can be stored as nothing but a pointer to the next direction, the walls aren't that important. In fact for what I have in mind the walls are only going to get in the way. In case you're wondering I want to make a numbrix generator. Are there any geniuses here that can help me with this non-trivial problem? [Edited by - guesst on July 18, 2008 1:18:46 PM] |
||||
|
||||
![]() Hodgman Member since: 2/14/2007 From: Melbourne, Australia |
||||
|
|
||||
| The first thing I thought of is simply to brute force it. Pick a start location, randomly choose a valid direction, repeat. If no valid direction can be chosen, then you're at the end. If there are blank spaces still (cells that aren't visited by the path), then you fail, so start the whole process again. Eventually, chance will give you a valid path. According to this page, a term to search for might be "Unicursal maze". Quote: |
||||
|
||||
![]() guesst Member since: 7/3/2007 From: Lehi, UT, United States |
||||
|
|
||||
Quote: Woah, good resource there. Gotta get some sleep, but I'm definitely combing that over tomorrow. Brute forcing would work okay, but you don't need to go back all the way, just to where you can fill in the blank. For that matter, you don't need to finish the maze, just check at every interval if you've made an unreachable space, and if you have back up 3 spaces.... no, that may not work entirely. |
||||
|
||||
![]() guesst Member since: 7/3/2007 From: Lehi, UT, United States |
||||
|
|
||||
Quote: Hmmm, limited. Either the beginning and ending will be in the same place or on the edges. I don't like limitations. But they would work. I've mapped out all the past numbrixs as unicursal mazes and am analizing them, trying to see what I can do to make it happen. Thorny problem, this. |
||||
|
||||
![]() Umbrae Member since: 9/24/2004 From: Hamilton, New Zealand |
||||
|
|
||||
| Perhaps an idea is to start with a straight line from start to finish then continually look for ways to put 'kinks' in it, look at two adjacent empty squares and bend the path into it. Keep running this algorithm over the path until it's bent out of shape. Not only do you want to make additions to the path, but also move it for some modifications. The key is to always have a valid path so you never have to validate it and try to solve. |
||||
|
||||
![]() guesst Member since: 7/3/2007 From: Lehi, UT, United States |
||||
|
|
||||
Quote: That is a possibility and means that I simply insure that I never leave less than 2 spaces next to each other. It also means the in path has to meet up at the out path. It's an idea that bears some thinking out. |
||||
|
||||
![]() Pseudokai Member since: 6/25/2008 From: Corvallis, OR, United States |
||||
|
|
||||
| I'd recommend looking at Hamiltonian paths. If you treat each square in the grid as a vertex then it should be exactly what you're looking for. |
||||
|
||||
![]() guesst Member since: 7/3/2007 From: Lehi, UT, United States |
||||
|
|
||||
Quote: Ooh, fits the description. However, I don't can't find any randomized Hamiltionian path generation algorithms yet. Have to keep looking. A new game every week. Visit www.cymonsgames.com |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|