My Favorite BASIC One-Liner

A new book called 10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10 was discussed on HackerNews. The title of the book is a one-line BASIC statement for the Commodore 64 computer that will generate a continuously scrolling maze on the display.

You’ll find the the PDF version of the book at this site: http://10print.org

This reminded me of a little one-line BASIC program that I wrote that I used to quickly type in and run on just about every TRS-80 I saw sitting at a READY> prompt:

10 PRINT CHR$(RND(255));:GOTO 10

I doubt that it’s terribly original, but I found it to be a fun bit of code to run. I’d usually look over at the computer in Radio Shack and would see the display catching people’s attention including the sales staff.

Aside from the varying cursor-positions and the block-graphics characters, there were two control-codes that could be used in a PRINT statement that would change the display from 64 characters per line to 32 characters per line and vice versa.  When those codes are randomly encountered in the program above, the effect is jarring enough to really catch my attention.

 

Advertisements

About Jim Lawless

I've been programming computers for about 36 years ... 30 of that professionally. I've been a teacher, I've worked as a consultant, and have written articles here and there for publications like Dr. Dobbs Journal, The C/C++ Users Journal, Nuts and Volts, and others.
This entry was posted in Programming and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s