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.

Decker, a platform that builds on the legacy of Hypercard and classic macOS

https://beyondloom.com/decker/
213•tosh•6h ago•47 comments

French firefighters face 'pyrocumulonimbus' for first time

https://www.france24.com/en/live-news/20260726-french-firefighters-face-pyrocumulonimbus-for-firs...
160•saaaaaam•7h ago•74 comments

Teaching Kids Forth

https://gracefulliberty.com/articles/teaching-kids-forth/
43•rbanffy•3h ago•11 comments

We have proof automation now

https://www.imperialviolet.org/2026/07/26/zstd-lean.html
56•zdw•4h ago•6 comments

Introduction to Data-Oriented Design [pdf]

https://www.gamedevs.org/uploads/introduction-to-data-oriented-design.pdf
97•tosh•6h ago•31 comments

Simulate cassette tape audio profiles using FFmpeg

https://github.com/AARomanov1985/Audio-Cassette-Simulation
65•xterminal•5h ago•32 comments

Design is compromise

https://stephango.com/design-is-compromise
184•ankitg12•9h ago•70 comments

Htmx 4.0, the first JavaScript library to release exclusively on the Game Boy

https://swag.htmx.org/en-cad/products/htmx-4-the-game
346•rcy•13h ago•108 comments

Plasma Tunnels Reveal How Dying Satellites Fall to Earth

https://spectrum.ieee.org/space-debris-atmosphere-burn-up
38•marc__1•4h ago•18 comments

I Championed Prediction Markets. Look What They've Become

https://newsletter.platypuseconomics.com/p/i-championed-prediction-markets-look
4•NomNew•40m ago•2 comments

US citizen charged after GrapheneOS phone wipes during airport search

https://www.techspot.com/news/113236-us-prosecutors-charge-atlanta-man-after-grapheneos-phone.html
79•eecc•2h ago•27 comments

Show HN: CheapSecurity – Lightweight, Self-Hosted CCTV for Linux SBCs

https://github.com/gmrandazzo/CheapSecurity
100•zeldone•9h ago•21 comments

PGSimCity - How PostgreSQL Works

https://nikolays.github.io/PGSimCity/
3•jonbaer•46m ago•0 comments

I wanted a clock that never needed setting. Things escalated

https://arstechnica.com/gadgets/2026/07/i-wanted-a-clock-that-never-needed-setting-things-escalated/
45•lee_ars•3d ago•40 comments

How to Block Some of the Bots

https://nochan.net/b/Internet-Crap/20260606-How-To-Block-Some-Of-The-Bots/
73•Bender•6h ago•84 comments

How to Write English Prose

https://thelampmagazine.com/blog/how-to-write-english-prose
66•geneticdrifts•7h ago•36 comments

Go Analysis Framework: modular static analysis by go team

https://pkg.go.dev/golang.org/x/tools/go/analysis
174•AbuAssar•12h ago•36 comments

Show HN: Port Zero – how I learned to stop worrying and love PORT=0

https://portzero.net/
3•octopoc•1h ago•0 comments

History of John Backus's functional programming project [draft]

https://softwarepreservation.computerhistory.org/FP/
8•cwbuilds•2d ago•1 comments

GrapheneOS protections against data extraction from locked devices

https://discuss.grapheneos.org/d/40700-grapheneos-protections-against-data-extraction-from-locked...
383•Cider9986•19h ago•220 comments

The New AI Superpowers: Focus and Followthrough

https://www.rickmanelius.com/p/the-new-ai-superpowers-focus-and
137•mooreds•11h ago•44 comments

How AST-grep Rewrote Tree-sitter in Rust and Made It 30% Faster

https://astgrep.com/blog/tree-sitter-rust-rewrite
58•herrington_d•7h ago•9 comments

The Usefulness of Useless Knowledge (1939) [pdf]

https://faculty.lsu.edu/kharms/files/flexner_1939.pdf
16•jxmorris12•3d ago•1 comments

The relay market powering token resellers and fraud

https://vectoral.com/blog/token-relay-market
147•mlenhard•9h ago•91 comments

Visualizing the Artemis II Mission

https://foxglove.dev/blog/visualizing-the-artemis-ii-mission
4•intrepidsoldier•1h ago•0 comments

I learned PCB design, 3D printing and C just to listen to music

https://pentaton.app/blog/2026-07-12-introducing-pentaton-lp/
172•interfeco•3d ago•35 comments

Kill The Cookie Banner

https://killthecookiebanner.eu/
806•rapnie•13h ago•394 comments

Fonts In Use – Find out where a font is used

https://fontsinuse.com/
5•open_•1h ago•0 comments

Jimothy the raccoon has a rare spinal condition. Here's what that means

https://www.popsci.com/science/whats-jimothy-raccoon-condition/
100•speckx•5d ago•52 comments

Show HN: Reverse Minesweeper

https://sunflowersgame.com/
142•pompomsheep•12h ago•48 comments