[~ot] why is programming so fun?

Bruce Adams tortoise_74 at yeah.who.co.uk
Mon Jun 2 14:35:24 PDT 2008


On Mon, 02 Jun 2008 05:23:42 +0100, Me Here <p9e883002 at sneakemail.com>  
wrote:

> Gregor Richards wrote:
>
>> BCS wrote:
>> > Reply to Clay,
>> >
>> > > BCS wrote:
> ...
>>
>> Now, write a program to modify code randomly and select based on a  
>> fitness
>> function, and feed it with 100 of this program you just wrote, and  
>> you've got
>> a genetic algorithm! Give it a few generations, and it'll do something  
>> useful.
>>
>> :P
>>
>>  - Gregor Richards
>
> Circa. 1980. Doing some work for my college professor on a  
> 'fully-configured'
> (48K) Apple ][ (kept locked in a cupboard because it ws so expensive!),  
> the
> proffesor came up with the idea that as all 6502 op-codes were 8-bit and  
> there
> were very few adressing modes, filling the (then massive) 48K with legal,
> randomly generated machine code and jumping to the start address, it  
> shouldn't
> take long to recreate VisiCalc, or something more remarkable.
>
> The program to generate the prgrams tooks less than 4k. It took some  
> effort to
> cause the trapping address to be saved to floppy disk, but we did that.  
> Then
> the next generation could reload the non-trapping code from floppy,  
> append new
> random code to the end, and iterate. That program ran for an entire 8  
> week
> period over summer holidays. Our main fear was that the cleaner we had  
> arranged
> to swap the second (data) floppy on a (week) daily basis would forget,  
> and we
> would miss an amazing program.
>
> The result: After 8 weeks and 40 floppys, we failed to create a single  
> program
> that ran for more than 2k of machine code before trapping.
>
> A few years later when I related the story to a friend (autodiadactic  
> genius),
> he compared the scenario to switching a TV to a untuned channel and  
> watching
> the patterns created by the white noise. He suggested that if, in the  
> course of
> my life time, I ever saw a picture of something recognisable, form, that  
> was
> the equivalent of our "remarkable program".
>
> He calculated the odds using an HP-41C. and then attempted to write the  
> number
> on a piece of A4 paper. He started out using fairly standard sized  
> handwritten
> zeros, but ended up with tiny, almost dot-sized ones. Needless to say.  
> it was a
> very large number. He then tried to describe the time it would take for  
> the
> energy contained in the solar system to decay to zero...I didn't  
> understand.
>
> b.

Genetic Algorithms are substantially and subtle more than simply a random  
generate and test.
With random generation you have nothing to compare with only your blind  
fitness function.
In a population you can compare individuals. The other main key ingredient  
is an efficient
crossover operator. i.e. sexual reproduction. Without sex evolution is  
very slow.






More information about the Digitalmars-d mailing list