Bots and Simulations > The Gene depository
Shooting Distance Calculator Gene
(1/1)
MysticalDumpling:
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
Botsareus:
--- Quote --- It does not work for me... there might be an error.
--- End quote ---
I'll see if this works, but later.
MysticalDumpling:
Maybe find the distance of x&y separately, then use the Pythagorean theorem to find the distance...
MysticalDumpling:
I found the error! The log result has to be made negative, so...
*.refxpos *.refypos *.xpos *.ypos dist 2 logx -1 mult .shootval store '?
Botsareus:
Good Job 8)
Navigation
[0] Message Index
Go to full version