Darwinbots Forum

Bots and Simulations => Bot Tavern => Topic started by: Houshalter on January 11, 2010, 07:43:30 PM

Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 07:43:30 PM
 Look at this gene
Code: [Select]
start
*.reffixed 0 =
*.refnrg 10000 > and
*.eye5 40 < or
*.refshell 0 > or
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <= or
*.totalbots *.totalmyspecies sub 100 > and or
157 .aimdx store
not
*.refxpos *.refypos angle .setaim store
stop
It <you>should</you> make the bot turn when theres nothing worth looking at and set its focus on the bot in focus otherwise. But no matter what I try it just wants to turn around endlessly  . If your wondering what kind of bot this is for, its for a sheperd bot im creating. By the way, .avgfitness is a custom variable which refers to the average fitness of the last ten bots hes seen.

Edit: somethings wrong with the post system, I tell it to underline a word and it puts you's on both sides of it in <> signs then it auto spell checks the you's into you's.
Title: Is there something wrong with this
Post by: bacillus on January 11, 2010, 07:48:57 PM
The last and or statement could be your problem. The and counts the whole command stack, the or is then left with nothing.
Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 07:52:50 PM
So how do you "or" two independent conditions together eg;
a 1 >
b 1 > and



c 1 >
d 1 > and

now I want it to activate when both or either of these two conditions are true? Is there any way to do that



<you>Now Im going to try to get it to under line these words</you>
Title: Is there something wrong with this
Post by: bacillus on January 11, 2010, 08:14:29 PM
the boolean operators take the top two booleans from the stack and add the result to the stack. So it would look like this:

[A]
and
[C]
[D] and or

to elaborate, the first and adds A and B; then, the second and adds B and C, those being on top of the stack. You can then or the two results together.

I'm getting the underline thing too...
Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 08:18:53 PM
So you mean do something like this?
Code: [Select]
start
*.reffixed 0 =
*.refnrg 10000 > and
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <= or
*.totalbots *.totalmyspecies sub 100 > and or
*.eye5 40 < or
*.refshell 0 > or
157 .aimdx store
not
*.refxpos *.refypos angle .setaim store
stop

Edit: Wait scratch that...

Code: [Select]
start
*.reffixed 0 =
*.refnrg 10000 > and
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <=
*.totalbots *.totalmyspecies sub 100 > and or
*.eye5 40 < or
*.refshell 0 > or
157 .aimdx store
not
*.refxpos *.refypos angle .setaim store
stop
I mean this.
Title: Is there something wrong with this
Post by: bacillus on January 11, 2010, 08:23:52 PM
Sadly, I have no idea what you are trying to achieve. If you could break the conditions down step-by-step in pseudocode, it would make things much simpler for me.

The post-edit version makes sense, at least. Run it and see if it works

If it helps, this is what it does:
FIXED and NRG (Condition A )
FIT and SPECIES (Condition B )
A or B or EYES or SHELL
Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 08:32:32 PM
Ya, I hate trying to figure out other peoples bots to.
Here I go

'this is the original code not the one I just changed
start                'obvious
*.reffixed 0 =                'check to see if the robot im looking at is fixed (if it is I either have to feed it or let it go)
*.refnrg 10000 > and     'if its not fixed and it already has plenty of nrg then why bother just staring at it?
*.eye5 40 < or              ' If theres nothing in my eye then turn till there is
*.refshell 0 > or            'I am trying to avoid evolving bots with shell so I put this one in there
*.memval *.refmulti 100 mult add *.refkills 2 div add *.refpoison 1000 div add *.refshoot add *.refeye add *.reftie add *.avgfitness <= or      'this line checks
                                                                  'the fitness of the bot im looking at based on the refvars and tells me if its less then or equal to average fitness
*.totalbots *.totalmyspecies sub 100 > and or   'even if its less then average fitness I can still feed it if the population is to low
157 .aimdx store      now if any of those conditions are true turn me right (or left, im not sure)
not 'Otherwise do the following
*.refxpos *.refypos angle .setaim store    'set my aim at the robot in my eye
stop 'we're done here
Title: Is there something wrong with this
Post by: bacillus on January 11, 2010, 08:41:12 PM
I never tried using in-line conditions, have you ever tried using algebraic functions as booleans? It's time-consuming but foolproof...
...for example, the genes
cond
 *.reffixed 0 =
start
 15 .up store
stop

becomes

15 *.reffixed sgn abs -- abs ..up mult store

