Join 3,416 readers in helping fund MetaFilter (Hide)


LOLHEHHEHHELLLOOOOO, WORLD
November 29, 2012 10:20 AM   Subscribe

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (a collaborative book by Nick Montfort, Patsy Baudoin, John Bell, Ian Bogost (previously, previously, previously), Jeremy Douglass, Mark C. Marino, Michael Mateas (of Facade), Casey Reas, Mark Sample and Noah Vawter) uses a single line of code as a basis for pontificating on creative computing and the impact of software in popular culture. 10 PRINT's content is available as a PDF (50 MB). Pictures via Casey Reas' Flickr.
posted by mrgrimm (47 comments total) 37 users marked this as a favorite

 
This makes me want to hunt a wumpus.
posted by Egg Shen at 10:22 AM on November 29, 2012 [6 favorites]


Oh, man, I've had this book on my wishlist since I found out about it. Knowing that Bogost is on it, I really, really hope it is closer to Racing the Beam than Twisty Little Passages (although apparently my distaste for Passages may be somewhat unwarranted.)

There was also some conversation about Montfort and Bogost in this recent thread as well.
posted by griphus at 10:25 AM on November 29, 2012


This looks really neat, as does the PlayPower.org they are donating profits to.
posted by DU at 10:32 AM on November 29, 2012


as does the PlayPower.org they are donating profits to

It did until I tried to "Join" and got the message: "This Ning Network is currently disabled due to an overdue balance." [sad panda face]
posted by mrgrimm at 10:38 AM on November 29, 2012


This makes me want to hunt a wumpus.

I have bad news for you...
posted by thewumpusisdead at 11:18 AM on November 29, 2012 [8 favorites]


Egg Shen: it happens I've been working on it.
posted by wobh at 11:24 AM on November 29, 2012 [3 favorites]


Knowing that Bogost is on it, I really, really hope it is closer to Racing the Beam than Twisty Little Passages

Bogost also has a great (imo) post this week on Gamasutra:

"If earlier Nintendo systems made video games safe for homes and families, the Wii U turns the tables: it attempts to make the current trends in the internet and consumer electronics safe for video games. It's the first earnest, sustained, hardware-invested example of such an effort, and it's full of risk and danger.

"Wii Can't Go On, Wii'll Go On"
posted by mrgrimm at 11:29 AM on November 29, 2012


it happens I've been working on it.

I was gonna be all "pfff, wumpus already exists in the bsdgames package", but I clicked through and saw you are doing it in Common Lisp. I need to get back on my CL learning mission and classic games like this might be another good in. (Previous in was working Project Euler, but those get hard and anyway only exercise certain parts of coding.)

And the entire CL thing neatly fits in with creative coding and teaching kids.
posted by DU at 11:40 AM on November 29, 2012


10 PRINT CHR$(205.5+RND(1)); : GOTO 10

I've been programming in Delphi for so long that I immediately thought that it needed an trunc() before the 205.5 to avoid a type mismatch error. We could get away with so much in Commodore Basic.
posted by crapmatic at 11:50 AM on November 29, 2012 [1 favorite]


Egg Shen: it happens I've been working on it.

And if you would rather be the wumpus I worked on that awhile ago.
posted by smcameron at 11:53 AM on November 29, 2012 [2 favorites]


I got my copy yesterday—it really is a beautiful book.
posted by aparrish at 12:27 PM on November 29, 2012


I think I've mentioned this before, but Nick Montfort also took 4th place in the recent World Palindrome Championships with his long palindrome "The Millenium Falcon," which was incorporated into the video Star Wars: Raw Rats.
posted by msalt at 12:45 PM on November 29, 2012 [1 favorite]


We could get away with so much in Commodore Basic.

Well, in Commodore BASIC, all numbers are converted into floating point before operation and converted back, if needed, afterwards, a boneheaded design decision that was probably done to save ROM space, but slows down math and actually makes integer operations slower than floating point. You can lay the blame for that at the feet of Microsoft.

It occurs to me, I'm probably the one in this thread who can explain this program the best, having spent serious time with Commodore BASIC in the past and even selling programs written in it, with some assembly thrown in, to a magazine back in the day. So:

CHR$ is a conversion function that returns a character in PETASCII. It rounds off to the nearest integer if the value passed to it isn't integral. 205 is the code for a large, graphic forward slash: /, and 206 is the code for a large, graphic backslash: \. RND(1) by itself returns a random number from 0 to 1, so the result is effectively 50% one slash and 50% the other. The semicolon at the end of the statement signals that the interpreter isn't to output a return at the end of the statement, so the next character printed will immediately follow the previous one, causing the characters will continue on the same line, spilling off into the next line when they reach the end, and so on down the screen as each line fills up. Of course, GOTO 10 repeats the statement until RUN STOP is pressed.

