How Does a Single Line of BASIC Make an Intricate Maze?
JameskPratt writes "This Slate article talks about a single line of code — 10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10 — and how it manages to create a complicated maze without the use of a loop, variables and without very complicated syntax." Now that amazing snippet of code is the basis of a book, and the book is freely downloadable.
It's very cool the way this code draws a maze, but there's obviously a loop there.
(And it's “without” not “with out”, and “complicated” not “complicate”.)
That's exactly what I thought... Maybe JameskPratt isn't a very good programmer.
"I don't know, therefore Aliens" Wafflebox1
No shit, and it is not a labyrinth either. It is just randomly printing forward slashes and backlashes.
It's just randomly printing forward and backward slashes, which line up because of the font. It's nifty, but hardly amazing.
And in fact, it appears Slashdot ran an article on this a decade ago when it was called DataGlyphs.
Nobody knows that, because it is untrue. The : is a statement separator, not a line seperator. That 10 you see is the line number. Notice that there are no other line numbers. Make an error on either side of the colon and the interpreter will give you the exact same complaint: Syntax error in line 10. You can verify this by looking for the line " In BASIC it's used as a separator between the statements or instructions in a single line." on Wikipedia, or use your Google-Fu to verify it thousands of other ways.
Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
main() { ten: printf("%c", (rand()%2)?47:92); goto ten; }
The preprocessor include directive is on a separate line, but that's really not part of the program.
Plagiarizer. You stole this from reddit -- from the same post linked from Nick Montfort's blog.
Enterprise Java Version:
http://www.reddit.com/r/programming/comments/142jix/10_print_chr_2055_rnd_1_goto_10_how_a_single_line/c79elxn
You shouldn't take credit for the work of others. That +5 funny is a filthy dirty lie.
Required reading for internet skeptics
And finally, here's a screenshot in case anyone actually cares what the TI version looks like.
http://dexsoft.com/slashdot/ti_screenshot.png
Better known as 318230.