Bots and Simulations > DNA - General

How can you approximate sin-1?

(1/5) > >>

MysticalDumpling:
Alas, sin-1 does not seem to be a valid operator according to the wiki. Does anyone know how to in DB?

MysticalDumpling:
Well, after a long time trawling through calculus functions and really, really technical documents, 2 broken pencils and several smudged sheets of looseleaf, I then discovered on Khan Academy than arcsin(x) = x + (x^3)/6. Then, I wasted even more looseleaf getting a "proper" DB function down.  I used previously wrangled trig equations to fid a pair of variables- the distance of the end target (c) and the angle needed to turn (capital b ).

c:

--- Code: ---*.refxpos *.refypos dist sqr *.refvelscalr sqr add 2 *.refxpos *.refypos dist mult *.refvelscalr mult sub *.refaim cos
--- End code ---


B
Now, I used c for short for the eq. above

--- Code: ---*.refaim sin *.refvelscalar mult c div *.refaim sin *.refvelscalar mult c div 3 pow 6 div add
--- End code ---

Full B:

--- Code: ---*.refaim sin *.refvelscalar mult ]*.refxpos *.refypos dist sqr *.refvelscalr sqr add 2 *.refxpos *.refypos dist mult *.refvelscalr mult sub *.refaim cos div *.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalr sqr add 2 *.refxpos *.refypos dist mult *.refvelscalr mult sub *.refaim cos div 3 pow 6 div add
--- End code ---

Now, I need to use my lengthy shot-dist calculating gene, a as-of-yet unknown shot velocity and a factor to account for maximum shot distance based on bot size, stick it together for an excessively long functio that most likely will have more bugs than a beehive.

MysticalDumpling:
Then again, this was fun in a masochistic way  :happy:

MysticalDumpling:
[bump]
Now, I am working on trying to find shot-distance-based-on-bot-size-and-logx snippet.
This means trawling through VB. I know very little about VB, except it's fundamental basics. Woohoo.

MysticalDumpling:
Found this snippet
If rob(n).vbody > 10 Then
    Shots(a).nrg = Log(Abs(rob(n).vbody)) * 60 * rngmultiplier
    Dim temp As Long
    temp = (Shots(a).nrg + 40 + 1) \ 40 'divides and rounds up
    Shots(a).Range = temp
So, base shot range is the log of body, timess 60, times "nrgmultiplier", which I assume is .shootval


Also, it seems that shot velocity is 40

Now, to figger out a cohesive code line

If this works, it will be so badass....

Navigation

[0] Message Index

[#] Next page

Go to full version