The magic to the program, in my opinion, lies in the slash graphics, which are extremely useful; those two were my favorite characters in the whole set back when I did C64 stuff, with the possible exception of reversed space (a solid block. CHR$(160)).
posted by JHarris at 1:26 PM on November 29, 2012 [4 favorites]


I've been waiting for this book for months, it looks amazing. I really want a physical copy of it, although it's wonderful of them to release it as a free PDF.
posted by oulipian at 1:29 PM on November 29, 2012


It's worth noting that Commodore 64 BASIC was incredibly limited by itself, one of the barest implementations of the language in the 8-bit era. It offered access to none of the machine's special features: little in the way of character graphics, no custom graphics, no sprites, no hi-res mode, no multicolor mode, no sound, no controller access, nothing! To do all that stuff, you had to use POKE to shove raw values into memory addresses, making a memory map an indispensable tool to have when working on the machine, and once you picked up some facility with machine code, SYS. Notice I didn't say assembly. If you knew the opcode values, you could code by just looking up the values and POKEing them into a free block of memory. Go ahead, ask me how I know LDA# is 141 and STA# is 169.

Stuff like that caused my Programmer's Reference Guide to wear slap out over the years. Fortunately, you can download PDFs of it here.
posted by JHarris at 1:33 PM on November 29, 2012 [4 favorites]


I really, really hope it is closer to Racing the Beam than Twisty Little Passages

It was my impression that Twisty Little Passages was Nick Montfort's PhD dissertation, with all the usual limitations of a published dissertation. The main point of one, in the humanities at least, is to demonstrate to the professors on your committee that you can do original research, are comfortable with a wide range of scholarly work in your field, and don't step on anyone's toes. It usually makes for a boring book full of quibbling footnotes and attempts to link your work to vague pronouncements by theorists. TLP would have been far better without the chapters trying to argue that Interactive Fiction descends from the literary genre of the Riddle, but if he had left that out, Montfort would have written a great history of IF and an introduction to the ideas of its "local experts" like Graham Nelson & Emily Short ... but which wouldn't have demonstrated he deserved a PhD. Once you get away from grad-student work you can start to write the really good stuff without trying to suck up to cranky older academics for approval.
posted by Harvey Kilobit at 1:45 PM on November 29, 2012 [1 favorite]


Yeah that is exactly what someone else told me re: the Riddle section (which I could not for the life of me make it through.) When does it get not-dissertation-y?
posted by griphus at 1:48 PM on November 29, 2012


Go to p. 74 -- chapter 3 "Adventure and its Ancestors", the section headed "Dungeons & Dragons." Although it never gets totally non-dissertation-y even after that point; you'll just have to spot where he's going off into theoretical stuff (e.g. the I Ching) and skip ahead.

This is a reading habit I've had to pick up after running across too many first books by academics with the same faults. There was one really good book on Celtic pop music that was best read by skipping all the even-numbered chapters!
posted by Harvey Kilobit at 2:05 PM on November 29, 2012


The MetaFilter effect seems to have brought down MIT's web server...I guess I'll wait for a day or two for them to recover.
posted by dylanjames at 2:23 PM on November 29, 2012


The MetaFilter effect seems to have brought down MIT's web server

I was a little worried about that. Maybe should have put the PDF inside ... oh well. They will survive.
posted by mrgrimm at 2:51 PM on November 29, 2012


the impact of software in popular culture

That's when I reach for my PDP-11
posted by thelonius at 3:04 PM on November 29, 2012 [2 favorites]


The MetaFilter effect seems to have brought down MIT's web server...

For a post from the Digital Media department at the nation's best technology school. Quake before our might!
posted by msalt at 6:27 PM on November 29, 2012


JHarris, thanks for the explanation. Question from a non-programmer: why 205.5 and not 205? Does CHR always round down?
posted by Pfardentrott at 7:27 PM on November 29, 2012


Because I had remembered wrong -- obviously, the source code is written because Commodore BASIC truncates values instead of rounds. It has been nearly 20 years since I wrote anything in the language. My bad.
posted by JHarris at 7:49 PM on November 29, 2012


@Pfardentrott Since RND(1) output ranges from 0 to 1, half of the time adding to 205.5 produces a value over 206. 205+RND(1) would almost never sum to 206.

