Darwinbots Forum

Bots and Simulations => DNA - General => The Gene depository => Topic started by: MysticalDumpling on January 20, 2014, 03:12:57 PM

Title: Shooting Distance Calculator Gene
Post by: MysticalDumpling on January 20, 2014, 03:12:57 PM
def tempdist 110 'or some other memloc

'blah blah blah...

start
*.refxpos *.refypos *.xpos *.ypos dist 2 logx .shootval store
stop



This gene finds the distance between 2 bots and finds the inverse log2, then puts the result into .shootval. It works for me... there might be an error. If so, correct me!  :P
Title: Re: Shooting Distance Calculator Gene
Post by: Botsareus on January 21, 2014, 01:58:36 PM
Quote
It does not work for me... there might be an error.

I'll see if this works, but later.
Title: Re: Shooting Distance Calculator Gene
Post by: MysticalDumpling on January 21, 2014, 04:21:40 PM
Maybe find the distance of x&y separately, then use the Pythagorean theorem to find the distance...
Title: Re: Shooting Distance Calculator Gene
Post by: MysticalDumpling on January 21, 2014, 04:24:01 PM
I found the error! The log result has to be made negative, so...
*.refxpos *.refypos *.xpos *.ypos dist 2 logx -1 mult .shootval store '?
Title: Re: Shooting Distance Calculator Gene
Post by: Botsareus on January 21, 2014, 05:11:41 PM
Good Job  8)