Author Topic: Shooting Distance Calculator Gene  (Read 4000 times)

Offline MysticalDumpling

  • Bot Destroyer
  • ***
  • Posts: 205
  • Kurwa chuj!
    • View Profile
Shooting Distance Calculator Gene
« 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
To być albo nie być, oto jest ze pytanie

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Shooting Distance Calculator Gene
« Reply #1 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.
« Last Edit: January 21, 2014, 02:24:21 PM by Botsareus »

Offline MysticalDumpling

  • Bot Destroyer
  • ***
  • Posts: 205
  • Kurwa chuj!
    • View Profile
Re: Shooting Distance Calculator Gene
« Reply #2 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...
To być albo nie być, oto jest ze pytanie

Offline MysticalDumpling

  • Bot Destroyer
  • ***
  • Posts: 205
  • Kurwa chuj!
    • View Profile
Re: Shooting Distance Calculator Gene
« Reply #3 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 '?
To być albo nie być, oto jest ze pytanie

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Shooting Distance Calculator Gene
« Reply #4 on: January 21, 2014, 05:11:41 PM »
Good Job  8)