Re:Maze Generator and Solver
by ChicagoDave on Tuesday May 26, 2015 @04:17AM
(#9603482)
Anyone that hand draws mazes as a hobby knows these auto-generated mazes leave something to be desired. There's an art to designing a maze and I've yet to see an auto-generator mimic that art. First step, curved and multi-length branches. Next step, add complex and very long teaser dead-ends. Block-style mazes are way too simple.
Re:Maze Generator and Solver
by stwe on Tuesday May 26, 2015 @07:10AM
(#9603944)
GitHub Pages supports HTTPS, so please include your JS/CSS schema-relative (//) or directly with HTTPS. Otherwise people who force HTTPS on that domain get mixed content warnings and nothing loads.
Re:Maze Generator and Solver
by LanceH on Tuesday May 26, 2015 @10:55AM
(#9605239)
I mostly wrote this: https://github.com/LanceH/Maze
while on conference calls before I started using that time to learn to draw.
I only ever ran it from within eclipse, I can't remember if it would run from the command line. It's a depth first search with solution also printed.
The only thing I added that I hadn't seen elsewhere is the "twisty" variable, which weights the random direction to either going straight or turning. I liked straight hallways on large mazes because it makes things blur together.
Re:Maze Generator and Solver
by s-macke on Tuesday May 26, 2015 @04:07AM
(#9603461)
I would like to see a code, which solves a maze by calculating the Poisson equation for pressure. As boundary condition set high pressure at the start of the maze and low pressure at the end and follow the steepest decent.
Re:Maze Generator and Solver
by s-macke on Tuesday May 26, 2015 @08:11AM
(#9604211)
Yes, open boundary conditions at the walls.
I am not sure what happens if you have two possible paths to the exit but one of them is wider, but longer. It might not always find the shortest path.
I like this main idea, because it is independent on the dimension and structure of the maze.
Re:Maze Generator and Solver
by tempodox on Tuesday May 26, 2015 @08:46AM
(#9604392)
Whatever it was built for, it doesn't run in Safari. And “but it runs in browser X” is almost as acceptable a retort as “it would run with square wheels”, in 2015, on the front page of HN.
Re:Maze Generator and Solver
by lovegraphs on Wednesday May 27, 2015 @03:25AM
(#9609855)
By the way, thank you for your colorful simile--it really spurred me to fix this issue this morning, and I've definitely learned to take cross-browser compatibility more seriously. Cheers.
Re:Maze Generator and Solver
by lovegraphs on Tuesday May 26, 2015 @04:27AM
(#9603504)
The particular generation algorithm that you see is called "Randomized Prim's algorithm" on Wikipedia. It starts at a random cell in a grid, marks it as discovered, and adds all of that cell's adjacent walls to a queue. It then selects a random wall from the queue and, if the cell on the other side of the wall has not yet been discovered, opens up that wall. It adds all of the adjacent cell's walls to the queue, marks the adjacent cell as discovered, and selects the next random wall in the queue until all the cells have been discovered. It's kind of a modified BFS. This algorithm guarantees that all cells are connected.
Re:Maze Generator and Solver
by white-flame on Tuesday May 26, 2015 @04:18AM
(#9603485)
Most maze generators build a giant tree, starting from an arbitrary point and sending out branching corridors until the area is full. By its nature everything's connected.
Re:Maze Generator and Solver
by ahmetmsft on Tuesday May 26, 2015 @03:35AM
(#9603377)
It probably calculates the path in advance (note the "please wait" indicator appears just after you hit 'Solve') then it follows the path with an animation that gives you exactly the impression that it never falls into a trap as it goes.
Re:Maze Generator and Solver
by lovegraphs on Tuesday May 26, 2015 @03:58AM
(#9603433)
That's right, it does a breadth-first-search from the end-point immediately upon clicking the end-point; it then traces the path from the start-point, following the parent-pointers set during the BFS, painting the DOM in the process.
I only ever ran it from within eclipse, I can't remember if it would run from the command line. It's a depth first search with solution also printed.
The only thing I added that I hadn't seen elsewhere is the "twisty" variable, which weights the random direction to either going straight or turning. I liked straight hallways on large mazes because it makes things blur together.
e.g. http://sgd.cs.colorado.edu/wiki/Collaborative_Diffusion
http://simulationcorner.net/maze/
I am not sure what happens if you have two possible paths to the exit but one of them is wider, but longer. It might not always find the shortest path.
I like this main idea, because it is independent on the dimension and structure of the maze.
https://github.com/mikolalysenko/l1-path-finder
In this demo page you can click on the title and the little dots will chase your mouse around:
http://mikolalysenko.github.io/l1-path-finder/www/
[1] http://en.wikipedia.org/wiki/Longest_path_problem