RingRush
Moderator
Special Guay
Posts: 330


« on: May 12, 2012, 08:08:24 PM » 

Disclaimer: this math isn't very challenging, and the conclusion shouldn't blow your mind, but it is something useful. I originally made this for myself (when my internet was down) to figure out whether to use some dk64 tricks (Aztec Early, Baboon Blast skip) in races, and I figured I'd share it since it might help other people.
Consider a simple trick, where you attempt the trick until you get it and it takes approximately a constant time to attempt it (some examples: Ruto throw, Jabu fishskip, Cucco dive, antigravity jumpslash in Deku tree). Let S be the time saved if you do the trick your first try, t be the time lost every time you fail the trick. Define your consistency as the probability you get this trick  this is individual dependent, can vary with practice, and can be roughly calculated by doing 30 or so attempts and measuring success rate. Call consistency p, and let q = 1  p.
We want to consider when a trick is useful for a race. If we let S* be a random variable for the amount of time saved from a trick in a race, then what we want is to have E(S*) > 0  that is, you are expected to save time if you do this trick.
Observe if you get the trick first try (probability p), then S* = S. If it takes two tries (probability pq), S* = S  t; three tries, S* = S  2t
Those familiar with expected values will see E(S*) = pS + (pqS  tpq) + (pq^2S  2tpq^2) ... = p[S(1 + q + q^2 + ...)  t(q + 2q^2 + ...)] Summing these series we get p[S/p  tq/p^2] = S  tq/p Now using the condition above, E(S*) > 0, we see we want pS > tq which means S/t > q/p = (1p)/p = 1/p  1 and so S/t + 1 > 1/p This brings us to the condition p > 1 / (1 + S/t) or equivalently, p > t / (t + S) Define 1 / (1+ S/t) to be a tricks Risk Ratio, R Then we see if p > R, then the trick is worth attempting in races. If p < R the trick is not worth attempting (assuming no other factors of the race are known, such as how far behind you are).
An interesting fact that might be useful for calculation (though probably not): R is equal to the amount of time lost when you fail the trick divided by the time saved if you do the trick second try.
Here is the interesting part: if a trick saves the same amount of time regardless of what your route is (think Shadow gate clip), then S is constant. Thus Rvalues can be calculated for any trick, independent of the person doing them! This means that we can compile a table of R values to use as a reference. A potential racer needs to only know his consistency to know whether or not to attempt a trick. Luckily, most tricks have either a constant or lowvariability S (meaning there are only a few possible values of S depending on what other items are needed).
Now, consider tricks where you attempt them once, and if you fail you do things the "normal" way (the obvious example of this is Mirror Shield from outside). For these tricks you either save S (probability p) or lose t (probability q).
Then E(S*) = pS  qt = pS  t + tp = p(S + t)  t Attempt if E(S*) > 0, so p(S + t)  t > 0 which means p(S + t) > t and p > t/(S + t)
But this is just the condition p > R ! Thus we can also calculate Rvalues for tricks that you attempt only once and then move on.
Unfortunately, this formula only seems to work if you attempt the trick 1 time or as many times until you get it. You can derive a formula for attempting a trick n times, but I don't know of any trick off the top of my head where that is useful.
Now consider a setup that take j seconds and improves consistency to p'. We can consider this a new trick, [S+j]*, with savings S  j (since you lose the j seconds the setup takes).
This means E([S+J]*) = S  j  (t + j)q'/p' = (S  tq'/p')  (j + jq'/p') For a setup to be worthwhile, we need E([S+J]*) > E(S*), which means S  tq'/p'  j  jq'/p' > S  tq/p This is equivalent to tq'/p' + j + jq'/p' < tq/p and j(1 + q'/p') < t(q/p  q'/p') Evaluating some more: j(pp' + pq') < t(qp'  q'p) j/t < (qp'  q'p) / (pp' + pq') j/t < (p'  p) / p j/t + 1 < p'/p 1/(j/t + 1) > p/p'
Now let L = 1/(j/t +1) = t / (j + t) Then if p/p' < L, a setup is worth it. Thus if ratio of old consistency to new consistency is smaller than ratio of old trick (fail) time to new trick (fail) time, it is worth it to use the setup.
L values can again be calculated for any setup, regardless of player. Note that if the setup makes the trick approximately perfectly consistent, the "saves time" condition is p < L. It makes sense that L is an upper bound, since if your consistency is high enough you don't need a setup.
For pause buffering, math works as before, but j is a function of the player... L becomes t / (jn + t)where j becomes the amount of seconds it takes for you to pause buffer one frame, and n is the amount of frames you need to buffer. Those who can on average do pause buffers with less pausing will have lower js. This means L becomes closer to 1, and so these players benefit more from pause buffering even tricks with higher consistencies.
No guarantee this math is right, if anyone wants to check it.
