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.

Guide to the circular deals underpinning the AI Boom

https://www.bloomberg.com/graphics/2026-ai-circular-deals/
1•leonidasrup•4m ago•0 comments

Cottage Computer Programming (1984)

https://www.atariarchives.org/deli/cottage_computer_programming.php
1•lioeters•8m ago•0 comments

Landmark – an algorithmic index of relevant names, unclaimed at launch

https://landmarkindex.org
1•javierqac•15m ago•0 comments

I made a free PDF Editor that runs in a browser

https://www.pdfsimplified.com/
1•sanusihassan•15m ago•1 comments

Rejected by LessWrong for "Yellow Flags"

https://zenodo.org/records/21312304
1•tintweezl•18m ago•0 comments

Digital Dispensary and Headshop

https://shop.omeweed.com/
1•mmorga71•20m ago•0 comments

HubSpot transactional email: route through your domain with MailKite – MailKite

https://mailkite.dev/blog/hubspot-transactional-email-domain/
2•gabe_karina•21m ago•0 comments

'Hysteria' Grips San Francisco's Housing Market as A.I. Wealth Pours In

https://www.nytimes.com/2026/07/08/technology/san-francisco-home-sales-openai-anthropic-ipo.html
1•1vuio0pswjnm7•22m ago•0 comments

Why Write Code in 2026

https://softwaredoug.com/blog/2026/07/09/write-code.html
8•zdw•22m ago•1 comments

the history of the human face

https://economist.com/culture/2026/07/09/the-history-of-the-human-face-is-more-than-skin-deep
2•andsoitis•31m ago•0 comments

The Work of Helping A.I. Destroy Work

https://www.nytimes.com/2026/07/10/business/ai-white-collar-jobs.html
1•thm•32m ago•0 comments

Show HN: Chameleon – shows Claude a real file from your repo before it edits

https://github.com/crisnahine/chameleon
1•crisnahine•33m ago•0 comments

Under federal rule, colleges must leave grads better off or lose financial aid

https://www.npr.org/2026/06/30/nx-s1-5835631/turner-camhi-do-no-harm-college-loans
18•nradov•38m ago•3 comments

A Captive Audience

https://seths.blog/2026/07/a-captive-audience/
2•herbertl•45m ago•0 comments

In defense of not understanding your codebase

https://www.seangoedecke.com/in-defense-of-not-understanding-your-codebase/
1•herbertl•45m ago•0 comments

Cloudflare Threatens to Cut Google Off from Their Publishers in Searches

https://www.nakedcapitalism.com/2026/07/cloudflare-threatens-to-cut-google-off-from-their-publish...
4•hackandthink•54m ago•0 comments

Show HN: Dgxtop: Rust Monitor for DGX or need to monitor GPU status

https://github.com/DennySORA/dgxtop
1•dennysora-main•55m ago•0 comments

Run Claude and Codex in the Browser [video]

https://www.youtube.com/watch?v=wgNbFRgQXwU
4•Ellis_dev•59m ago•2 comments

The Mind-Bending Company That Gets a Million Job Applications–and Rejects 99.9%

https://www.wsj.com/business/bending-spoons-jobs-hiring-stock-eaed2b8e
1•Stratoscope•1h ago•1 comments

Notion database based form builder

https://ndbforms.com/
2•nookeshkarri7•1h ago•0 comments

Martin van Creveld Interview

https://www.sonshi.com/martin-van-creveld-interview.html
1•fisheuler•1h ago•0 comments

The Entire History of Tetris Game Design

https://www.youtube.com/watch?v=mGuYUEuVDYc
1•euthymiclabs•1h ago•0 comments

Negotiating AI in Open Source Software Communities: A Case Study of LLVM Project

https://gupea.ub.gu.se/server/api/core/bitstreams/ad9b523e-f6d5-4dc2-b632-64f9734484cf/content
1•matt_d•1h ago•0 comments

What do you do when your to-do list gets out of hand?

https://www.taskloco.com/
2•taskloco_nyc•1h ago•1 comments

I built my DREAM New York City apartment from SCRATCH in 93 days [video]

https://www.youtube.com/watch?v=9hL4V3KFTKQ
1•tekacs•1h ago•0 comments

The Task Is Not the Unit of Work

https://sekoudoumbouya.com/blog/the-task-is-not-the-unit-of-work/
1•fakoli•1h ago•0 comments

Why the world is ordering buildings from China [video]

https://www.youtube.com/watch?v=qGqYaULHPV4
1•thelastgallon•1h ago•0 comments

Forward Deployed

https://andys.blog/forward-deployed/
1•andytratt•1h ago•0 comments

Why are US consumers so angry? It's not just high prices

https://www.theguardian.com/us-news/ng-interactive/2026/jun/04/us-consumer-rage-prices-economy
38•dilawar•1h ago•22 comments

Supernormal Stimulus

https://en.wikipedia.org/wiki/Supernormal_stimulus
1•thunderbong•1h ago•0 comments