Slashdot Mirror


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.

5 of 438 comments (clear)

  1. 10 ... : GOTO 10 is a loop by Mneme · · Score: 5, Informative

    it manages to create a complicated maze with out the use of a loop, variables and without very complicate syntax

    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”.)

  2. Re:Without the use of a loop!? by Anonymous Coward · · Score: 5, Informative

    No shit, and it is not a labyrinth either. It is just randomly printing forward slashes and backlashes.

  3. Re:No loop? by Zero__Kelvin · · Score: 5, Informative

    "Everyone knows that : in BASIC starts a new line."

    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
  4. Re:Enterprise Java Version by narcc · · Score: 5, Informative

    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.

  5. Re:Without the use of a loop!? by Dan+East · · Score: 5, Informative

    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.