I am trying to create a "world" where "copies of programs" are allowed to evolve, proliferate and fight for resources. Organisms copy information with errors and memorize the results. It seems like one can create a "world" with resources, place various copies of a program and let them fight for resources, grow and evolve.
What would it be for Java programs. World has cells each producing certain amount of letters per tic. An organism is a String
of text that extends Life
, compiles correctly, has methods eat
, move
and breed
. Every tic move
, eat
, breed
are executed. On move
organism can decide to move to nearby cell. On eat
it can move all free letters from cell to it's body (store those behind /* here */
to make sure program compiles). During breed
stage it it can build it's own copy using letters from the commented area of the program body. Copying is error prone. If the resulting copy compiles it joins the race for resources.
Here are the problems I am having:
A single character change in a program tends to cause compile time error. How to increase survival chances of an offspring with a point mutation?
IRL organisms eat each other. How to model predator attacking prey? Some simple injectPoison(prey);
that injects */
between 50th and 51st characters in the body of prey string would kill pretty much any program. Something like "to fight: run Robocode - winner gets all loser's letters" would turn the world into a Robocode engine competition.
IRL organisms do exchange information. One can allow programs to exchange their methods, but then it is very tempting for a program to just inject a suicide method and eat the body of dead partner.
My questions are: Is there any research on building such world? What is the best way to model resources? What limits the extent of evolution in such models.