85. VARIANTS OF 10 PRINT
While the specific line of code
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
is the focus of this book, and
has been treated as canonical, this program is not a simple
transcription of some authoritative version. The authors of this
book developed this variant of the program in an attempt to
represent many of the common features of a BASIC one-liner and to
embody aspects of the earliest two variants that we found. Variants
of this maze-generating code have appeared in print and other
contexts over the course of the Commodore 64’s
commercial lifetime and beyond. Some of these variants are
addressed in the chapters and remarks; others are listed only here.
The following variants of 10 PRINT
may differ in length, line numbering, and character codes used, but
they are all meant to produce the same output. These are all the
variants the authors are aware of as of May 2012, with full
bibliographic information for each known appearance of each of
them. (After this book first went to press, we learned of an earlier
printed variant in the 1981 book Personal Computing on the VIC 20.)
VARIANT 1982
10 PRINT "[CLR/HOME]" 20 PRINT CHR$(205.5 + RND(1)); 40 GOTO 20
Commodore, Inc. 1982. Commodore 64 User’s Guide. Wayne, PA and Indianapolis, IN: Commodore Business Machines. Distributed by Howard W. Sams & Co. p. 53.
VARIANT 1984
8 PRINT CHR$(205.5 + RND(8)); : GOTO 8
Krueger, Dan A. 1984. “Trick $93.” “Magic” section, RUN 7 (July): 13–14.
Montfort, Nick. 2008. “Obfuscated Code.” In Software Studies: A Lexicon, ed. Matthew Fuller. 193–199. Cambridge, MA: MIT Press.
Inacio da Silva, Cicero. 2008. “Software Arte,” slide 17. SlideShare. November 18. http://www.slideshare.net/cicerosilva/software-arte-presentation
Marino, Mark C. 2010. “The ppg256 Perl Primer: The Poetry of Techne culture.” Emerging Language Practices, no. 1 (Fall). http://epc.buffalo.edu/ezines/elp/issue-1/ppg256.php
VARIANT 2008B
10 ?"<CLEAR/HOME>" 20 ? CHR$(205.5)+RND(1)) 40 GOTO20
Lord Ronin. 2008. “In the Beginning Part 8.” Commodore Free Magazine, September. http://commodorecomputerclub.co.uk/view.php?art=commodore_free_23&loc=magazine
Entering and running this program as it appears above will cause it to terminate abnormally with the message “?TYPE MISMATCH ERROR IN 20.” The immediate culprit is the extra right parenthesis that appears after “205.5.” However, even if this superfluous character is removed, the program will not work as intended, because the semicolon that should appear at the end of line 20 is missing. The intention for this program to function like the others listed here is clear from the discussion in the surrounding article, however.
VARIANT 2010A
10 PRINT CHR$(109+RND(0)*2);:GOTO 10
Bogost, Ian. 2010. Comment on “Program Your Apple II! Why Not Program Today?” Computing Education Blog. February 20. http://computinged.wordpress.com/2010/02/20/program-yourapple-ii-why-not-program-today/
VARIANT 2010B
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
Montfort, Nick. 2010. “@party: Weaving thread.” Post Position. June 20. http://nickm.com/post/2010/06/party-weaving-thread/
Montfort, Nick, Patsy Baudoin, John Bell, Ian Bogost, Jeremy Douglass, Mary Flanagan, Mark Marino, Michael Mateas, Casey Reas, Warren Sack, Mark Sample, and Noah Vawter. 2010. “Studying Software by Porting and Reimplementation: A BASIC Case.” Presented by Nick Montfort, Jeremy Douglass, and Casey Reas. Critical Code Studies Conference, University of Southern California. July 23. http://thoughtmesh.net/publish/382.php
Driscoll, Kevin. 2010. “Critical Code Studies 2010.” Driscollwiki. July 23. http://kevindriscoll.org/wiki/Critical_code_studies_2010
Reas, Casey. 2010. 10 PRINT CHR$(205.5+RND(1)); : GOTO 10. Twitter. July 25. https://twitter.com/-!/REAS/status/19475597776
Montfort, Nick. 2010. “Colloquium Past, Conference to Come in Mexico.” Post Position. November 17. http://nickm.com/post/2010/11/colloquium-past-conference-to-come-in-mexico/
Montfort, Nick. 2011. “10 PRINT Talks Galore.” Post Position. January 26. http://nickm.com/post/2011/01/10-print-talks-galore/
Rettberg, Jill Walker. 2011. “10 PRINT CHR$(205.5+RND(1)); : GOTO 10.” Flickr, February 9. http://www.flickr.com/photos/lij/5431033237/
Kidd, David. 2011. Backstrip.net. April 8. http://backstrip.net/post/4432566244/ive-been-tooling-around-with-street-making
th0ma5w. 2011. “10 PRINT CHR$(205.5+RND(1)); : GOTO 10.” YouTube.
July 23. “As demonstrated by Casey Reas at the Eyeo Festival, June 2011, Minneapolis, Minnesota, a random maze generation program in one line of Commodore 64 Basic.” http://www.youtube.com/watch?v=m9joBLOZVEo
VARIANTS 2010C–F
1 printchr$(205.5+rnd(1));:goto1 1 ?chr$(205.5+rnd(1));:run 1?chr$(205.5+rnd(1));:rU 0?cH(205.5+rN(1));:gO
MuppetMan et al. 2010. “Maze Code” discussion thread, Commodore 64 (C64) Forum, Lemon64.com. August 12–16. http://www.lemon64.com/forum/viewtopic.php?t=34879&sid=9526087188346ea3450fe0568566466b
VARIANT 2010G
10 print chr$(205.5 + Rnd(1)); 20 goto 10
Smith, Adam. 2010. “the infamous c64 maze generator.” Flickr. October 6. http://www.flickr.com/photos/rndmcnlly/5058442151/
VARIANT 2011a
10 PRINT CHR$(205.5+RND(1)) GOTO 10
Fuchs, Martin. 2011. Written Images. Rendered February 9. Book number 182/230, page 161.
This is printed as the title of Casey Reas’s
contribution to this volume, seven pages of white, blue, and black
images generated with a Processing program that is inspired
by 10 PRINT
. The semicolon and
colon, which are necessary for the program’s
proper functioning and its validity as BASIC, were removed in error
during editing in this limited-edition book. This title is also
presented this way on page 1 of Written Images,
in the table of contents.
VARIANT 2011b
10 PRINT "(It indicates that here you press Shift and CLR/Home Keys" I found my 7 key has Home on it -)" note the " marks at start and end 20 PRINT CHR$(205.5+RND(1)) 30 PRINT GOTO 20
noknojon. 2011. Bleepingcomputer.com. February 17, 8:01 p.m. http://www.bleepingcomputer.com/forums/topic380106.html/pagep2138153#entry2138153
Entering and running this program as it appears above will cause it to terminate abnormally with the message “? SYNTAX ERROR IN 30.” Two changes need to be made for this code to function as intended: a semicolon should be added at the end of line 20 and “PRINT” should be removed from line 30.
In addition, this text indicates that one should hold SHIFT and then press the CLR/HOME key. This causes the screen to be cleared when the program is run and it moves printing of characters to the upper left. If CLR/ HOME is pressed without holding SHIFT, as the 1982 and 2008b variants seem to suggest one should do, the printing of characters will move to the upper left but the display will not be cleared, so the maze will move downward to cover whatever is already on the screen.