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.

The story Scientific American wouldn't let me tell

https://www.whatsitlike.me/the-story-scientific-american-wouldnt-let-me-tell/
1•mathgenius•59s ago•0 comments

Roof ushered in a new era for full-text helmet

https://www.roof.fr/en/djagger/682-ro340-djagger-carbon.html
1•teekert•5m ago•1 comments

The Farnese Letter

https://simonklee.dk/farnese-letter
1•latchkey•8m ago•0 comments

Can AI Create PLC Attacks? Yes, but It's Not That Easy Yet

https://www.forescout.com/blog/can-ai-create-plc-attacks-yes-but-it%E2%80%99s-not-that-easy-yet/
1•Tomte•8m ago•0 comments

Müller-Lyer Illusion

https://en.wikipedia.org/wiki/M%C3%BCller-Lyer_illusion
1•thunderbong•12m ago•0 comments

Union Alpha Stealth Model

https://developers.cloudflare.com/ai/models/stealth/union-alpha/
1•djfergus•13m ago•0 comments

I'm excited about Maps and built an gamified news app around it

2•sourav_biswas•17m ago•2 comments

AI agents can modify themselves without humans telling them to do so

https://www.theregister.com/security/2026/09/16/ai-agents-can-modify-themselves-without-humans-te...
3•galaxyLogic•19m ago•0 comments

PC ports of old console games are the new AI vibe coding battleground

https://www.pcgamer.com/gaming-industry/pc-ports-of-old-console-games-are-the-new-ai-vibe-coding-...
1•FMecha•23m ago•0 comments

Typesafe AI

https://typesafe.ai/
1•bretpiatt•28m ago•0 comments

Show HN: Webhook Proxy – Fail-safe logging and 1-click retries for webhooks

https://webhook-proxy-zeta.vercel.app/
1•MAHADDD•30m ago•1 comments

Show HN: I built a Mac app to make technical PDF textbooks easier to study

https://marginstudy.app/
1•alricsiu•31m ago•0 comments

What Little Hope Remains

https://blog.coredump.cx/p/what-little-hope-remains
3•surprisetalk•33m ago•0 comments

Building S4 – our own high-performance time-series data store

https://medium.com/life-at-propeller/building-s4-our-own-high-performance-time-series-data-store-...
1•JoeBot3000•34m ago•0 comments

Ddlforge: Zero-downtime Postgres migration supervisor for Node ORMs

https://github.com/x7ssss/ddlforge
1•plamkatawee•35m ago•0 comments

Communication by means of modulated Johnson noise

https://www.pnas.org/doi/10.1073/pnas.2201337119
2•austinallegro•37m ago•0 comments

GuitarEasy: ChatGPT converts guitar tabs, GuitarEasy.app plays it, you practise

https://github.com/ShaojieJiang/guitareasy
1•NeuralNotwork•39m ago•0 comments

iOS 27.2 Could Save Your Marriage

https://www.macrumors.com/2026/09/16/ios-27-2-could-save-your-marriage/
2•tosh•41m ago•0 comments

The 'Kraken' Existed, and Scientists Found Its Jaws Hidden in Stone

https://dailygalaxy.com/2026/09/kraken-giant-octopus-fossil-jaws-discovery/
2•wertyk•42m ago•0 comments

Walter Murch: Sound Designer Interview

https://sound.krotosaudio.com/walter-murch-interview/
1•andsoitis•44m ago•0 comments

Unicode Link Detection and Formatting: URLs and Email Addresses

https://www.unicode.org/reports/tr58/tr58-3.html
1•u1hcw9nx•47m ago•0 comments

Ask HN: What model is new stealth Union Alpha model?

1•soltanov•48m ago•3 comments

AI is the next problem, but Social Media is still the #1 issue on the internet

https://medium.com/whatsnextwray/the-problem-with-social-media-c97c9af7eba4
1•raynchad•51m ago•0 comments

New stealth model: Union Alpha

https://twitter.com/OpenRouter/status/2100235351575191751
1•soltanov•54m ago•2 comments

Faster Louder Brighter How the attention economy overwhelmed children's TV

https://www.theguardian.com/news/2026/sep/17/faster-louder-brighter-how-the-attention-economy-ove...
2•rdmuser•55m ago•0 comments

Unicode 18.0

http://blog.unicode.org/2026/09/announcing-unicode-standard-version-180.html
1•soheilpro•56m ago•2 comments

SAIR Competition – Lean Kernel Challenge

https://terrytao.wordpress.com/2026/09/16/sair-competition-lean-kernel-challenge/
1•grubbydiff•58m ago•0 comments

Shodan indexes over 47.000 exposed Ollama instances

https://twitter.com/co11ateral/status/2100313790604599444
2•soltanov•59m ago•1 comments

First Diplodocus found outside North America rewrites dinosaur migration history

https://www.thebrighterside.news/post/first-diplodocus-found-outside-north-america-rewrites-dinos...
1•fuzzythinker•1h ago•0 comments

Trump suggests EU allowing Canada as associate member could be a 'hostile act'

https://apnews.com/article/canada-europe-trump-tariffs-4078e9549ff9caa5ded08f7dd2f99065
4•vrganj•1h ago•3 comments