10 PRINT CHR$(205.5+RND(1)); : GOTO 10
A famous Commodore 64 one-liner. Academic books have been written inspired by this wee program. Now we have a Dragon/Coco/MC-10 version of this programming "great"! Take that Commodore 64!
10 PRINT CHR$(205.5+RND(1));: GOTO 10
- jgerrie
- Posts: 146
- Joined: Thu Jun 28, 2012 3:01 pm
- Location: Cape Breton, Nova Scotia, Canada
- Contact:
10 PRINT CHR$(205.5+RND(1));: GOTO 10
- Attachments
-
GREAT.CAS
- (682 Bytes) Downloaded 247 times
Re: 10 PRINT CHR$(205.5+RND(1));: GOTO 10
I think it should be RND(0) since RND(1) always returns 1. Anyway, the one-liner in the CAS file is much more impressivejgerrie wrote:10 PRINT CHR$(205.5+RND(1)); : GOTO 10
![Smile :)](./images/smilies/icon_e_smile.gif)
- jgerrie
- Posts: 146
- Joined: Thu Jun 28, 2012 3:01 pm
- Location: Cape Breton, Nova Scotia, Canada
- Contact:
Re: 10 PRINT CHR$(205.5+RND(1));: GOTO 10
That snippet of code is from the Commodore 64. I'm not sure, but I think in that variation of Basic, 1 returns a decimal. It's a famous one-liner for that machine, which my program now impliments in Color Basic. Unlike Color Basic, I don't think Commodore Basic's RND function can return whole numbers as an option. You can only use 1 and it always returns a random fraction between 0 and 1. This was common in some variations of Microsoft Basic, hence the ubiquitous N=INT(RND(1)*10)+1 to just get a number between 1 and 10. Color Basic's N=RND(10) is so much more straight forward...