A few good tips for making a virus :
Anti viral genes are always at the end, since they have no effect on genes that land at a later position. So if can delete the last gene you probably removed your worst problem.
But some anti viral genes are clever. One thing you might see is :
*.delgene 0 !=
0 .delgene store
Preventing you from ever deleting genes, this may be one of the simplest defence but IMO it's also the most anoying one.
If a bot does this there's also a chance it uses this at a later position :
*.mkvirus 0 !=
*.mkvirus .delgene store
This is to delete viruses that try to spread themselves, but it opens up weakness fixed by the first defence. Now you can write :
*.genes 1 !=
*.thisgene 1 add .mkvirus store
And you will cause the bot to delete the genes itself.
Now this is just the tip of the iceberg, obviously since you can manipulate anything you want.
Some use *.genes to detect viruses, some counter it by having .genes dec in the virus. Then again if you want to delete genes you'll have decrement .genes with one more for each cycle.
This is the assimilation part of the bot bellow :
*.genes 1 !=
.genes dec
*.thisgene *.genes sgn add .mkvirus store
*.genes 777 *777 1 sub -1 mult sqr dup div mult store
*777 .genes store
*.thisgene 1 sub *.thisgene 1 sub sgn mult *.thisgene 1 add *.thisgene 1 sub sgn 1 sub -1 mult mult add .delgene store
If you want it to spread the virus aswell you should never start channeling the virus before you're at 1 gene and you know for sure the viral defences are gone.
And for a good example, this is the viral version of Fruitflies that was put into FlyFruit and it does what you where describing. Except it doesn't spread itself, it's spread by an alge.
The full version of Flyfruit is kind of big with about 50 viruses in it and all that, but is has what I like to think is a perfect virus defence allowing it to assimilate new viruses and use them as a weapon against others. The trick is simply that alge have plenty of energy to spare, so storing 0 in all the dangerous memmory locations in the last genes simply overides anything done by viruses earlier on. Only way for a virus to kill it, is by landing as the last gene.
This is mostly well suited for internet mode though... since an alge will have plenty of time to charge this virus, and if it hits something an manages to take over then fruitflies finish the job.
For a league virus the rule of thumb is usuay the shorter you can make it the better it will be. I know Pacifist uses a virus much shorter than this to take over the alge and cause them to feed it. But it can get much shorter than that.
Occura amplificis (Or something like that) holds a very good position in F1 and is probably the shortest bot in F1 (Shorter than fruitflies).
It's also not actualy a bot, but a virus... not a bot spreading a virus, it's a virus in itself from what I can tell. (I personaly find that kind of cool, no base bot just pure virus)
Anyway here's the virus version of fruitflies (This one was made to work together with an alge, so the conspec part may at times be a litle confusing, if you find something odd you can always look at the original Fruitflies 0.21 (Should be in the starting gate, but probably easier to get it by downloading the F1 league)
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
cond
*.key .lock !=
start
.fixpos dec
'-- Birth
300 .eye5width store
.dnalen .memloc store
.dnalen .tmemloc store
31999 rnd .out10 store
31999 rnd .tout10 store
*.memval *.dnalen !=
*.in9 .alge !=
*.in10 .out10 = or and
1 .conspec store
not
2 .conspec store
*.eye5 0 =
0 .conspec store
*.tmemval *.dnalen !=
*.tin9 .alge !=
*.tin10 .tout10 = or and
*.robage 1 > and
1 .tconspec store
not
2 .tconspec store
*.numties 0 =
0 .tconspec store
*.robage 0 =
5 rnd .rand store
*.rand 4 < and
*.rand .type store
*.type 0 =
*.type 3 >= or
3 rnd .type store
'-- Reproduction
*.body 5 >
*.nrg 80 > and
*.maxvel .dn store
50 .repro store
'*.totalmyspecies .maxpop <
*.nrg 200 > 'and
60 *.body 10 mult sub .strbody store
'-- Shrinking
not
*.body 1 > and
*.body 10 mult 10 sub 0 floor .fdbody store
'-- Tie feeding
*.tconspec 2 =
*.numties 1 > or
*.numties .deltie store
*.tconspec 1 =
*.tiepres .tienum store
40 .stifftie store
99 .sharenrg store
10 .fixlen store
dupbool
*.type 1 = and
.tieval .tieloc store
1000 .tieval store
dropbool
dupbool
*.type 2 = and
.tieloc .tieloc store
-1 .tieval store
dropbool
*.type 2 > and
.shootval .tieloc store
-31999 .tieval store
'-- Hunting
*.numties 0 =
*.body 1 = and
dupbool
*.eye5 0 =
*.conspec 2 = or and
350 .aimright store
dropbool
*.conspec 1 = and
*.refxpos *.refypos angle .setaim store
.tie inc
clearbool
*.genes 1 !=
.genes dec
*.thisgene *.genes sgn add .mkvirus store
*.genes 777 *777 1 sub -1 mult sqr dup div mult store
*777 .genes store
*.thisgene 1 sub *.thisgene 1 sub sgn mult *.thisgene 1 add *.thisgene 1 sub sgn 1 sub -1 mult mult add .delgene store
stop