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.

Five Principles for Generating Readable AI Text in Bulk

https://fsdatalab.github.io/blog/agent-text-at-scale/
1•pretext•1m ago•0 comments

The Economics of Intelligence

https://institute.deepmind.com/essays/the-economics-of-intelligence/
1•pretext•3m ago•0 comments

Web Bot Auth: messh SDK 0.2.0 is out

https://messh.io
1•malviyamukul•4m ago•0 comments

Show HN: Catena – lazy sequences for Go where errors are elements

https://github.com/NerdMeNot/catena
1•srinivasiyer•4m ago•0 comments

Show HN: We mapped data center regulations across 50 states and 1,462 localities

https://regbase.com/datacenters
1•pensono•5m ago•0 comments

Show HN: Sheetgraph, AI agents can understand complex spreadsheets

https://github.com/asharma327/sheetgraph
1•asharma327•5m ago•0 comments

Show HN: System Design Articles from Companies

https://abhishekr3.github.io/rss-system-design/index.html
1•3Abhishek•6m ago•1 comments

An updated Model Spec for more capable and beneficial AI

https://openai.com/index/updated-model-spec/
1•pretext•8m ago•0 comments

We asked eleven AI models to chair the drafting of a multilateral statement

https://www.karlsnotes.com/we-asked-eleven-ai-models-to-chair-the-drafting-of-a-multilateral-stat...
2•valkrieco•8m ago•0 comments

Flexible wage deals can boost competitiveness, protect jobs, study says

https://www.reuters.com/business/world-at-work/flexible-wage-deals-can-boost-competitiveness-prot...
1•frank_clover•9m ago•0 comments

Alleged Chinese spy had 'close relationship' with Nvidia boss Jensen Huang

https://nypost.com/2026/10/29/business/alleged-chinese-spy-had-close-relationship-with-nvidia-bos...
5•mgh2•11m ago•0 comments

After 28 Years Walking Across the Globe, He's Almost Home

https://www.nytimes.com/2026/10/29/world/europe/karl-bushby-walking-globe-uk.html
1•rafaelc•12m ago•0 comments

Canada to invest up to $1.6B in Toronto-based AI company Cohere

https://www.cbc.ca/news/business/canada-cohere-ai-investment-9.7401367
3•barbazoo•14m ago•1 comments

Muscle Memory

https://my.clevelandclinic.org/health/articles/muscle-memory
1•jruohonen•14m ago•1 comments

Show HN: Pretty Git Tree – Your Git history as generative art

https://hmillerbakewell.github.io/pretty-git-tree/
2•hda-hda•15m ago•0 comments

Compose tasks, not implementations (2025)

https://thesephist.com/posts/task-composition/
1•mattvr•17m ago•0 comments

What America Is Living Without

https://www.nytimes.com/interactive/2026/10/28/opinion/american-dream-affordability.html
2•ParentiSoundSys•18m ago•0 comments

What's on That Access Port?

https://danielmangum.com/posts/whats-on-that-access-port/
1•hasheddan•19m ago•0 comments

Palantir shareholders want to know when they'll get their money back

https://www.ft.com/content/fbca8eb0-76ef-4e0e-bcc9-c45c8f7d1311
7•JumpCrisscross•20m ago•1 comments

Orbit.net Extra Packages for Nats.io

https://github.com/synadia-io/orbit.net
1•northlondoner•20m ago•1 comments

Shovel Brigade

https://www.shovel-brigade.cloud/
1•airhangerf15•21m ago•0 comments

Show HN: Playmat – Browser client for XMage, the open-source MTG engine

https://github.com/arcanite24/playmat
1•arcanite24•23m ago•0 comments

Thursday: A SerenityOS for Myself

https://shantaram.xyz/posts/2026/10/a-serenityos-for-myself
2•_shantaram•24m ago•0 comments

Rogue Constellation

https://rogueon.ai/blog/rogue-constellation
1•bananaflag•25m ago•0 comments

Fugazi

https://www.merriam-webster.com/slang/fugazi
1•gregsadetsky•25m ago•0 comments

Canada to join EU network of supercomputers

https://www.politico.eu/article/canada-joining-eu-supercomputer-network/
4•jruohonen•25m ago•1 comments

Show HN: Rankings of the state of the art, each figure sourced from the maker

https://tminuslabs.space/
1•tminuslabs•26m ago•0 comments

Renewables' Share of Electricity Is Rising While Nuclear Falling

https://ourworldindata.org/data-insights/the-world-is-getting-more-of-its-electricity-from-renewa...
2•karakoram•27m ago•0 comments

Show HN: Makr – find nearby co-founders

https://makr.breadbowl.ai/
1•mxudev•28m ago•0 comments

You Can Patch Everything [video]

https://www.youtube.com/watch?v=Hxqh2LS6vMs
1•karamazov•30m ago•0 comments