frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Generating Mazes with Inductive Graphs (2017)

https://jelv.is/blog/Generating-Mazes-with-Inductive-Graphs/
20•todsacerdoti•1y ago

Comments

tomfly•1y ago
where is the entrance and exit?
Jaxan•1y ago
Doesn’t matter, because all positions are reachable. So just pick any two positions at the border and remove a wall.
kazinator•1y ago
Here is a maze that was generated recursively starting at the upper left cell.

  +    +----+----+----+----+----+----+----+----+----+
  |    |                        |                   |
  |    |                        |                   |
  +    +----+----+    +----+    +----+    +----+    +
  |              |         |                   |    |
  |              |         |                   |    |
  +----+----+    +    +----+----+----+----+----+    +
  |              |    |                        |    |
  |              |    |                        |    |
  +    +----+----+    +    +----+----+----+    +    +
  |         |              |              |    |    |
  |         |              |              |    |    |
  +    +----+    +    +----+----+----+    +    +----+
  |              |    |                   |    |    |
  |              |    |                   |    |    |
  +----+----+----+    +    +----+----+----+    +    +
  |                        |                   |    |
  |                        |                   |    |
  +    +----+----+----+    +    +----+----+----+    +
  |    |    |              |    |              |    |
  |    |    |              |    |              |    |
  +    +    +    +    +----+    +    +----+    +    +
  |    |    |    |    |         |    |         |    |
  |    |    |    |    |         |    |         |    |
  +    +    +    +    +----+----+----+    +    +    +
  |    |    |    |    |                   |         |
  |    |    |    |    |                   |         |
  +    +    +----+    +    +----+----+    +----+----+
  |              |         |                        |
  |              |         |                        |
  +----+----+----+----+----+----+----+----+----+    +

It matters to start there because it will be easier if you go backwards.

The maze has 100 cells. For each cell, we can calculate which exit goes back toward the entrance, assigning the letters U, D, L, R:

  U R R D L L R D L L
  U L L D L U L L L U
  R R U D D L L L L U
  U L D L L R R D U U
  U L L U D L L L U D
  R R R U L R R R U D
  U D R R U U R R D D
  U D U U R U U D L D
  U D U U D L L L U L
  U L L U L R R U L L
Stats:

  L - 33
  U - 29
  R - 20
  D - 18
Left and Up are more frequent back-to-entrance escapes than Right or Down. This is because of the way the maze was generated.

To check the hypothesis, we should analyze it in the other direction. For each cell, determine the exit which heads in the direction of the exit:

  D R R D L L R D L L
  D R D D L U L L L U
  D L L D D L L L L U
  D L R D L R R D D U
  R R U D D L L L U D
  R R R R D R R R U D
  U D R D L U R R D D
  U D U D R U U D L D
  U D U D R R R D U L
  U L L R U R R R R D
Stats:

  D - 30
  R - 28
  L - 24
  U - 18
There is a weaker bias for the D-R axis toward the exit, compared to the L-U axis toward the entrance. I suspect if we study larger numbers of larger mazes, we will find similar findings.

So that is to say, it is easier to navigate the maze in the reverse direction: the heuristic to try left/up exits will work more often than the right/down in the proper direction.

smartmic•1y ago
From the book "Mazes for Programmers" by Jamis Buck, 2015, The Pragmatic Programmers (a must-read for any maze/programming enthusiast!):

> Aren't mazes supposed to have starting points and end points? […] honestly, […] it's entirely up to you. […] The maze […] is a perfect maze, and one of the attributes of a perfect maze is that there exists exactly one path between any two cells in it. […] You pick them, and there's guaranteed to be a path between them.

You do not need to choose an entrance or exit only on the sides, but you can also choose "Pacman-style" where the goal is to reach points inside the maze.

"Perfect" refers to the mathematical/logical properties of a maze (i.e. no loops), not the aesthetical aspect. I have not checked though if the mazes in the source here are all perfect.

kazinator•1y ago
While you can put the entrance and exit wherever you want, if you know that the maze was generated by a recursive branching process which had a starting point somewhere, it probably behooves you to put the start at that point corresponding to the root of the tree, so that the maze wanderer faces the most branching choices.

Laying out the abstract maze tree into the rectilinear grid of cells obfuscates the tree somewhat, but not entirely. A process that generates from upper left to lower right, for instance, will tend to generate cells whose parent-headed exits going left and up more often than not, making the reverse direction a bit easier.

(Again, it depends on the maze generation process.)

kazinator•1y ago
Making random mazes in a rectilinear grid is a good exercise for one big reason: mazes are not all the same. Mazes have style can be very knotty and twisty, or have long passages. You can add hacks into a given algorithm to vary the style, but there are certain things it won't necessarily do.

Organic Maps

https://organicmaps.app/
232•tosh•2h ago•54 comments

