Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Welwordion on April 13, 2006, 07:22:48 PM

Title: strange problems: .refxpos and !%=
Post by: Welwordion on April 13, 2006, 07:22:48 PM
Ok, original I wanted to store the coordinates from the bot your own bot sees into the output.
However to mimize energy consumption I wrote following condition

cond
*.out1 *.refxpos !=  (first problems this does not activate it seems *.refxpos always stays 0 regardless of circumstances)

Also I wanted to use  !%= so it would only activate if the difference is more than 10%, however according to the wiki !%=  does not  work so, rather the description sounds quite strange:
It says %= returns" true" if the difference is less than 10% , !%= returns "false" if the difference is more than 10%

WHAT???? This is both the same situation just that you splitted the returno f false or true into two different vasriables which is totally senseless.
How would I need to write the condition so that it is true when .refxpos is more than 10% (1% would be even better) away from the value in .out
Title: strange problems: .refxpos and !%=
Post by: Numsgil on April 13, 2006, 07:36:50 PM
You could do:

*.refxpos *.out1 sub *.refxpos 10 div >=

Personally I'd do:

*.refxpos *.out1 sub abs 120 >=

that way the amount of error you're ignoring is independant of where you are in the world.

%= ~= !~= and !%= aren't used very often.  They tend not to work exactly like you'd like in any given situation.
Title: strange problems: .refxpos and !%=
Post by: Welwordion on April 13, 2006, 09:10:27 PM
As I remember, calculations do not work within conditions in pre 2.4(thats why I not used them) so your solutions would not really work there, besides it does not solve the riddle why the gene did not activate.
Title: strange problems: .refxpos and !%=
Post by: Numsgil on April 13, 2006, 09:28:55 PM
Those %= etc. commands don't work like you think they would.  The math itself seems fairly easy inside the program, but the effects never seem quite right.

I would also recommend migrating to 2.4 now that it's stable and has at least all the same features as 2.3X.