[HN Gopher] Maze Generator
___________________________________________________________________
Maze Generator
Author : sandebert
Score : 140 points
Date : 2023-12-22 09:11 UTC (13 hours ago)
(HTM) web link (mazegenerator.net)
(TXT) w3m dump (mazegenerator.net)
| rippeltippel wrote:
| > the mazes from this site are not free to use for commercial
| purposes. If you are planning to use them in something you will
| sell, you need to get a commercial license.
|
| There are already several online maze generator whose output is
| free for commercial use. What's so special about this one?
| thih9 wrote:
| Which ones? Can you show an example of such a maze generator?
| It's hard to compare otherwise.
| rippeltippel wrote:
| Just a few from a quick search:
|
| https://mazesforfun.com/maze-generator
|
| https://puzzlemaker.discoveryeducation.com/maze
|
| https://multimazegenerator.com/
|
| https://keesiemeijer.github.io/maze-generator/
| fogleman wrote:
| That first one looks suspiciously similar to OP's.
| lebean wrote:
| Uncanny how two UIs for a program with a small number of
| parameters, which output the same kind of thing, can look
| so similar. I call shenanigans!
| FireInsight wrote:
| Probably the author being annoyed by their website being
| recommended by someone for generating "passive income" based on
| someone else's labor.
| ketralnis wrote:
| I agree and it's certainly their perogative and one should
| respect it.
|
| That said, how are people using this to generate any income
| at all? Printing out and selling mazes? How big can that
| market be?
| phailhaus wrote:
| Doesn't have to be special, the creator just wants to be
| compensated if you're using it for commercial use. You're free
| to go to other creators if you want.
| flykespice wrote:
| Or just ignore it lol
| tromp wrote:
| Comprehensive generator with many styles and output options. TIL
| that mazes with a short solution path are called "Elitist".
|
| Maze generation algorithms [1] are great fun. This book chapter
| [1] details the development of my 198X IOCCC maze generation
| submission re-discovering Eller's algorithm.
|
| [1] https://en.wikipedia.org/wiki/Maze_generation_algorithm
|
| [2] https://tromp.github.io/maze.html
| livrem wrote:
| Guess triangular and hexagonal grids are somewhat rare, but not
| exactly unknown. I remember the Programming Clojure book
| included a maze-generator that was shown for both square and
| hex grids (and could probably be easily modified for triangles
| as well?).
|
| Surprisingly the linked generator does not seem to have any
| choice of different maze algorithms? I guess it only uses one
| of the perfect algorithms then, meaning all possible mazes have
| equal probability. Those tend to be pretty boring. I think the
| biased algorithms often create more interesting mazes.
|
| (EDIT: I see after reading some other comments here and the
| Help page that the E and R values can be set to create more
| biased mazes which sounds useful.)
|
| Jamis Buck's Maze algorithm page is a great resource and the
| book he wrote about programming mazes is even better. It has
| nice visualizations of how the biases from different not
| perfect algorithm creates different patterns of mazes.
|
| https://www.jamisbuck.org/mazes/
|
| Implementing and visualizing different maze algorithms is
| probably my favorite kind of exercise when trying some new
| programming language (or things like game
| frameworks/libraries). Most of the algorithms are very easy, so
| there are no distractions from trying to get the logic right,
| but there are still some data-structures to play with and a bit
| more weight than Hello World.
| codingdave wrote:
| The solutions seems overly linear - make a large maze, and the
| solution does meander a bit, but I generated a dozen or so and
| never found one that actually traversed much of the maze. Is that
| intentional?
| GaggiX wrote:
| Change E to 0
| codingdave wrote:
| Thanks! That is way better.
|
| Although maybe instead of that just being an input field
| under "Advanced", its effect should be explained for us folk
| who don't know what those settings mean.
| rawling wrote:
| It's on the "help" page, as is R.
| codingdave wrote:
| Yeah, it is - but people don't often dig into help pages
| when they see something they find odd... they just close
| the page.
| albert_e wrote:
| Excellent
|
| Is there any curated collection of such generators that includes
| math and word problems for various grade levels as well? Or
| crosswords and other small games etc?
| NeutralForest wrote:
| I discovered this book in an HN comment, it's only right I post
| it here as well http://www.mazesforprogrammers.com/
| loupol wrote:
| Haven't read the book, but the author wrote multiple blog
| entries about different maze generation algorithms[0] prior to
| its publishing which I found personally useful.
|
| [0] http://weblog.jamisbuck.org/archives.html (the maze posts
| date from early 2011)
| mysterydip wrote:
| I have it and it was a really enjoyable read! Gave me some good
| ideas for a game I was working on.
| beautron wrote:
| This is an enjoyable book! It's an easy read, and the code is
| nice and straightforward. It avoids getting lost in any
| programming weeds, revealing the maze algorithms and techniques
| clearly.
|
| I used what I learned to add a maze generator to the game I'm
| working on! So far only one level makes use of it (since most
| levels are better off being hand-crafted), but I have ideas for
| some other interesting levels that might use the maze
| generator.
| brap wrote:
| What's E and R?
| Dutchie987 wrote:
| From the help page: E-value - Controls the
| elitism tendency of the generation algorithm. An elitist maze
| has a short solution relative to the size of the maze, while a
| non-elitist has a solution going through a larger portion of
| the maze. R-value - Controls the river tendency of the
| generation algorithm. A maze with a high river factor has few
| but long dead ends, while one with a low river factor will have
| many short dead ends.
| moses-palmer wrote:
| This, I presume, it's the perfect opportunity to promote my own
| maze generator[1], which incidentally is a Real Application that
| you can run on your own computer, and the output of which you
| own!
|
| Like the linked application, it supports triangular, rectangular
| and hexagonal grids, and different generation algorithms, which
| can be combined for various areas of the final maze. It also
| supports background and mask images to colourise rooms and
| provide a shape for the maze, as well as a small selection of
| effects to apply. The output format is either SVG or PNG.
|
| And for that extra HN cred, it's written in Rust (which you are
| free to ignore if you're not into RIIR, but this is in fact a
| rewrite of an earlier Python project of mine)!
|
| [1]: https://github.com/moses-palmer/labyru
| thih9 wrote:
| Is there a web demo?
| moses-palmer wrote:
| No, you'll have to exercise your own CPU I'm afraid!
| addandsubtract wrote:
| Your readme is pretty thin on information. How do I even
| run this? How can I configure the parameters?
| moses-palmer wrote:
| A kind soul contributed an update to the README---
| basically the output of `cargo run --bin maze-maker --
| --help.
|
| I guess today's lesson is: do promote your personal
| project even when it's semi-arsed, because people on the
| Internet are mostly kind and will help you improve your
| documentation!
| popey wrote:
| A friend of mine does coding live streams on Twitch. It's
| pleasantly surprising how many randos (who become
| internet friends) will help out with your projects.
| replyifuagree wrote:
| Many human engineers get happy chemicals from helping
| people! Also many humans!
| pj_mukh wrote:
| Basic question: What would be the simplest way to "digitize"
| one of these mazes i.e. turn them into a programmable data
| structure (2D array, matrix, etc.) for example to use as input
| into a maze solver/RL demo?
| moses-palmer wrote:
| The main application is actually a thin wrapper around a
| library that does exactly that, so the best way would be to
| not perform the final step of turning the data structure into
| an image.
| llagerlof wrote:
| What are the methods available?
|
| --method <METHOD> The initialisation method to use
| joshbuckler wrote:
| Looks like "braid", "clear", "branching", or "winding"
| https://github.com/moses-
| palmer/labyru/blob/master/maze/src/...
| moses-palmer wrote:
| Yeah, I was hoping the `clap` macros would perform some
| unthinkable magic there... I will have to update the help
| with a listing.
|
| In the mean time, have a look here[1] for the possible
| values.
|
| [1]: https://github.com/moses-
| palmer/labyru/blob/7b92be3ae279a9ff...
| linkdd wrote:
| `clap` does have magic for enums: use
| clap::{Parser, ValueEnum}; #[derive(ValueEnum,
| Debug, Clone)] pub enum Foo { Bar,
| Baz, } #[derive(Parser, Debug)]
| #[command(author, version, about, long_about = None)]
| pub struct Args { /// description
| #[arg(short = 'f', long = "foo", value_enum, default_value
| = "bar")] foo: Foo, }
|
| The output of `--help` will look like: -f,
| --foo <FOO> description [default: bar] [possible values:
| bar, baz]
|
| This is with clap >= 4.4 with the derive feature.
| andruby wrote:
| I'd love to see a screenshot before downloading/installing.
| abound wrote:
| It's a command line program that outputs SVGs. Here's an
| example: https://paste.sr.ht/blob/d248dd89f96c6de981bf0870265
| a63be8e1...
|
| (download and open with a browser/SVG viewer)
|
| The invocation to generate that was:
| ./maze-maker --width=50 --height=50 --method
| braid,branching,winding out.svg
| josephcsible wrote:
| Can you add a license?
| thih9 wrote:
| My personal favorite is the triangular shape, with outer side
| length set to 200 and inner side length set to 197.
| Tokkemon wrote:
| That's a toughie.
| ourmandave wrote:
| One of several blog posts on roguelike game writing, Bob Nystrom
| wrote a maze generator.
|
| https://journal.stuffwithstuff.com/2014/12/21/rooms-and-maze...
| tantalor wrote:
| Been a while since I saw a FB like button on a real website
| injuly wrote:
| I remember writing a maze generator for a personal game project
| (a Nuclear clone-like). The wikipedia article for maze generation
| [1] was surprisingly helpful, though I ended up using something
| closer to a pseudo-random walker.
|
| [1] https://en.wikipedia.org/wiki/Maze_generation_algorithm
| rekado wrote:
| I prefer this one, which looks nice and generates crossings:
| https://github.com/daleobrien/maze
| keepamovin wrote:
| When I was 21, I had a friend who could draw these by hand.
| Crazy. It always blew me away. I was amazed. She'd know how to
| draw them and know they only had 1 solution too, but she'd have
| to figure out the solution IIRC. It freaked me out. Aside from
| that, she was "normal", relatively. Mad respect :)
| analog31 wrote:
| Back in high school, I wrote a maze generator in BASIC, that
| printed the maze using ASCII characters. Then I figured out the
| biggest maze that would fit on a sheet of 132 column green bar
| paper, and submitted the job to the mainframe computer.
|
| Next morning, I got an angry rebuke from the teacher. The
| mainframe operator had killed my program after it had run for
| quite some time, assuming it was an endless loop. It just turns
| out my program had some astronomical order of complexity.
|
| I sure wish I still had the source code.
| andrewla wrote:
| When my kids were smaller, they would often request that I make
| mazes for them on restaurant placemats, etc. Since I was working
| in crayon, many of the traditional maze generation algorithms,
| which relied on removing walls, were inapplicable.
|
| What I found, though, was that you can construct mazes
| additively, while ensuring a single unique solution, by looking
| at the dual of the maze. If you start by drawing a shape with an
| entrance and an exit, you can start at any wall (including the
| borders, and just start drawing lines out that do not intersect
| previous lines. Basically you get a forest-like structure.
|
| The neat thing is that this method can generate all mazes, and
| you can look at any generated maze, and if you just look at the
| dual (the tree-like graph of the walls) it's surprisingly easy to
| see the solution almost immediately. Hard to unsee once you get
| into the mindset of looking for it.
___________________________________________________________________
(page generated 2023-12-22 23:01 UTC)