EDIT => I think I wrote a post about all the possible functions in the DNA section once. Also check out the OCULUS II code; it's a super-efficient piece of code I wrote that puts the closest eye in focus. Then eyef can be read as though it were eye5. It's a monster of conditionless logic that combines at least 45 conditions into a single expression as seen above
Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 08:59:51 PM
Yes I did but I didn't get it at all so I figured out how to use the boolean operators instead  . I already have a hard enough time debugging my bot. By the way there was some improvement with the last change I made. Instead of spinning endlessly it stops and stares at a bot untill it randomly explodes several cycles later  . I don't even know where to begin now.
Title: Is there something wrong with this
Post by: bacillus on January 11, 2010, 09:05:14 PM
I suppose spontaneous combustion might have its advantages in a species...

To clarify, the bit you posted was designed to only turn and face a bot.
If I understand you intentions correctly, and you want to feed the bot, use -2 .shoot store to fire a food shot.

EDIT => If you want, I could maybe rewite OCULUS II to suit your needs?
Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 09:06:48 PM
Ya pretty much. This is what the bot looks like now:  



<you>Trying the underline function one more time...</you>
Title: Is there something wrong with this
Post by: bacillus on January 11, 2010, 09:11:14 PM
Uh...your bot is a veggie isn't it? You need to turn the autotroph function on if so when starting a new sim.
Title: Is there something wrong with this
Post by: Houshalter on January 11, 2010, 09:14:37 PM
Yes it is and I figured out part of what was wrong. It tries to store 30,000 in shell, poison, and slime, but the simulator only lets it have a maximum of 500 slime. So it keeps trying to store more and more, etc. I'll fix that. As to why it won't shoot food shots at the bots, well thats a whole nother can of worms.
Title: Is there something wrong with this
Post by: Numsgil on January 12, 2010, 02:57:41 AM
Underlining is square brackets, not angular.  eg: [] not <>
Title: Is there something wrong with this
Post by: Houshalter on January 12, 2010, 06:39:49 AM
<you>Thats right but I just used the underline button</you>
Title: Is there something wrong with this
Post by: Moonfisher on January 12, 2010, 01:20:44 PM
When I use the underline button it inserts (Ignote the \'s) :  \[\you\]
Then when submitting the post it changes the you to "you".
(SECOND EDIT : I give up... I'm trying to write a letter that sounds like you, and it's the first letter in the word "up". This is not a clever feature IMHO, especialy not when the BB code requires a particular letter which is translated and controll characters are ignored. Third edit : Atleast they had the sence not to translate the number 2)

For what the bot is concerned, it's hard to tell whats wrong from one gene, but if the bot is dieing it's out of energy (Or possibly has no genes left or too much waste, but I doubt that's the problem).
So if it's dieing fast it's because you're spending a whole lot of energy. If you have no costs on, it would probably be something like a virus spending too much energy on a virus shot (vshoot), or boosting a shot too much pushing a high value into shootval (Positive or negative).
If you have costs on then you should also watch what you spend on shell/poison/venom/slime/body. You can have more than 500 shell, think up to 32K but not sure... but it costs and decreases your speed. 30K shell will leave you completely immobile, but I think you can get there if actualy have enough energy to make that much shell...
Title: Is there something wrong with this
Post by: Houshalter on January 12, 2010, 03:36:37 PM
I want it to fix itself in place and be completely immobile. So im not conserned about that and I think it was a random unreproducable glitch in darwinbots itself not my bot. Bots started doing things they shouldn't be able to do etc. So when im not busy I'll try it again and see if it works.
Title: Is there something wrong with this
Post by: Numsgil on January 12, 2010, 04:05:18 PM
<you>Underline test</you>

I'll try to figure out what's up in the next few days.  Looks like you can't underline at all.
Title: Is there something wrong with this
Post by: bacillus on January 12, 2010, 04:09:27 PM
Remember that Slime decays exponentially - the more you have, the faster it goes. If you try keep up a lot of slime, that'll be your problem. And a fixed bot can still move through collisions; it's a pain, but even with 'Ghost' I can't seems to get rid of this.
Title: Is there something wrong with this
Post by: Houshalter on January 12, 2010, 09:33:59 PM
Its a veggie so it can affort to store unlimited slime, I know bots can move when their fixed but with a lot of shell how far could they go?


asfsdf[you]Last try to underline[/you];lksafdsajkls    (hoping random letters will confuse spell check   )
Title: Is there something wrong with this
Post by: bacillus on January 12, 2010, 09:36:20 PM
Sadly, neither of these are true. The collision physics appears to ignore inertia, and you can generate up to 10000 slime a cycle last time I checked.