Code center > Suggestions
.sexrepro reimplemented in 2.43.1
Numsgil:
Attached is an implementation of natural crossing over in C# using strings. There are two variables which can be modified to change the sort of crossing over done: the minimum matching length (defaulted to 3 in this implementation) and the number of crossing over events (user setable at run time in this implementation).
Both of these variables could easily be set by bots to control the sort of crossing over and how it works, and thus would be subject to natural selection. If a bot increases the minimum matching length, for instance, it means that the mate must be genetically less distant for meaningful crossing over to occur. The more crossing over events that occur, the more evenly mixed the two genomes are (and the greater the risk of breaking parts of the DNA). For bots, you'd probably want to express number of crossover events as a probability per matched bp instead of a hard number, so that it scales nicely with genome size.
There's an exe buried deep in this implementation. Run it with these test cases to get a feel for the results:
A: General Washington opened the western US to colonization
B: Washington state is in the western US
A: Hi John, eat boogers and die
B: John loves to eat boogers
A: AAAAAA123456AAAAAA
B: 123BBBBBB456BB
A: ABCdefGHIJ
B: abcdefghij
Implementing this in the VB code with the DNA like it is is going to be a pain, I'll admit. Glad I'm not the one to do it
shvarz:
How will this deal with highly repetitive sequences? Some of my bots by now can be represented as:
VV1VVVV2VVVVVVVV3VV4V5v6VVVVVVV7VVVVV
where numbers are real genes and V stands for a virus.
Numsgil:
It matches the longest sequence possible, then recursively does the same on segments to either end of the match. So in layman's terms it handles highly repetitive sequences very well.
EricL:
Okay, I now have this implemented using shot-based fertilization and Num's crossover algorithm. I want to bake it for 24 hours so 2.43.1 should come out tomorrow barring unforseen issues.
Bots can now shoot -8 sperm shots. There is no cost for this beyond the normal shot cost. The shooter's DNA is copied to the shot (like with viruses). .shootval operates the same way as for other shots.
If a sperm shot impacts a bot, it fertilizes it (shell, etc. has no effect on sperm shots). That is, the sperm DNA is copied to an internal buffer on the impacted bot. Note that the father need no longer be alive at impact time to father offspring. Once sperm is fired, the father is out of the loop.
Currently, bots remain fertilized for 10 cycles. We can change this easily down the road, but it's 10 for now. A new sysvar .fertilized (303) counts down the cycles remaining until the bot is no longer fertilized. If the bot gets shot with another sperm shot while fertilized, that DNA replaces the previous DNA and the .fertilization counter gets set to 10 again.
If a bot sets .sexrepro to a postive value not a multiple of 100 while fertilized, it will sexually reproduce (subject to the normal reproduction constraints w.r.t. body, space and vegginess) giving the offspring the specified percentage of it's resources.
For this version, the crossover variables mentioned in Num's algorithm are internal as follows. The minimum sequence length to match is fixed at 3 base pairs. The maximum number of crossover points is determined by taking the length of the shorter parent's DNA and dividing by 10.
Seems to be working pretty well now. Stay tuned...
EricL:
A couple of additional points:
.sexrepro only gets reset if reproduction is successful.
Reproducing sexually does not zero the fertiliziation counter. Bots may sexually reproduce multiple times (up to 10 times, once per cycle) using the same sperm DNA.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version