Introduction to Compilers and Language Design

https://dthain.github.io/books/compiler/
136•AlexeyBrin•4h ago•16 comments

Run Windows 2000 on a DEC Alpha with a new es40 fork

https://raymii.org/s/blog/Run_Windows_2000_for_Dec_Alpha_on_a_new_es40_fork.html
28•jandeboevrie•2h ago•5 comments

Airplane Boneyards List and Map

https://airplaneboneyards.com/airplane-boneyards-list-and-map.htm
32•hyperific•1d ago•3 comments

Medieval-style fortifications are back in the Sahel

https://www.economist.com/middle-east-and-africa/2026/06/25/medieval-style-fortifications-are-bac...
41•andsoitis•4d ago•25 comments

Shadcn/UI now defaults to Base UI instead of Radix

https://ui.shadcn.com/docs/changelog
226•dabinat•11h ago•118 comments

Rayfish, Peer-to-peer mesh VPN with no server to trust

https://rayfish.xyz/blog/01-introducing-rayfish
22•captain_dfx•4d ago•8 comments

Pandoc Lua Filters

https://pandoc.org/lua-filters.html
113•ankitg12•2d ago•10 comments

Phosh 0.56.0

https://phosh.mobi/releases/rel-0.56.0/
117•edward•2h ago•34 comments

Solar rail could become common in Europe after successful trial in Switzerland

https://www.euronews.com/2026/07/05/italy-could-be-the-next-country-to-build-a-solar-railway-afte...
24•neilfrndes•1h ago•11 comments

The GNU Emacs Architecture: Unlocking the Core [pdf]

https://www.diva-portal.org/smash/get/diva2:2052282/FULLTEXT01.pdf
127•cenazoic•4d ago•8 comments

Cannabis Users Face Substantially Higher Risk of Heart Attack (2025)

https://www.acc.org/about-acc/press-releases/2025/03/17/15/35/cannabis-users-face-substantially-h...
98•RickJWagner•4h ago•120 comments

Show HN: KiCad in the Browser

https://demo.pcbjam.com/
46•ViktorEE•4h ago•20 comments

Trust your compiler: Modern C++

https://categorica.io/blog/2026.06.29_trust_your_compiler/
51•foxhill•4d ago•31 comments

Fast Software, the Best Software (2019)

https://craigmod.com/essays/fast_software/
91•ustad•8h ago•49 comments

If you're a button, you have one job

https://unsung.aresluna.org/if-youre-a-button-you-have-one-job/
426•nozzlegear•14h ago•212 comments

Knowledge Should Not Be Gated

https://www.formaly.io/blog/knowledge-should-not-be-gated
65•nezhar•8h ago•43 comments

Megawatts by Microwave

https://computer.rip/2026-07-04-microwave-and-power.html
58•eternauta3k•10h ago•5 comments

Moby Dick Workout (2022)

https://www.hogbaysoftware.com/posts/moby-dick-workout/
83•helloplanets•11h ago•27 comments

EU Council forces Chat Control via fast-track

https://www.heise.de/en/news/Chat-Control-1-0-EU-Council-forces-messenger-scans-via-fast-track-11...
99•stavros•4h ago•26 comments

Command and Conquer Generals natively ported to macOS, iPhone, iPad using Fable

https://github.com/ammaarreshi/Generals-Mac-iOS-iPad/tree/main
620•asronline•20h ago•261 comments

Artful Cats: Feline-Inspired Art and Artifacts

https://www.si.edu/spotlight/art-cats
72•jruohonen•3d ago•5 comments

Meta's Un-Stable Signature

https://hackerfactor.com/blog/index.php?/archives/1098-Metas-Un-Stable-Signature.html
124•ementally•3d ago•20 comments

Atomic Force Microscope [video]

https://www.youtube.com/watch?v=DyIQkqBXhS0
106•mhb•2d ago•15 comments

The Log is the Agent

https://arxiv.org/abs/2605.21997
82•iacguy•13h ago•30 comments

Functional Programming in hica

https://www.hica.dev/docs/functional-programming/
38•cladamski79•3d ago•9 comments

GPT-5.5 Codex reasoning-token clustering may be leading to degraded performance

https://github.com/openai/codex/issues/30364
332•maille•18h ago•134 comments

About the Digital Art

https://www.tricivenola.com/about-the-digital-art/
28•NaOH•3d ago•11 comments

Autonomous flying umbrella follows and shields users from rain and sunlight

https://www.designboom.com/technology/autonomous-flying-umbrella-follows-users-rain-sunlight-i-bu...
3•amichail•30m ago•1 comments

Return of the Nigerian Prince Redux: Beware Book Club and Book Review Scams (2025)

https://writerbeware.blog/2025/09/19/return-of-the-nigerian-prince-redux-beware-book-club-and-boo...
69•Anon84•15h ago•24 comments