BASIC CHR 205.5
From Maze
(Difference between revisions)
(Updated with shorter version of the program, note that you can use bare "GOTO" or "RUN") | |||
| Line 5: | Line 5: | ||
== How long is this program? == | == How long is this program? == | ||
| − | Forty characters, as written above. | + | Thirty-nine characters, as written above. |
| − | The C64 supports abbreviations for keywords -- "?" for "PRINT" and generally unshifted first letter shifted second letter for other keywords. It seems that you also don't have to use spaces in a BASIC program pretty much anywhere. | + | The C64 supports abbreviations for keywords -- "?" for "PRINT" and generally unshifted first letter shifted second letter for other keywords. You also don't have to use spaces in a C64 BASIC program unless you want to print a space. And, any line number, including 1, is as good as 10. |
| + | |||
| + | So if you type this on a C64, you'll input the program using only 22 keystrokes (plus the return that you need at the end): | ||
| − | So if you type this on a C64, you'll input the program using only 22 | + | <code>1?cH(205.5+rN(1));:gO1</code> |
| − | keystrokes (plus the return that you need at the end): | ||
| − | |||
| − | 1?cH(205.5+rN(1));:gO1 | ||
(Note that "c" will appear as the uppercase letter "C" and "H" will appear as a |-like symbol. "N" will appear as /-like symbol that is output by the program.) | (Note that "c" will appear as the uppercase letter "C" and "H" will appear as a |-like symbol. "N" will appear as /-like symbol that is output by the program.) | ||
| Line 18: | Line 17: | ||
If you list this, the representation that is produced is 32 characters long: | If you list this, the representation that is produced is 32 characters long: | ||
| − | 1 PRINTCHR$(205.5+RND(1));:GOTO1 | + | <code>1 PRINTCHR$(205.5+RND(1));:GOTO1</code> |
| + | |||
| + | <b>Update, 17 July 2011:</b> Actually it is possible to trim the compressed version by one character (21 characters long): | ||
| + | |||
| + | <code>0?cH(205.5+rN(1));:gO</code> | ||
| + | |||
| + | Since "GOTO" by itself will jump to line 0. Also, "RUN" can be used instead of "GOTO," so that the expanded listing is a mere 30 characters long: | ||
| + | |||
| + | <code>1 PRINTCHR$(205.5+RND(1));:RUN</code> | ||
| + | |||
| + | RUN is [http://www.lemon64.com/forum/viewtopic.php?t=34879&sid=9526087188346ea3450fe0568566466b reported online] to be slower than GOTO, which makes sense as there should be some overhead to RNU and not just an unconditional jump. | ||
== Runs on the Commodore PET == | == Runs on the Commodore PET == | ||
