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.

Do Everything with Cewsco

https://cewsco.com/
1•kalkalnewyork•2m ago•0 comments

Show HN: Free Online GIS Viewer and Format Converter

https://geodataviewer.com/
2•twainyoung•8m ago•0 comments

Claude Sonnet 5: strong agentic performance at a higher cost per task

https://artificialanalysis.ai/articles/claude-sonnet-5-agentic-cost
2•himata4113•8m ago•0 comments

Open USD

https://joinopenstandard.com/blog/introducing-open-usd
2•Kinrany•9m ago•0 comments

Kolmogorov Complexity

https://en.wikipedia.org/wiki/Kolmogorov_complexity
2•tristenharr•9m ago•0 comments

The new political screening that's stalling NIH grants

https://www.nature.com/articles/d41586-026-01924-8
2•rguiscard•10m ago•0 comments

Men are funnier than women, study claims (2019)

https://www.bbc.com/news/newsbeat-50221046
2•doener•13m ago•0 comments

On the Efficacy of PyTorch for High-Performance Computing

https://dl.acm.org/doi/10.1145/3801487.3801838
2•matt_d•14m ago•0 comments

AI in higher ed: just like the shock of the Internet and the web?

https://nocodefunctions.com/blog/higher-education-AI-web/
2•seinecle•16m ago•0 comments

AI models' values are very different from most people's

https://www.economist.com/briefing/2026/06/25/ai-models-values-are-very-different-from-most-peoples
2•pseudolus•21m ago•1 comments

Trump to lift limits on Anthropic's Fable model

https://www.politico.com/news/2026/06/30/anthropic-wh-lifting-export-limits-00980865
4•cyunker•22m ago•1 comments

Panasonic's new residential CO₂ air-to-water heat pump:coeff of performance=6.1

https://www.pv-magazine.com/2026/06/29/panasonic-launches-co%E2%82%82-air-to-water-heat-pump-with...
4•bookofjoe•24m ago•0 comments

Zhuangzi and the Case Against Meritocracy

https://aeon.co/essays/zhuangzi-and-the-case-against-meritocracy
2•herbertl•26m ago•0 comments

Marketnow Free Skills

https://marketnow.site
2•eddyflores•27m ago•1 comments

Claw Patrol Security firewall for agents

https://clawpatrol.dev/
2•steilpass•35m ago•0 comments

Catalyst: Automating a task forever should be easier than doing it manually once

https://www.serval.com/serval-news/introducing-catalyst-automating-a-task-forever-should-be-easie...
4•emot•37m ago•0 comments

NASA makes moves to dodge costly delays on its path to build a $30B moon base

https://www.cnn.com/2026/06/30/science/nasa-moon-base-announcement
2•mooreds•38m ago•0 comments

We Live Like Royalty and Don't Know It

https://www.thenewatlantis.com/publications/we-live-like-royalty-and-dont-know-it
3•mooreds•39m ago•1 comments

Anthropic launches AI drug discovery program

https://www.google.com/url?q=https://www.cnbc.com/2026/06/30/anthropic-launches-ai-drug-discovery...
1•benchtobedside•41m ago•0 comments

STMZ Kinetic

1•Stmz_Kinetics•42m ago•0 comments

What a Russian Army Collapse Might Look Like

https://www.thebulwark.com/p/what-a-russian-army-collapse-might-look-like-ukraine-drones-logistic...
5•mooreds•46m ago•3 comments

Australia sues Amazon for making allegedly unfair contracts with subscribers

https://www.bbc.com/news/articles/c20yz9rzwy0o
2•aussieguy1234•49m ago•0 comments

Solid-state material converts sunlight into UV light

https://phys.org/news/2026-06-solid-state-material-visible-high.html
1•indynz•49m ago•0 comments

I like Claude Desktop, so I created my own

https://www.zandrey.com/blog/i-like-claude-desktop-so-i-created-my-own
2•rats•50m ago•0 comments

Show HN: Hinge for Trading

https://www.retail-intelligence.ai/
4•chips2011•51m ago•0 comments

Find Top Shopify Development Services for Your ECommerce Success

https://www.techwrath.com/top-shopify-development-services-ecommerce-success/
1•techwrath11•54m ago•0 comments

Cool way to grow early stage revenue

https://x.com/kyaagents
1•Johnall_n•54m ago•0 comments

Commonplace: Self-hosted, privacy-tiered memory for your AI agents

https://github.com/itsmeduncan/commonplace
1•itsmeduncan•57m ago•0 comments

Trump Reports at Least $1.4B in 2025 Crypto Earnings

https://www.bloomberg.com/news/articles/2026-06-30/trump-reports-at-least-1-2-billion-in-crypto-e...
8•petethomas•59m ago•0 comments

Reddit will require you to log in to use old.reddit.com

https://arstechnica.com/gadgets/2026/06/reddit-will-require-you-to-log-in-to-use-old-reddit-com/
12•righthand•1h ago•5 comments