
\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,geometry}
\geometry{margin=1in}

\title{Robot Javelin Puzzle -- Final Proof}
\author{}
\date{}

\begin{document}
\maketitle

\section{Nash Equilibrium of the Original Game}

Consider the original game without cheating. Each player adopts a threshold strategy: keep the first throw if it is at least $t$, otherwise reroll.

Let $Y$ denote the opponent's final score and define the CDF
\[
F_Y(y) = \mathbb P(Y \le y).
\]

\subsection*{Distribution of $Y$}

If $0 \le y \le t$, the opponent must have rerolled, hence
\[
F_Y(y) = \mathbb P(Y_2 \le y)\mathbb P(Y_1 \le t) = ty.
\]

If $t \le y \le 1$, either the first throw is kept or rerolled:
\[
F_Y(y) = y(1+t) - t.
\]

Thus,
\[
F_Y(y)=
\begin{cases}
ty, & 0 \le y \le t, \\
y(1+t)-t, & t \le y \le 1.
\end{cases}
\]

\subsection*{Expected Value}

Using the tail-integral formula,
\[
\mathbb E[Y] = \int_0^1 (1-F_Y(y))\,dy
= \frac12 + \frac{t}{2} - \frac{t^2}{2}.
\]

\subsection*{Indifference Condition}

At equilibrium, keeping or rerolling at $x=t$ must give the same win probability:
\[
t^2 = 1-\mathbb E[Y].
\]
This yields
\[
t^2 + t - 1 = 0,
\quad
t=\frac{\sqrt5-1}{2}\approx0.618.
\]

\section{Cheating Player's Optimal Strategy}

The cheating player (Spears) observes whether $J_1 \ge c$ with
\[
c=\frac{\sqrt5-1}{2}.
\]

\subsection*{Case 1: $J_1<c$}

Java must reroll, so her final score is uniform on $[0,1]$. Spears compares:
\begin{itemize}
\item Keep $s$: win probability $=s$,
\item Reroll: win probability $=\frac12$.
\end{itemize}
Thus,
\[
t_0=\frac12.
\]

\subsection*{Case 2: $J_1\ge c$}

Java keeps her first throw, hence $J\sim U[c,1]$. The CDF is
\[
F(x)=
\begin{cases}
0, & x<c, \\
\dfrac{x-c}{1-c}, & x\ge c.
\end{cases}
\]

The reroll win probability is
\[
\int_0^1 F(u)\,du=\frac{1-c}{2}.
\]

Indifference gives
\[
\frac{s-c}{1-c}=\frac{1-c}{2}
\quad\Rightarrow\quad
t_1=c+\frac{(1-c)^2}{2}\approx0.690983.
\]

\section{Java-lin's Optimal Counter-Strategy}

Focus on the branch $J_1<c$, where Spears uses $t_0=\frac12$.

\subsection*{Spears' Final Distribution}

\[
H_{0.5}(x)=
\begin{cases}
0.5x, & x<0.5, \\
1.5x-0.5, & x\ge0.5.
\end{cases}
\]

\subsection*{Reroll Win Probability}

\[
\mathbb P(\text{reroll wins})
= \int_0^1 H_{0.5}(u)\,du
= \frac38.
\]

\subsection*{Indifference Condition}

Let $a_0$ be Java's threshold in this branch. Indifference requires
\[
H_{0.5}(a_0)=\frac38.
\]
Since $a_0>0.5$,
\[
1.5a_0-0.5=\frac38
\quad\Rightarrow\quad
a_0=\frac{7}{12}.
\]

\section{Final Winning Probability}

Partition $J_1\in[0,1]$:

\subsection*{A. $J_1\in[0,\frac{7}{12})$}
Java rerolls:
\[
I_1=\frac38\cdot\frac{7}{12}.
\]

\subsection*{B. $J_1\in[\frac{7}{12},c)$}
Java keeps:
\[
I_2=\int_{7/12}^{c}\left(\frac32 j-\frac12\right)dj.
\]

\subsection*{C. $J_1\in[c,1]$}
Spears uses $t_1$:
\[
I_3=\int_c^{t_1} t_1 j\,dj
+\int_{t_1}^1\big((1+t_1)j-t_1\big)dj.
\]

\subsection*{Final Result}

\[
\mathbb P(\text{Java wins})
= I_1+I_2+I_3
\approx 0.4939370904.
\]

\section*{Conclusion}

\begin{center}
\boxed{ \mathbb P(\text{Java-lin wins}) \approx 49.3937\% }
\end{center}

\end{document}
