Bots and Simulations > DNA - General

Rounding

<< < (2/3) > >>

abyaly:
Ok, something is going horribly wrong.
For example:


--- Code: ---*.refxpos *.xpos sub *.refveldx mult
*.refypos *.ypos sub *.refveldn mult add 2 mult .beta store
--- End code ---
Which translates into
2 * [ (refxpos - xpos)*refveldx + (refypos - ypos)*refveldn]
Except, that isnt what it does -.-
? .refxpos
 689-> 1963
? .xpos
 219-> 1736
? .refveldx
 697-> 25
? .refypos
 690-> 2629
? .ypos
 217-> 1835
? .refveldn
 698->-14
? 51
 51->-10958

2 * [ (1963 - 1763)*25 + (2629 - 1835)*(-14) ] = 2 * [ 200*25 - 794*14]
= 2 * [5000 - 11116] = 2 * -6116 = -12232 != -10958

I have no idea how this is happening. I think I'm losing hair.

Trafalgar:

--- Quote from: abyaly ---Ok, something is going horribly wrong.
For example:
--- End quote ---

You made one mistake (you subtracted 1763 instead of 1736), but I don't think that's what's causing this. (You'd get (1963-1736)*25 is 5675. 5675-11116 is -5441, 2* which is -10882.)

What's really going on, if you're checking the variables in the console, is that those sysvars are changed after the DNA is executed, so, the value in .beta was calculated using data that is one cycle older than the data you are seeing in the console.

This is why Guardian's .pyt source has a bunch of commented-out vars and commented out routines to write them, named things like sxRec, velsxRec, etc. It used to have ones for just about every ref* var there was (to test why friendly checks were screwing up).

Numsgil:
Maybe I should write a small standalone stack virtual machine.  Something like irb for ruby.  Just so people can play with math and see how it works.

googlyeyesultra:
Just edit the console so that we can run math commands, like 30 50 add would output 80. Would also be nice for debugging a bot, since we could do it in the game.

abyaly:
The biggest challenge for me in DB is making the things that work on paper also work in notepad.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version