CHR$ expects an integer, so it truncates a float (throws away what's after the decimal point) - effectively rounding down, yeah. Just for fun here's a list of C64 code 'commands'.

The TRS-80 had cute graphics built-in that could be manipulated for fun too.
posted by Twang at 7:51 PM on November 29, 2012


Makes sense, thanks!
posted by Pfardentrott at 7:53 PM on November 29, 2012


Does RND() not include the upper limit? Because it seems like 205.5 + 1 would round up to 207, otherwise.
posted by msalt at 7:56 PM on November 29, 2012


@msalt RND did include both limits [0.0 ... 1.0], yeh. While rounding up from 206.5 was optional (option to be coded), CHR$ always (in effect, by truncation) rounds down. CHR$(206.99999)... would still be 206.
posted by Twang at 8:05 PM on November 29, 2012 [1 favorite]


(defun slashes (stream)
  (write (elt '(#\/ #\\) (random 2)) :stream stream :escape Nil)
  (slashes stream))

posted by wobh at 8:32 PM on November 29, 2012 [1 favorite]


I gave up waiting for MIT to recover from the MetaFilter effect, and found a working link for the PDF over at http://10print.org. Here it is. Since I love a beautiful book, I'll probably be asking for a copy this Christmas, too.
posted by dylanjames at 8:37 PM on November 29, 2012


Thirty years ago, I had memorized a single line of BASIC code that would, on a C64, print a reverse-character circle (a big dot inside a reverse-color solid block), move the cursor and the circle in a random direction leaving behind a reverse-space block, then repeat. It resulted in a drunk-walking circle that would slowly draw a sort of maze-like cavern on the screen.

I don't have a clue now how exactly it worked, but remember it was barely short of 40 characters, the limit for a C64 line. I remember a sales person eagerly asking me how I'd done that to a display computer, showing him, and watching his eyes glaze over with disappointment that it was apparently too arcane for him to understand or remember.
posted by straight at 9:30 PM on November 29, 2012 [1 favorite]


Apparently, Metafilter is NOT powerful enough to overwhelm MIT's servers:

(The link provided is a temporary one; A power outage in much of Cambridge, MA, including all of MIT, just cut network service to my server. —Nick, 29 November 2012)
posted by msalt at 10:30 PM on November 29, 2012


There are several tricks to squeezing a lot of stuff onto a single line in a Commodore BASIC program.

First, the maximum line size is 80 characters, not 40. Its screen editor uses a system of virtual line links to keep track of which logical lines extend over two physical lines, which is tracked internally. (If you enter a character on the 40th line using its screen editor, it'll shift the rest of the screen one line down.)

Second, there exist shortcuts for most of the commands you can enter. PRINT's shortcut is ?, but most of the others are the first letter followed by the second letter Shifted. (In a few cases where there are duplicate shortcuts, one of them needs to have two letters entered and the third Shifted.) The result, when the line is listed, is that the commands will be expanded. In this way it's possible to enter lines longer than 80 characters, so long as the version with the shortcuts will fit.

The utmost technique, which is not something I've ever done myself and am a bit fuzzy on, is hacking together your own lines with POKEs and such. I seem to remember that the ultimate internal line length is 252 characters (minus four bytes at the start: I think it's two to hold the line number, and two to hold a pointer to the next line). Not only is 252 characters a lot, but internally BASIC commands are tokenized and stored in a single byte. 252 characters plus extras for commands can add up to a lot of characters when listed out.
posted by JHarris at 10:30 PM on November 29, 2012 [1 favorite]


Amazing. It's like a standard Microsoft BASIC (252-character line limits, tokenized keywords, ? for PRINT) suffering a case of congenital brain damage when it was hacked into the C64.
posted by Harvey Kilobit at 10:48 PM on November 29, 2012 [1 favorite]


Hmm. straight, this is not exactly what you describe, and it's two lines not one, but it's similar. It's been a long time since I programmed a C64, and I'm not experienced with VICE so I can't seem to get it to make a reverse character, but if percent-signs are okay:

10 DIMA$(4):A$(0)="[CRSR-UP]":A$(1)="[CRSR-RIGHT]":A$(2)="[CRSR-DOWN]":A$(3)="[CRSR-LEFT]"
20 PRINT"%[CRSR-LEFT]"A$(RND(1)*4);:GOTO20

I don't remember a way to loop internally, infinitely, on a single line. Can probably be done with FOR/NEXT though. Maybe this will be enough to jog your memory towards remembering your one-line solution?
posted by JHarris at 10:51 PM on November 29, 2012


Microsoft wrote Commodore BASIC, which explains the similarities Harvey Kilobit.
posted by JHarris at 10:53 PM on November 29, 2012


11 palindrome checking programs with code that is itself palindromic
posted by msalt at 10:58 PM on November 29, 2012 [3 favorites]


JHarris, I seem to remember that it somehow listed the four cursor directions in a single string and then randomly picked a character out of that string to print. Is that possible?
posted by straight at 11:20 PM on November 29, 2012


I just thought of that solution myself (it HAS been awhile). That would mean you could get away without having to DIM an array. The relevant function, I seem to remember, is SUBSTR$.
posted by JHarris at 11:43 PM on November 29, 2012


Ah, here is a corrected program:
10 PRINTCHR$(18)"[SPACE][CRSR-LEFT]"MID$("[CRSR-UP][CRSR-RIGHT][CRSR-DOWN][CRSR-LEFT]",(RND(1)*4)+1,1)"[SHIFT-Q][CRSR-LEFT]";:GOTO10

This should be pretty much as you describe. There's still a good 20 characters left on the line; we could maybe get fancy with it. The only reason I use CHR$(18) instead of a reverse video code is I'm having difficulty entering one in VICE.
posted by JHarris at 1:08 AM on November 30, 2012 [1 favorite]


(The function to use, it turns out, is MID$. Not sure where I got SUBSTR$ from.)
posted by JHarris at 4:15 AM on November 30, 2012


Transactor Volume 8 Issue 6 features an article on cellular automata and a lisp for the c64.
posted by wobh at 8:49 AM on November 30, 2012


I'm slowly working through the PDF as I find a few minutes here and there. I'm halfway through it and I realize that, while the discussion is deep and indicates a thorough knowledge of the C-64, they've been referring to it as a 6502.
Of course, the 6510 is basically a 6502 with an I/O port, but still...

Go ahead, ask me how I know LDA# is 141 and STA# is 169.
You mean LDA# is 169 and STA# is 141...
but I used Butterfield's assembler, so to me, it's A9 and 8D.
posted by MtDewd at 5:41 PM on November 30, 2012


Aaah, well I got the numbers right, just swapped them around. Some of us didn't have the benefit of using an assembler back then. And I do try to call it a 6510 when I can.
posted by JHarris at 6:16 PM on November 30, 2012


The Butterfield thing wasn't really an assembler- I think it was called a monitor. (I think the whole thing showed up intact in the C-128-> type in MONITOR)
You still had to figure out branch counts and absolute jumps, but you could enter it all in hex and set break points, display memory chunks in hex, display the registers, etc. Quite useful. Did you do assembly language programming using POKEs? That's dedication.
posted by MtDewd at 6:31 PM on November 30, 2012


I actually interviewed Jim Butterfield once for Loadstar, in a chat in the even-then dusty and abandoned halls of the C64 forum on Compuserve. The piece never made it to the magazine and it seems I've lost my copy, alas, which filled me with sadness when Butterfield passed on.

Yep I used POKEs. It's really not that bad, once you get most of the opcodes memorized it goes faster, and it serves to keep you cognizant of the hardware; even today, although you have compilers and libraries and object and stuff between you and the metal, everything you do on the machine is still, to some extent, a linear series of opcodes decoded by a processing unit. (Well, frequently multiple units now, and with co-processors and graphics cards and....) Eventually I used a program from Loadstar called The Fast Assembler, which let me work with a little more facility. Most of my old Loadstar games were done mostly in BASIC with some machine code in the tight spots. You don't really have a lot of space to work with on a C64, but you can do a lot with a little space. The cassette buffer, if you don't use tape, was a great place to stash small routines. The best place, if you're unwilling to abandon the BASIC environment completely, was the 4K block of unused RAM starting at 49152 ($C000). You could do great things in that space, it seemed inexhaustible back then.

There was one game Loadstar published that was written entirely in a monitor, a kind of Gauntlet clone/inspired-by. This knowledge was passed to me when I was hacking new levels into it for a standalone release for it.
posted by JHarris at 6:44 PM on November 30, 2012


Slate has a generally laudatory review of the book.
posted by oulipian at 6:44 PM on November 30, 2012 [1 favorite]


« Older "I moderate jokes on a Kids Jokes website. A lot o...  |  In response to WWE.com posting... Newer »


This thread has been archived and is closed to new comments