Let's Make Robots!

Darwin is a hacker


How many monkeys on type writers does it take to write the collected works of Shakespeare? Or Asimov for that matter? It has been claimed, but never tested, that a limited amount of monkeys will indeed produce such a work.

Given enough time...

I think I can emulate a finite amount of monkeys hitting random keys. I just did so. It's a perl program of about 300 lines that produces Picaxe Basic. Or rather, it produces absolute nonsense, and then feeds it to the picaxe compiler for a quick syntax check.

Every bit of gibberish that makes it through the test is relabelled as "viable" picaxe code. It is stored somewhere safe for future retrieval. And this is where my monkeys get a bit smarter. They copy pieces of existing picaxe code. The better the code, the more likely they are to reuse it. And add to it. Or delete parts from it. Or paste it into their own. But most of all, they will combine it with other pieces of existing code. And thus produce new code to be tested by the compiler.

Now, admittedly, I am a cheater. I gave my army of idiot programmers a few snippets of code. The very minimum lines like "b0=0" and "pause 1". And it shows. These snippets are reappearing all over the place. In about an hour, my collection of viable programs has grown from 5 to 500. One combination for example now reads "pause b0".

This is not enough to me. I want a real picaxe to start using this code. And I want some way of telling the monkeys which pieces did something really cool while uploaded to the micro controller. I am still without such a feedback system. It could be all kinds of stuff, but most of all, it needs to be dead simple. The feedback system is taking shape.

And it need to be something visible, so I can broadcast the experiments on live internet TV.

So, my monkeys.... What kind of ideas will you copy and paste together for this cool experiment?



# 201005121529 rik (1069) letsmakerobots.com
# artificial evolution of micro controller code
#  Picaxe Basic in my case
#  Warning: this code is highly experimental - might just be mental

# 201005121611 let's introduce point mutations
# 201005121611 let's introduce rudimentary evaluation functions
# 201005121809 let's introduce sort by_fitness into select_creature
# 201005121950 let's introduce specific picaxe basic genome cleaners
# 201005131258 let's cleanup not-dead code upon loading
# 201005131818 let's cleanup code before determining id (plus other major improvements in quality)
# 201005131819 let's prevent two identical pieces of code to exist in the db
# 201005132025 let's try and rate the quality of a compilation
# 201005141604 let's remove some non lethal bugs
# 201005141607 let's reuse make_creature in the main loop
# 201005141621 let's cleanup accolades (curly braces) and reduce labels to one alpha char
# 201005141717 let's not shorten labels, it destroys potentially interesting dna
# 201005141723 let's dump all genomes in one huge logfile for online monitoring
# 201005141738 let's expand the fitness range for dead genome: 1-9 depending on location of syntax error in the code
# 201005141756 let's give small viable programs a small advantage when memused is just over 4 bytes
# 201005141856 let's compile code with newlines replaced by spaces so that we know the exact length of the code
# 201005141948 let's no longer compile code with newlines replaced by spaces, it's another bad idea, the code appears to be functionally different in some cases
# 201005142036 let's cleanup backslash-doublequote combo's
# 201006011238 let's allow for father and mother to be the same creature (!)
# 201006011441 let's rename "retired" into "buried"
# 201006011824 let's stop replacing empty genome by an arbitrary string (a:) and start evaluating it as fitness = 1
# 201006011929 let's move all the sorting and counting of %creature to the top of the script, saving tons of CPU cycles
# 201006022235 let's cleanup trailing newlines
# 201006032139 let's push any new ids to the array @ids, without bothering with expensive sorts
# 201006032154 let's no longer worry about genomes shorter than 2 chars, they too have a purpose in the gene pool

Continue reading here.

3evolve.pl_.txt12.35 KB
4evolve.pl_.txt13.31 KB
5evolve.pl_.txt14.66 KB
6evolve.pl_.txt17.05 KB
7evolve.pl_.txt17.23 KB
8evolve.pl_.txt19.5 KB
1population_management.pl_.txt5.67 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rik's picture

I'll show you mine if you show me your's!

TeleFox's picture

Haha, but I can already see yours! Why buy the cow when you can get the milk for free?