[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interesting one-line BASIC program
In <47ebc7eb$0$20462$afc38c87@news.optusnet.com.au> tonza wrote:
> On 2008-03-26 23:44:43 +1100, Jake Featherston
> <Jake_Featherston@comcast.net> said:
>
>> I came up with this in 1984 or '85. Its a lot of fun. Sometimes not
>> much happens, but occasionally you get some really peculiar and
>> unexpected results. Here it is:
>>
>> 10 A=INT(RND(1)*65535)+1:B=INT(RND(1)*256):POKE A,B:GOTO 10
>>
>> Just sit back and watch the chaos....
>
> And how is this program at all interesting?!
If you leave it running long enough it will eventually reproduce the
complete works of Shakespeare.
I saw a program once for the BBC micro which would fill its 32 KiB of
RAM with every possible combination of program. All it did was start
with the memory cleared and stepped through incrementing each address.
This was guaranteed to produce every single possible RAM-resident
program, including incredible new applications that no one had ever
dreamt of.
Unfortunately it would take quite some time for it to complete. A 32 KiB
memory has 2^19 or 524304 bits, which can hold 2^524304 different
programs. It would take much longer than the current age of the universe
just to do every combination for the first 10 bytes. That doesn't take
into consideration the fact that each possible program has to be tested
by someone to see if it does something interesting.
--
Roger Johnstone, Invercargill, New Zealand -> http://roger.geek.nz