Code center > Suggestions

Block coding

(1/3) > >>

strangers:
Well, as I was staying up last night watching Transformers, I got to thinking, how could one organize bot code and enable sexual reproduction?; and so I thought of block coding, rather than explain I will show:

--- Code: ---/initialize block
cond
*.robage 0 =
start
200 rnd 55 store
.eye5 .ploc store
256 41 store
7 989 store
stop

cond
start
stop

cond
start
stop
/end block

/search block
cond
*.eye5 0 =
start
mult 50
stop

cond
*.refeye *.myeye !=
*.eye1 *.eye5 >
start
mult -140
stop

cond
*.refeye *.myeye !=
*.eye9 *.eye5 >
start
mult 140
stop

cond
*.refeye *.myeye !=
*.eye3 *.eye5 >
start
mult -70
stop

cond
*.refeye *.myeye !=
*.eye7 *.eye5 >
start
mult 70
stop
/end block

/movement block
cond
*.refeye *.myeye !=
*.eye5 0 >
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop

cond
start
stop

cond
start
stop
/end block

/shoot1 block
cond
*.eye5 40 >
*.refeye 0 =
*.robage 0 !=
start
*.refxpos *.refypos angle .setaim store
.shoot dec
16 .shootval store
*.refvelup .up store
*.refveldx .dx store
stop
/end block

/shoot2 block
cond
*.eye5 40 >
*.refeye *.myeye !=
*.refeye 0 !=
*.refpoison 0 >
*.robage 0 !=
start
*.refxpos *.refypos angle .setaim store
-6 .shoot store
16 .shootval store
*.refvelup .up store
*.refveldx .dx store
stop
/end block

/shoot3 block
cond
*.eye5 40 >
*.refeye *.myeye !=
*.refeye 0 !=
*.refpoison 0 =
*.robage 0 !=
start
*.refxpos *.refypos angle .setaim store
.shoot dec
32 .shootval store
*.refvelup .up store
*.refveldx .dx store
stop
/end block

/shoot4 block
cond
*.shflav 0 !=
*.shflav -2 !=
start
*.shang .aimshoot store
64 .shootval store
-6 .shoot store
0 .shflav store
stop
/end block
--- End code ---
See, with each set of genes having a "block", during sexual reproduction the computer could look at the parents blocks and genes and randomly choose which to give to the offspring, and if one has a certain block and the other doesn't it would have a 50/50 chance of receiving the block or not. This would make sexual reproduction les likely to break a bot.
 Each block type would have a gene limit, if your under the limit just add a blank gene:

--- Code: ---cond
start
stop
or for evolution sims:
cond
00000000000
start
00000000000
stop
--- End code ---
This would also open up oppurtunities for new viruses such as:

--- Code: ---/virus block
cond
*.nrg 1000 >
*.eye5 20 >
start
100 .vshoot store
*.thisblock .mkvirus store
stop

cond
*.myeye 20 !=
start
80 .repro store
300 .vshoot store
stop

cond
*.myeye 20 !=
*.refeye *.myeye =
start
-1 .shoot store
32 .shootval store
*.refxpos *.refypos angle .setaim store
stop
/end block
stop
--- End code ---
Block viruses could be limited to just 3 genes, anyless and they'd be no different than regular viruses, possibly even specific block virus sysvars like .bvtimer, .bvshoot, and .mkbvirus.
Any questions, or does it need further explanation?

Numsgil:
The problem is that there's a lot of hard-sets everywhere.  There's a limit on the size of blocks, how many genes they can have, the insides of genes won't get shuffled with the mate's genes, etc. etc.  

Ideally the sexual reproduction would treat the DNA like a long "tape", or string of commands.  It shouldn't have any knowledge of, or respect, genes.  There's a lot involved with sexual reproduction but basically the mechanism most important is "crossing over".

Crossing over shuffles DNA by lining up two like strands and "zipping" them up together as long as they're identical.  If you have enough of these "zipping up" points you'll get all of the DNA except for a few mutation spots.

Then, the strands are swapped in a couple of random locations where they're zipped up.  This helps ensure that the insides of genes can get crossed-over and shuffled, too.

The primary thing preventing it from being coded in the VB version at the moment is that the DNA is built as a flat array, and shufflign two strands together is a headache-prone mess.  Still, we might be able to convince Eric to try if we ask reeeeaaal nice

EricL:
The main argument against implementing sexual reproduction in the simulator to date hasn't been about creating descendants with broken DNA or block size or implementation difficulty or anything like that.   It's been that we don't want to hard code anything about mating choice, species determination, DNA structure, cross over points, crossover granulatiry, etc. into the simulator.  How bots chose to reproduce and co-mingle DNA between individules should be evolved.  That has been the argument.

Bots could evolve (or be hand authorred for) sexual reproduction today with no improvements in the simulator.   I've posted about this before here.

The idea is that bots take over their own reproduction using viruses to propagate DNA into their offspring.  New offspring either delete all (or perhaps only half) their DNA at age 1 or do nothing for a long time waiting for a parent to delete it for them using a virus.  The parent(s) then use a different virus (or the same one) to inject whatever DNA (or portion of DNA) they want into the empty husk.  It is not difficult to imagine bots only injecting half their DNA, for offsping to be non-functional until they get injected from two parents, for mechanisms to evolve for parents to chose random (or non-random) portions of their own DNA to inject, for sexes to evolve based upon which DNA portions get injected or which birthed the empty husk (egg) and which provided the virus injection (sperm) , etc.

strangers:
Well, I get the biology stuff, I understand about bots evolving their own repro methods, could you atleast try it for viruses?

EricL:

--- Quote from: strangers ---Well, I get the biology stuff, I understand about bots evolving their own repro methods, could you atleast try it for viruses?
--- End quote ---
I am all for allowing for multi-gene viruses and will be happy to add the necessary code to the simulator.

That said, the work is not trivial and may have some far reaching consequences, so I think a little further discussion of the subject is warrented.

Personally, I think we should allow for viruses to be arbitrary contigious sequences, gene aligned or not.  That is, instead of a virus being a single gene or block of genes, it is a contigious DNA sequence of a given length, which coudl be a partial gene or contain multiple genes.  I suggest modifying .mkvirus to be the starting bp of the sequence to be made into the virus.  I further suggest we add .vlength which would be the length of the sequence to make into the virus.  For completeness, we could add .genenum, .genestart, .geneend, which could be used to find the beginning and ending bp numbers for a gene whose number is stored in .genenum.  We already have .dnalen.

Additionally, I think we should add a mechanism for sequence matching to determine where in the infected bot the viral sequence gets inserted.

Navigation

[0] Message Index

[#] Next page

Go to full version