An Interesting Two Players' Game Involving Cumulative Sum of Uniform Distribution $A$ and $B$ are two players, each have exactly one turn. $A$ goes first. $A$ keeps on choosing a random number uniformly distributed over $(0,1)$ and add the values. If at one point it exceeds $1$, $A$ loses. If $A$ thinks his cumulative sum is very close to $1$, hence there is a risk of losing, he stops. Then $B$ starts the same process and add the values separately. If at one point $B$ exceeds $A$'s sum and still below $1$, he wins. What is the optimal strategy for $A$ to stop adding and what is the probability of winning in that case ($B$ knows the value $A$ stopped at)?
From simulation It appears that the optimal threshold of $A$'s cumulative sum is approximately $0.5772$, which is very close to the Euler-Mascheroni constant $\gamma$.
 A: Expanding on the comment by @Ross:
Working backwards, suppose $A$ stopped at $a$, $B$ is currently at $b<a$, and denote $B$'s chances of winning by $p_a(b)$. The strategy of $B$ is trivial: as long as he's below $a$, he has to roll again, and then he can either get to a level $b'<a$, fall between $a$ and $1$ (and win), or exceed $1$ (and lose). Therefore $p_a(b)$ satisfies
$$
p_a(b)=\int_b^ap_a(b')db'+(1-a),
$$
or,
$$
\partial_bp_a(b)=-p_a(b),\quad \lim_{b\rightarrow a}p_a(b)=1-a.
$$
The solution of this is given by $p_b(a)=(1-a)e^{a-b}$, in particular if $B$ takes the value $a$ from $A$, $B$'s chance of winning is $(1-a)e^a$.
Now suppose $A$ is currently at $a$ and has to decide whether to proceed, denote his chance of winning with optimal strategy is $q(a)$. If he stops, his chance of winning if stopping is $1-(1-a)e^a$. If he keeps going, his chance of winning is $\int_a^1q(a')da'$.
Therefore
$$
q(a)=\max\{1-(1-a)e^a,\int_a^1q(a')da'\}
$$
The first term is strictly increasing, the second is strictly decreasing, so there is a unique turning point $a_0$, which is the threshold for $A$ :
$$
1-(1-a_0)e^{a_0}=\int_{a_0}^11-(1-a')e^{a'}da'=(2-a_0)e^{a_0}-a_0-e+1,
$$
or,
$$
(3-2a_0)e^{a_0}-a_0-e=0.
$$
I can't quite solve this, but plugging in $\gamma$ gives $\sim-0.0084$. The actual numerical solution from WolframAlpha is $\sim0.570557$.
Edit: Just as a curiosity, one also gets the total winning chance of $A$, $q(0)=e^{a_0}q(a_0)\sim0.425$
