Question:
For an odds calculator for a board game, I need to calculate how many rounds a battle will last on average. Because there is a possibility that both sides in the battle will miss, a battle can theoretically last forever. Therefore I cannot traverse all branches, but need to calculate a mathematical limit. By verifying with a simulator, I have found that the following function correctly approximates the average number of rounds left:x + x^2 + x^3 ...
forms a geometric sequence with first term x
and common ratio x
. Since x
is bounded by 0 < x < 1
, this will have a limiting sum, namely:x = 1
, as well as in the original function where r / (1 - x)
is taken, but in that case, you will simply have the sum as infinity and approx
would escape to infinity if it were not undefined
; so I am assuming that x != 1
in the following calculations and x = 1
can be / has been dealt with separately).Now, since we have both a single expression for
x + x^2 + ...
to infinity, and a single expression for approx
that includes x + x^2 + ...
then we can write approx
using both of these two facts:If you have better answer, please add a comment about this, thank you!