Lurker News
Preferably an elegant snippet rather than an entire (well engineered) codebase.

Comments (380) 116 threads

Show all comments

Showing thread 1 of 116

vatys14 replies#
For me it's a BASIC one-liner which generates mazes

  10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10
I found this specific one via slashdot[1], but something similar, which I've never managed to find/replicate, was used to generate mazes on the Atari 800 XL at my school when I was a kid.

[1] https://developers.slashdot.org/story/12/12/01/1847244/how-d...

Waterluvian#
Oh wow this is a cool loop closure. I wrote a CHIP 8 emulator to learn stuff and my main test rom was this program. I walked through the bytecode very slowly as I learned and debugged and repeatedly wondered how the heck the program was so tiny.
zmix#
This book is some nice addition to "Computer Culture".
barbs#
Was kinda hoping the maze on the left was procedurally generated.
nacs#
324 page book originating from 1 line of code! Amazing.
symplee1 reply#
What is the probability that it prints a completable[0] maze?

Expressed in terms of line width (w) and number of lines (n).
[0] Where there's a valid path from the first line to the last.

scrollaway1 reply#
1/2^n, I believe (where n is the number of lines after the first one, otherwise 1/2^n+1). So halved every time: 100% with 1 line, 50% with 2 lines, 25% with 3 lines, and so on. Width is irrelevant (you can do this in your head comparing w=1 n=2 to w=2 n=2 for example).

Edited for clarity and accuracy.

Const-me1 reply#
One line, not completable:

    /\/\/\/\
Also, I don't believe it doesn't depend on width. I think with constant height, the probability of completable one should increase with width, and become almost 1 for very large widths.

Continue this thread — 1 reply

zmix1 reply#
Wow! This is really cool. I just entered it quickly in a C64 emulator and it ran, creating a maze. Not sure, whether it would be a solvable one, but it is interesting to note, that the paths are really connected!
tasuki1 reply#
> the paths are really connected!

What do you mean by that?

zmix1 reply#
The paths make sense. I.e. you got uninterrupted lines, surrounded by walls, so it is a real maze and not just a lookalike or partial maze. Oh, and it's a-maze-ing! :-)

Continue this thread — 1 reply

codecritic4 replies#
No, it does not generate a maze. It generates a random sequence of \s and /s, that can trigger a maze being generated in a typical user's mind.

This is the art of illusion.

henkslaaf5 replies#
What is a maze? One could argue that if the user perceives a maze, then it produces a maze.
ljm#
Never expected to find myself on the path to enlightenment after reading a line of BASIC.
lmilcin5 replies#
Maze has a starting point and a goal. The goal must be reachable from the start.

Continue this thread — 5 replies

tenebrisalietum3 replies#
> One could argue that if the user perceives a X, then it produces a X.

This can be stretched to turn anything into anything else. For example, why can't this comment be a maze? In that case 10 REM; 20 END is my even shorter, more elegant maze program because I see a maze in it.
Some constraints that are typically implied when people say "computer generated mazes":
- They are solvable (have a start and end)
- OR they loop endlessly with no dead ends.
- Walls and spaces consume 1 element on the grid.
- No space on the grid is surrounded by all 4 NWSE walls.

Continue this thread — 3 replies

misterman0#
Jeopardy this: Only then can you realize, there is no maze.
rebuilder#
Is the user then not amazed?
zaarn1 reply#
A maze does not have to be solvable.
mojuba1 reply#
Everything is an illusion. \s and /s are just liquid crystal pixels on the screen, filtering some light. However it's easier to say that if something has a name and you can identify it, then it's probably that thing. I see a maze it means it's a maze :)
coldtea1 reply#
>I see a maze it means it's a maze :)

I'd suggest to not go bar-hopping in Thailand with that mindset...

Zhyl1 reply#
Nice to see a bit of casual transphobia on hackernews.
coldtea1 reply#
Nice to see confusing a joke reference to a regional fact (as to things that can seem X but be Y) with transphobia. Anybody told you that merely referencing trans women in Thailand is opposing them? Projecting much?
Zhyl1 reply#
I'm amazed that you're defending that comment.
coldtea1 reply#
Well, I am amazed that one can be so rude.

First, you come blazing with accusations of transphobia, because of a joking mention of Thailand's ladyboy scene, to challenge the parents' notion that everything is WYSIWYG. Do you even know me? Or you have a hobby of randomly assuming things about people you don't know?
Second, when I don't take that quietly, you add the above comment about having the gal to defend myself, going for the "This animal is extremely vicious. When attacked, it defends itself" angle...
Perhaps you can go even lower against some stranger on the internet, but you wont be getting any replies from me in this thread.

Continue this thread — 1 more reply

Continue this thread — 8 more replies