frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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.

When can the C++ compiler devirtualize a call?

https://quuxplusone.github.io/blog/2021/02/15/devirtualization/
1•lionkor•55s ago•0 comments

Fast16 Sabotage Tool Was Built to Subvert Nuclear Weapons Simulations

https://www.security.com/threat-intelligence/fast16-nuclear-sabotage
1•ledoge•1m ago•0 comments

Writing Z80 assembly, 4 decades later:-)

https://github.com/ttsiodras/3D-on-a-ZX-Spectrum-48K/
1•ttsiodras•3m ago•0 comments

MegaTrain Full Precision Training of 100B+ Parameter LLMs on a Single GPU

https://github.com/DLYuanGod/MegaTrain
1•adulau•6m ago•0 comments

WHO declares Ebola outbreak in DR Congo a global health emergency

https://www.bbc.co.uk/news/articles/c2l2p0wwzzdo
1•lifeisstillgood•6m ago•0 comments

Ra

https://qntm.org/ra
2•sim04ful•18m ago•0 comments

How to Tell If You're Living in a Binary Crisis

https://www.honest-broker.com/p/how-to-tell-if-youre-living-in-a-8ee
1•Khaine•22m ago•0 comments

Strait of Hormuz submarine cable

https://www.cnn.com/2026/05/17/middleeast/iran-hormuz-undersea-cables-intl
1•reconnecting•23m ago•0 comments

Towards local plug-and-play AI

https://adlrocha.substack.com/p/adlrocha-towards-local-plug-and-play
1•adlrocha•29m ago•0 comments

Why are there squares everywhere in statistics?

https://statmodeling.stat.columbia.edu/2026/05/16/why-are-there-squares-everywhere-in-statistics-...
1•Tomte•33m ago•0 comments

Show HN: Extendable API Gateway Written in Go

2•starwalkn•33m ago•1 comments

Std: Is_heap Could Be Faster

https://quuxplusone.github.io/blog/2026/05/11/is-heap/
1•signa11•34m ago•0 comments

Trump's More Than 3,700 Trades Astonish Wall Street Insiders

https://www.bloomberg.com/news/articles/2026-05-14/trump-bought-nvidia-boeing-microsoft-in-flurry...
2•_tk_•34m ago•0 comments

Unit Testing's Eval Twin

https://volary.ai/articles/unit-testings-eval-twin
2•CamouflagedKiwi•41m ago•0 comments

Show HN: Onami Radio, a simple radio app for iOS

https://marigov.github.io/onami/
3•marigov•43m ago•0 comments

BT.1886 Shorthand Is a Trap

https://daejeonchronicles.com/2026/05/07/bt-1886-shorthand-is-a-trap/
1•Prasadnarava•44m ago•0 comments

Judge Says Krafton Must Rehire Fired 'Subnautica' CEO

https://www.bloomberg.com/news/articles/2026-03-16/judge-says-krafton-must-rehire-fired-subnautic...
1•_tk_•50m ago•0 comments

Softmax in front of CrossEntropyLoss: 16 other bugs PyTorch won't catch

https://gaox.substack.com/p/how-a-road-network-library-helped
1•neurarch•51m ago•0 comments

A Basic Interpreter in Markdown, Running "Natively" in Claude Code

https://dunkels.com/adam/llm-basic-interpreter-markdown/
1•adunk•56m ago•0 comments

Playing Atari ST Music on the Amiga with Zero CPU

https://arnaud-carre.github.io/2026-05-15-ym-fast-emu/
10•z303•59m ago•0 comments

Patrick Collison – Detroit Impressions

https://twitter.com/patrickc/status/2055733308877881807
1•rmason•1h ago•1 comments

UWB Mobile Suica isn't just walk-through gates, it's payments too

https://atadistance.net/2026/05/13/uwb-mobile-suica-isnt-just-walkthrough-gates-its-payments-too/
1•ksec•1h ago•0 comments

ConnectAI – LinkedIn DM Generator

https://chromewebstore.google.com/detail/connectai-—-linkedin-dm-g/cjfnhjpheldgcfmipcmibbmlfmpf...
1•sujalmeena•1h ago•2 comments

Contrast-Proofing Colors with CSS

https://dan-webnotes.com/posts/2026-05-16-contrast-proofing-colors/
1•dandep•1h ago•0 comments

Ten Signs of Fascism. America has all of them

https://rutgerbregman.substack.com/p/10-signs-of-fascism-america-has-all
34•fredski42•1h ago•10 comments

What the FDA won't tell you about your medications (transcript, Propublica)

https://www.propublica.org/podcast/what-fda-wont-tell-you-generic-drugs-safety
1•abawany•1h ago•0 comments

I built a fake Phantom wallet generator

https://larpwallet.app
1•Jhoney•1h ago•2 comments

Neptune: Direct3D Virtualization for QEMU

https://blog.getutm.app/2026/introducing-neptune-direct3d-virtualization-for-qemu/
2•oofdere•1h ago•0 comments

From raw logs to programmable EVM execution intelligence

https://blog.bridgexapi.io/the-anatomy-of-programmable-evm-execution-intelligence
1•Bridgexapi•1h ago•0 comments

kharp – k version 3 Language Interpreter in C#

https://github.com/ERufian/ksharp
1•tosh•1h ago•0 comments