Bots and Simulations > Tips and Tricks
Conditionless Bots
Elite:
Here is Animal Minimalis
--- Code: ---'Animal_Minimalis
'Contains everything necessary for it
'to survive and reproduce.
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
cond
*.eye5 50 >
*.refeye *.myeye !=
start
-1 .shoot store
*.refveldx .dx store
*.refvelup .up store
stop
cond
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop
cond
*.nrg 20000 >
start
20 .repro store
stop
end
--- End code ---
And here is my modified SG version
--- Code: ---'Animal_Minimalis
'
'Contains everything necessary for it
'to survive and reproduce.
'
'Single gene
cond
start
*.refveldx .dx *.eye5 sgn mult *.refeye *.myeye sub dup mult sgn mult store
*.refvelup 30 add .up *.eye5 sgn mult *.refeye *.myeye sub dup mult sgn mult store
-1 .shoot *.eye5 50 sub sgn 1 add sgn mult *.refeye *.myeye sub dup mult sgn mult store
*.refveldx .dx *.eye5 50 sub sgn 1 add sgn mult *.refeye *.myeye sub dup mult sgn mult store
*.refvelup .up *.eye5 50 sub sgn 1 add sgn mult *.refeye *.myeye sub dup mult sgn mult store
314 rnd .aimdx *.eye5 sgn -1 mult 1 add *.refeye *.myeye sub dup mult sgn -1 mult 1 add add sgn mult store
20 .repro *.nrg 20000 sub 1 add sgn mult store
stop
end
--- End code ---
Can you see how it works?
Sgn is a very useful command
Endy:
Yeah, it and dup are probably the two most useful for more complex coding. You just have to be careful using sgn since it can return -1 also. Maybe a sgn abs or dup div would be better.
I think it's possible to used properties of 1, -1, and 0; to make some really advanced stuff way beyond boolean styled and/or stuff. Really tricky to use though.
Elite:
I know sgn can return -1 too but if you multiply any sysvar by -1 then you get a nonsensical store anyway, and expend no energy.
If you store into a sysvar that doesnt exist then you don't expend energy.
I've been making a really complex SG bot but I want to make sure it's ready before I release it for the leagues.
It can beat The One, even when outnumbered by Hunter, Destinatus Praelator and The One all together in one league - not bad eh?
I'll give you what I've got now if you're interested
Endy:
Shoot, post away. The One has currently been as top notch as they come, I'd love to see someone finally defeat it normally.
My best attempts have been speeded virus firing(bug) and using leach blind bots. Not exactly league quality bots. -_-
--- Quote ---I know sgn can return -1 too but if you multiply any sysvar by -1 then you get a nonsensical store anyway, and expend no energy.
If you store into a sysvar that doesnt exist then you don't expend energy.
--- End quote ---
True, but with two in a row the sgn will reverse making a 1. I try to get to the most basic 1 or 0 myself before multiplying anything.
The above is what kind of what I was talking about being advanced stuff. For an even number of -1's the statement can be multiplied to form a (1)true, an odd number forms a false(-1).
Anyone know a better name for this, using math and algebra to form boolean type conditions?
Elite:
Here's a good tie defence (on the subject of leaching)
--- Code: ---cond
start
*.tiepres .tienum *.numties sgn mult *.robage 1 sub sgn mult store
.dn .tieloc *.numties sgn mult *.robage 1 sub sgn mult store
32000 .tieval *.numties sgn mult *.robage 1 sub sgn mult store
stop
--- End code ---
Instakill
Here's my bot ...
--- Code: ---'Una
'
'Who needs conditions?
def IDcode 964
cond
start
.tie *.robage -1 mult 1 add mult inc
.deltie inc
.fixpos *.fixed mult dec
*.refveldx .dx *.eye5 sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult store
*.refvelup 60 add .up *.eye5 -1 mult 45 add sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult store
42 .IDcode *.robage -1 mult 1 add mult store
.IDcode .memloc *.robage -1 mult 1 add mult store
-6 .shoot *.eye5 0 sub sgn 1 add sgn mult *.eye5 40 sub sgn 1 add sgn -1 add -1 mult mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-8 .shootval *.eye5 0 sub sgn 1 add sgn mult *.eye5 40 sub sgn 1 add sgn -1 add -1 mult mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-6 .shoot *.refpoison sgn mult *.eye5 45 sub sgn 1 add sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-1 .shoot *.refpoison sgn -1 mult 1 add mult *.refshell sgn mult *.eye5 45 sub sgn 1 add sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-6 .shoot *.refpoison sgn -1 mult 1 add mult *.refshell sgn -1 mult 1 add mult *.eye5 45 sub sgn 1 add sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
16 .shootval *.eye5 45 sub sgn 1 add sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
*.refvelup .up *.eye5 45 sub sgn 1 add sgn mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
*.refxpos *.refypos angle .setaim *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.robage sgn mult *.eye5 35 sub sgn mult store
314 rnd .aimdx *.memval 42 sub dup mult sgn -1 add -1 mult *.refeye *.myeye sub dup mult sgn -1 add -1 mult mult *.eye5 sgn -1 add -1 mult add sgn mult store
40 .repro *.body 100 *.robage add sub sgn mult *.nrg 1000 sub sgn 1 add sgn mult store
314 rnd .aimdx *.body 100 sub sgn mult *.nrg 1000 sub sgn 1 add sgn mult store
100 .strbody *.nrg 500 sub sgn mult store
100 .fdbody *.nrg -1 mult 100 add sgn mult store
*.tiepres .tienum *.numties sgn mult *.robage 1 sub sgn mult store
.dn .tieloc *.numties sgn mult *.robage 1 sub sgn mult store
32000 .tieval *.numties sgn mult *.robage 1 sub sgn mult store
*.waste .shootval *.waste 10 sub sgn mult store
-4 .shoot *.waste 10 sub sgn mult store
*.mkvirus .delgene *.mkvirus sgn mult store
.delgene inc .delgene inc
stop
end
--- End code ---
Run it in a sim and watch what happens :)
I don't know what to call it?
- Binary bots? Digital bots?
I just call it a conditionless bot :)
Navigation
[0] Message Index
[#] Next page
Go to full version