frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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.

The newest Instagram “exploit” is the goofiest I've seen

https://www.0xsid.com/blog/meta-account-takeover-fiasco
1126•ssiddharth•6h ago•271 comments

Debug Project

https://debug.com/
90•Eridanus2•2h ago•38 comments

AI Agent Guidelines for CS336 at Stanford

https://github.com/stanford-cs336/assignment1-basics/blob/main/CLAUDE.md
267•prakashqwerty•6h ago•104 comments

Should you normalize RGB values by 255 or 256?

https://30fps.net/pages/255-vs-256-division/
148•pplanu•5h ago•61 comments

CS336: Language Modeling from Scratch

https://cs336.stanford.edu/
308•kristianpaul•8h ago•40 comments

What appear to be biochemical processes may be a natural feature of geology

https://www.quantamagazine.org/the-dirt-that-refused-to-die-20260601/
166•speckx•7h ago•49 comments

GrapheneOS Speech Services version 2 released

https://discuss.grapheneos.org/d/36001-grapheneos-speech-services-version-2-released
61•pretext•4h ago•10 comments

Stealing from Biologists to Compile Haskell Faster

https://www.iankduncan.com/engineering/2026-05-30-stealing-from-biologists-to-compile-haskell-fas...
69•mooreds•2d ago•4 comments

A 10 year old Xeon is all you need

https://point.free/blog/gemma-4-on-a-2016-xeon/
656•cafkafk•16h ago•266 comments

Florida sues OpenAI and Sam Altman over AI risks

https://www.politico.com/news/2026/06/01/openai-hit-with-florida-lawsuit-00944215
156•cyunker•6h ago•127 comments

Nvidia RTX Spark

https://www.nvidia.com/en-us/products/rtx-spark/
273•shenli3514•17h ago•232 comments

Ask HN: Who is hiring? (June 2026)

131•whoishiring•7h ago•203 comments

Microsoft builds MacBook Pro rival with NVIDIA-powered Surface Laptop Ultra

https://www.windowslatest.com/2026/06/01/microsoft-builds-its-ultimate-macbook-pro-rival-with-the...
97•jbk•10h ago•275 comments

I made my phone slow on purpose

https://vinewallapp.com/notes/i-made-my-phone-slow-on-purpose/
146•gcampos•4d ago•135 comments

GitHub and the crime against software

https://eblog.fly.dev/githubbad.html
168•pplanu•3h ago•64 comments

Anthropic confidentially submits draft S-1 to the SEC

https://www.anthropic.com/news/confidential-draft-s1-sec
401•surprisetalk•6h ago•319 comments

Building a custom mount for a telescoping webcam

https://john.mercouris.online/webcam-mount.html
9•jmercouris•1d ago•2 comments

Windows GOG DOS Games on M-Series Macs

https://f055.net/technology/windows-gog-dos-games-on-m-series-macs/
124•f055•9h ago•75 comments

Only 17% of all 64-bit Integers are products of two 32-bit integers

https://lemire.me/blog/2026/05/22/only-17-of-all-64-bit-integers-are-products-of-two-32-bit-integ...
178•sebg•4d ago•87 comments

Flipper Zero Zig Template

https://github.com/NishantJoshi00/flipper-template
116•Nars088•9h ago•8 comments

Ask HN: Who wants to be hired? (June 2026)

72•whoishiring•7h ago•237 comments

Launch HN: Expanse (YC P26) – Unlock Wasted GPU Capacity

62•ismaeel_bashir•9h ago•14 comments

Malicious npm packages detected across Red Hat Cloud Services

https://github.com/RedHatInsights/javascript-clients/issues/492
705•kurmiashish•9h ago•392 comments

Show HN: A free Linux adaptation of NETworkManager by BornToBeRoot

https://github.com/thongor77/nmlinux
14•magetriste•2d ago•3 comments

The Pirate Bay Remains Resilient, 20 Years After the Raid

https://torrentfreak.com/the-pirate-bay-remains-resilient-20-years-after-the-raid/
456•speckx•8h ago•229 comments

Sysadmining Like It's 2009

https://lambdacreate.com/posts/sysadmining-like-its-2009
82•yacin•9h ago•32 comments

Linux Basics for Hackers (2019)

https://github.com/ahegazy0/linux-basics-for-hackers-notes
120•ibobev•9h ago•21 comments

Superintelligence: The Idea That Eats Smart People (2016)

https://idlewords.com/talks/superintelligence.htm
104•thoughtpeddler•5h ago•118 comments

Handmade Hawaiian Islands Map

https://www.notesfromtheroad.com/roam/hawaiian-islands-map.html
42•bovermyer•2d ago•16 comments

Show HN: Textile – A desktop app for weaving together bits of text

https://www.gettextile.app
22•stack_framer•3h ago•8 comments