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.

America's debt binge is starting to matter

https://www.ft.com/content/8827baa7-163d-4122-9ea8-a2c9ff6e8a4d
1•samizdis•21s ago•1 comments

Show HN: Flying Letters and a Clean Keyboard That Even Steve Jobs Would Love

1•vitalipom•1m ago•0 comments

From safety research prompt to cross-model universal jailbreak

https://www.lesswrong.com/posts/hHk5CpiqZTBBiHmYt/from-safety-research-prompt-to-cross-model-univ...
1•gmays•5m ago•0 comments

Everything hackable will get hacked

https://vercel.com/blog/everything-hackable-will-get-hacked
1•tilt•8m ago•0 comments

Artificial Intelligence Policy UC Berkeley School of Law [pdf]

https://www.law.berkeley.edu/wp-content/uploads/2026/05/AI-Final-Policy-26.pdf
3•fallinditch•9m ago•0 comments

Turning Quick Notes into Long-Term AI Memory

https://barbarito.me/notes-workflow/
1•danbarbarito•10m ago•0 comments

MCP server for 340k SVG icons

https://github.com/LeulAria/Aria-Icons
1•leularia•20m ago•0 comments

Urban congestion relief experiments through routing-app interventions

https://www.nature.com/articles/s44284-026-00443-x
1•neehao•20m ago•0 comments

Tesla killing Solar Roof is leaving installers with six-figure losses

https://electrek.co/2026/09/01/tesla-solar-roof-exit-installers-losses/
20•voxadam•29m ago•3 comments

Selected GitHub Copilot models deprecated

https://github.blog/changelog/2026-08-31-selected-github-copilot-models-deprecated/
1•mooreds•30m ago•0 comments

My Mac Mini fits one model. I run five

https://placona.co.uk/my-mac-mini-fits-one-model/
4•makaimc•31m ago•0 comments

Replaceable but Employed: Automation and the Meaning of Work

https://www.nber.org/papers/w35559
3•mooreds•32m ago•0 comments

AI Cold Showers

https://allan.reyes.sh/posts/ai-cold-showers/
3•mooreds•32m ago•0 comments

US Military disabled ad tracking on troops' devices after targeted attacks

https://techcrunch.com/2026/09/04/us-military-disabled-ad-tracking-on-troops-devices-following-re...
6•jethronethro•33m ago•0 comments

Decoherence: A card game for two based on quantum physics

https://decoherance.vaguespac.es/
1•thebigship•36m ago•0 comments

Scaling Engineering: Ownership over Hiring

https://greenido.dev/2026/06/11/what-changes-at-20-50-and-200-engineers/
1•fagnerbrack•37m ago•0 comments

Free WhatsApp abandoned cart recovery for WooCommerce

https://wordpress.org/plugins/6rsh-messaging-notifications/
1•sixrsh•37m ago•0 comments

Botsitting: The Unpaid Labour Behind Every AI Productivity Claim

https://smarterarticles.co.uk/botsitting-the-unpaid-labour-behind-every-ai-productivity-claim
1•dxs•38m ago•0 comments

Code at the Speed of Understanding

https://dennisy.me/notes/code-at-the-speed-of-my-understanding
1•dennisy•40m ago•0 comments

Secret Collusion Among AI Agents

https://arxiv.org/abs/2402.07510
2•phaseonebig•41m ago•0 comments

Amy – high performance fixed-point music synthesizer library

https://github.com/shorepine/amy
1•anigbrowl•41m ago•0 comments

Show HN: Animating code snippets from first principles

1•rahulrav•42m ago•0 comments

Show HN: Expose - a self-hosted tunneling tool like ngrok/localtunnel(Golang)

https://github.com/kernelshard/expose
2•samiulsk•42m ago•0 comments

Alzheimer's treatment is advancing rapidly

https://www.vox.com/the-highlight/501710/alzheimers-disease-dementia-test-treatment-medication-in...
2•dabinat•43m ago•1 comments

The Foundations of Modern AI: Generalization, Data Selection, and Epiplexity

https://www.youtube.com/watch?v=lKoJJxjUfdw
1•E-Reverance•44m ago•0 comments

Ask HN: How do you know a prompt is "complex" for an AI model?

1•faryadz•44m ago•0 comments

CPAN Uploads Are Up 50% Year-over-Year

https://www.olafalders.com/2026/09/04/cpan-uploads-up-50-percent-year-over-year/
1•Amorymeltzer•45m ago•1 comments

Watch Los Angeles get built, one building at a time (1880–2026)

https://lax-skyline.parcelscope.net/
44•rustywasm•46m ago•11 comments

"Twenty years of brand building froze in time": How coding agents select tools

https://thenewstack.io/coding-agents-tool-choice/
2•theanonymousone•46m ago•0 comments

The Context Engine

https://productnow.ai/blogs/the-context-engine
1•kadhirvelm•46m ago•1 comments