Darwinbots Forum

Bots and Simulations => DNA - General => Tips and Tricks => Topic started by: Elite on January 22, 2006, 02:36:03 PM

Title: Conditionless Bots
Post by: Elite on January 22, 2006, 02:36:03 PM
Here is Animal Minimalis

Code: [Select]
'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

And here is my modified SG version

Code: [Select]
'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

Can you see how it works?

Sgn is a very useful command
Title: Conditionless Bots
Post by: Endy on January 22, 2006, 04:36:51 PM
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.
Title: Conditionless Bots
Post by: Elite on January 22, 2006, 04:45:42 PM
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
Title: Conditionless Bots
Post by: Endy on January 22, 2006, 05:10:21 PM
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.

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?
Title: Conditionless Bots
Post by: Elite on January 22, 2006, 05:16:28 PM
Here's a good tie defence (on the subject of leaching)

Code: [Select]
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

Instakill

Here's my bot ...

Code: [Select]
'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

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  :)
Title: Conditionless Bots
Post by: Endy on January 22, 2006, 05:55:40 PM
Take a look at Din (http://forum.darwinbots.com/index.php?showtopic=34) sometime. It uses:

-1000 .tieval store
*.tieval 1000 div .tieloc store

to allow it to instantly switch from tie feeding to making a bot move.

We've been calling them conditionless bots even though they're not really. The stuff we use is like algebra on steroids to make boolean logic gates within genes.
Title: Conditionless Bots
Post by: PurpleYouko on January 22, 2006, 06:27:19 PM
Oh great!  :blink:

Now I have two high tech programmers to contend with.  :rolleyes:

One Endy was bad enough.

(just kidding guys)

I have trouble keeping up with these complex SG bots at the best of times.
One of these days I might just get around to finishing my stack-tracker utility. That will make things easier to decipher and to program.
Title: Conditionless Bots
Post by: Numsgil on January 22, 2006, 06:59:02 PM
I'm just finishing up my in-simulation bot debugger utilitiy for the C++ version.  It lets you track the contents of the stack and various memory locations while you step through a DNA program command by command.

Immensely useful.
Title: Conditionless Bots
Post by: Endy on January 22, 2006, 10:38:14 PM
That would be great. Most of the time I write little notes to keep the values straight.

Quote
I have trouble keeping up with these complex SG bots at the best of times.

They do become kind of esoteric after a while. :lol:

Quote
Oh great! 

Now I have two high tech programmers to contend with.

What's really funny is that I learned the basics from you. :D  That first one you made reproduce without using something like *.sun got me started. ^_^
Title: Conditionless Bots
Post by: Endy on January 23, 2006, 12:58:54 AM
Conditionless Bots (http://www.darwinbots.com/WikiManual/index.php?title=Conditionless_Bots)

Horray let information be free :lol:

Made a wiki containing the major tricks into crafting conditionless genes. Haven't added everything I know, mainly just because I would be here forever :)  I'll see about adding more information on the other minor tricks, like storage location switching.
Title: Conditionless Bots
Post by: PurpleYouko on January 23, 2006, 09:12:54 AM
Quote
That first one you made reproduce without using something like *.sun got me started. happy.gif

Oh! You mean my little Devincio Solo?

The first tie feeding SG bot?

He was pretty cool and revolutionary at the time but then you took my concept and exploited it mercilessly to the point where the DNA looks like some weird-ass foreign language math textbook on steroids. <_<

That always seems to be my problem in DarwinBots.
I am pretty good at finding whole new concepts (like tie feeding, leach genes and so on) then somebody else refines them and beats my bot.

Makes me sad  :(

Even worse is that I haven't had enough time to keep up with DB lately. This board is about all I can handle right now. I don't think I have even run a sim since Christmas.  :(
Title: Conditionless Bots
Post by: Light on January 23, 2006, 09:54:03 AM
I know how you feel, im snowed under, writing my dissertation.  :sad2:

Still good to see some new bots and ideas, things have been a bit dry recently

Ive allways been tempted to write a 1G bot, closest Ive got was a 6G bot, but maybe sometime in the future
Title: Conditionless Bots
Post by: Numsgil on January 23, 2006, 10:15:01 AM
I think things are dry because the versions are in a kind of limbo.  2.4 has issues but is also in many regards alot nicer than 2.37.

I'm hoping when I get the C++ port finished things will take off again.  It's slow but steady progress.
Title: Conditionless Bots
Post by: PurpleYouko on January 23, 2006, 10:20:20 AM
Hopefully with the advent of the C++ version we can all get back to what is important. Running sims and making/evolving bots.

I plan to keep 2.37 alive to some degree so that I can try out some ideas on it now and then, but the faster operational speed of C++ should make the actual program much more accessable to everyone.

Lately DB has been too much about bugs in the code and not enough about the bots.
Title: Conditionless Bots
Post by: Elite on January 23, 2006, 11:21:16 AM
'Conditionless bots' - yay I coined a term  :D

Has anyone with any time tested out my Una SG bot yet? Endy?
It just swarms over everything in its path like a horde of flesh-eating ants. If I entered it for the league now it could probably beat F1, F2, and SB, although hunter was a challenge to beat - I'll have to try your *.newmom style repro routine PY

It's nearing completion ...  :firedevil:

I definately agree that DB should be about bots and evo rather than bugs
Title: Conditionless Bots
Post by: PurpleYouko on January 23, 2006, 11:48:16 AM
Quote
hunter was a challenge to beat
I really don't like Hunter 2.4.

He is just about the nastiest piece of crap that I have ever made.

He started out great with some fantastic new concepts. Elegent would be the term I would use.

Trouble was that he didn't quite have enough killer instinct. I had to drastically butcher the poor thing, destroying all that made him lovable.
In the end I came up with a highly aggressive killing machine, but in making him that way, I had to sacrifice efficiency and any kind of elegence of form.

The result kicks ass but in a really horrible way if you know what I mean. There just aren't any redeaming features to him. Bit like a wolverine really. Perhaps I should rename him.

I need to make a hunter 2.5 at some point. There has to be some way to make a truly viscous killer without sacrificing the refinement that has always been the trademark of the Hunter family.
Title: Conditionless Bots
Post by: Light on January 23, 2006, 11:50:45 AM
Quote
Has anyone with any time tested out my Una SG bot yet? Endy?
It just swarms over everything in its path like a horde of flesh-eating ants. If I entered it for the league now it could probably beat F1, F2, and SB, although hunter was a challenge to beat
Newbies are so confident these days  :evil:

Its a nice little bot, it could maybe get to the top of SG and F1 league and top 3/4 in F2, but you can never fully tell until you actually run the league, good bots sometimes come unstuck by bots low down in the league.
Title: Conditionless Bots
Post by: PurpleYouko on January 23, 2006, 11:54:19 AM
Funny how F2 seems to be stronger than F1 these days.

Often an F2 bot rules both leagues if it is entered into them.
Title: Conditionless Bots
Post by: Elite on January 23, 2006, 01:13:11 PM
I've finished my modifications to Una

I've made a SG version of your .newmom routine PY - it's suprisingly effective for such a small change

I've also removed the *.refpoison shoot routines and replaced them with a new routine - any bot with eyes or .shoots in its DNA gets hit by this shot:

Code: [Select]
.dn .shoot store
32000 .shootval store

- it kills instantly :firedevil:

That thing is now nearly totally invincible - it wins even when outnumbered 5 to 1 by The One

Check out the antivirus coding

Code: [Select]
.delgene inc
.delgene inc

Continuously .delgenes gene 2 - any virus is deleted before it even has a chance to execute it's payload.
- complete immunity

I'll post it to the beastiary now ...
Title: Conditionless Bots
Post by: PurpleYouko on January 23, 2006, 01:28:20 PM
That thing is just plain evil.

Kicked Hunter's ass pretty quickly.

If I just wasn't so darn busy with real work right now....

I need a good challenge. :evil:
Title: Conditionless Bots
Post by: Elite on January 23, 2006, 03:38:48 PM
Back on the topic of conditionless bots, Furiae has some good conditionless coding in it - the genes activate but don't execute if a virus is detected.

Furiae's virus checker in DIN would make a good bot.
I've looked at SGing DIN but I find the navigation codes confusing  :blink:
Good old animal minimalis - nice and easy navigation codes, and it works!  :D
Title: Conditionless Bots
Post by: Numsgil on January 23, 2006, 04:27:24 PM
I take pride in making the most simplistic turning genes imaginable :D  When I joined I don't think there were successful bots with under 4 turning genes.
Title: Conditionless Bots
Post by: Elite on January 23, 2006, 04:31:27 PM
Those genes are great! All my bots use that navigation 'style'
- Including Una, take a look (it's rather confusing though  :blink: )
Title: Conditionless Bots
Post by: PurpleYouko on January 23, 2006, 04:55:07 PM
Quote
I take pride in making the most simplistic turning genes imaginable :D  When I joined I don't think there were successful bots with under 4 turning genes.
Yes there was.

H Devincio Venator or HDV (The original tie feeder) had one turn gene with almost infinite gradiations made by comparing and subtracting eye values.

It wasn't a particularly great algorith though. Great improvements have ben made since then.
Title: Conditionless Bots
Post by: Light on January 23, 2006, 06:30:51 PM
Quote
Code: [Select]
.dn .shoot store
32000 .shootval store

- it kills instantly :firedevil:
Were there not limits on energy going into movement? or am I going senile?
Title: Conditionless Bots
Post by: Numsgil on January 23, 2006, 07:17:28 PM
I believe bots are only charged nrg based on the resulting change in velocity, which is capped at the max velocity (60 I believe).  Theoretically I don't see a bot getting charged more than the equivelant to 120 .up store
Title: Conditionless Bots
Post by: Light on January 24, 2006, 05:16:45 AM
It was a change implemented in 2.4, so while its a killer shot in 2.37 its not very effective in 2.4, problem with using 2 different versions.
Title: Conditionless Bots
Post by: PurpleYouko on January 24, 2006, 08:50:45 AM
It shouldn't work in 2.37 either.

There is a cap of 100 on any value to be stored in .up, .dn, .dx and .sx. It has been there since V2.11 when it was added to counteract T-Preservans who was built with a one-hit-kill shot that placed a ridiculously high number in .dn of the victim.

I wonder if putting the value in via a tie has found some way to bypass the safeguards. I will need to check the code for this at some point when I get the chance.
If anyone else wants to check it then please go right ahead.
Title: Conditionless Bots
Post by: Elite on January 24, 2006, 11:06:35 AM
Sorry - it doesn't kill instantly. PY fixed that really early in delelopment.

The real benefit of that shot is that it stores a value of 100 .dn into the bots memory and saps alot of energy from the bot, while being cheaper in terms of energy than a powered-up .shootval shot. Just a cheaper way of killing the bots Una doesn't need to feed on (anyone with a positive .refeye and/or *.refshoot).

Ties are another matter entirely however ...


How about a virus that is quick to fire that does the same job:

Code: [Select]
cond
' Probably needs some form of conspec recog here
start
32000 .dn store
stop

Doesn't get you energy but does kill instantly

Viruses seem rather overpowered. I could .mkvirus and .vshoot that virus for a fraction of the energy cost of a .shoot that would do the same damage (or go the same range)

EDIT: Oh no, sorry, did you say energy going into movement? In witch case my virus is no more useful than Una's shot. Oops  :redface:
Title: Conditionless Bots
Post by: PurpleYouko on January 24, 2006, 01:23:32 PM
Quote
EDIT: Oh no, sorry, did you say energy going into movement? In witch case my virus is no more useful than Una's shot. Oops redface.gif

That's right. The advantage of the virus is that it will execute on every cycle though. Of course, if the virus is inserted before normal movement genes it will have no effect at all.

Try making a bot that moves forward at a rate of 32000 every cycle.
What you will actually see happening is that a value of 100 will be inserted into .up.
However the bot will not actually accelerate by even that amount. The maximum velocity atainable (never more than about 60) is first determined by the bot's mass, then the difference between that velocity and it's current velocity is used to calculate the energy cost for the acceleration.
Essentially, this bot will reach full speed very rapidly at a considerable one-time cost of a hundred or so energy. After that it will just cruise, spending the odd energy point here and there to maintain its speed.

If you really want to drain the victims energy, make a virus or shot that applies 100 times the negative of the sign of the current value in *.vel, into .up.

This will keep switching maximum acceleration in the opposite direction of present movement. That way it will spend maximum energy on direction changes all the time.
Title: Conditionless Bots
Post by: Elite on January 24, 2006, 01:41:14 PM
Thanks for that clarification. I was a little confused :rolleyes: . I suppose you would never really need to put 32000 into .dn (unless you wanted to die  :evil: )
Title: Conditionless Bots
Post by: Light on January 24, 2006, 02:05:16 PM
Quote
Try making a bot that moves forward at a rate of 32000 every cycle.
funny cause when I did that they lost 11363 energy a cycle  :blink:
Title: Conditionless Bots
Post by: Numsgil on January 24, 2006, 03:09:15 PM
Maybe we should double check that energy consumption function ;)
Title: Conditionless Bots
Post by: Elite on January 24, 2006, 04:58:54 PM
Quote
when I did that they lost 11363 energy a cycle

:huh: When I did it the bots lost over 20362 energy per cycle  :o

I am using version 2.37.6 by the way

Which version are you using Light?
Title: Conditionless Bots
Post by: Light on January 24, 2006, 07:02:35 PM
yeah I was using 2.36.7, in 2.4a everything seems fine
Title: Conditionless Bots
Post by: Endy on January 24, 2006, 10:27:36 PM
Man I hate Duty Days. <_<  I come back and a topic has exploded :wacko:  B)

Maybe the above has something to do with the backwards acceleration :unsure:

Quote
I've looked at SGing DIN but I find the navigation codes confusing

Why Din never became SG -_- The navigation is something PY thought up that allows makes use of the stack to store only a single turn value per cycle; saving nrg. Unfortunatly it also makes it difficult to SGize. I've gotten most of the rest of the code converted but those genes are the stumbling block.

I've honestly gotten away from combat bots lately, maybe with new challengers I'll get back in the game :)
Title: Conditionless Bots
Post by: PurpleYouko on January 25, 2006, 09:23:25 AM
Quote
When I did it the bots lost over 20362 energy per cycle

Hmmm!!!!  :blink:

This is not good. I thought I had plugged that loophole.

Let's just say that it shouldn't happen that way. I will fix that as soon as I get a bit of spare time.
Title: Conditionless Bots
Post by: Old Henk on January 25, 2006, 10:06:47 AM
Quote
I've honestly gotten away from combat bots lately, maybe with new challengers I'll get back in the game :)
I think you have :) I just ran the SB league and UNA came out on top  :)  :rolleyes:
Title: Conditionless Bots
Post by: Elite on January 25, 2006, 01:17:25 PM
Yey  :)