Page 1 of 1

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

Posted: Tue Dec 31, 2013 2:23 am
by jgerrie
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!

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

Posted: Tue Dec 31, 2013 1:26 pm
by tormod
jgerrie wrote: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 impressive :)

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

Posted: Thu Jan 02, 2014 3:18 pm
by jgerrie
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...