User talk:Voidious/Optimal Velocity

From Robowiki
< User talk:Voidious
Revision as of 12:00, 16 July 2009 by Skilgannon (talk | contribs) (one-liner for getMaxVelocity)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I did a quick one-liner which gives almost exactly the same results as your getMaxVelocity(distance):

       private static final double maxVel(double distance){
         return Math.floor((Math.sqrt(1 + 4*2/Rules.DECELERATION*distance) - 1));
         
      }

The difference is that mine gives integer results, rather than all the 0.5s 0.33333s 0.25s and 0.666667s.

Distance  Skilgannon    Voidious
0          0.0           0.0
1          1.0           1.0
2          2.0           2.0
3          2.0           2.5
4          3.0           3.0
5          3.0           3.5
6          4.0           4.0
7          4.0           4.333333333333333
8          4.0           4.666666666666667
9          5.0           5.0
10          5.0           5.333333333333333
11          5.0           5.666666666666667
12          6.0           6.0
13          6.0           6.25
14          6.0           6.5
15          6.0           6.75
16          7.0           7.0
17          7.0           7.25
18          7.0           7.5
19          7.0           7.75
20          8.0           8.0

--Skilgannon 10:00, 16 July 2009 (UTC)

You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.

There are no threads on this page yet.