Solution (source code)

= Solution

The null value $\pi=1/2$ is interior and the model is regular. <Wilks theorem> therefore gives
$$
\boxed{W\xrightarrow{d}\chi_1^2}
$$
under the null, because the alternative adds one free parameter. An asymptotic size-$\alpha$ test rejects when
$$
\boxed{W>\chi^2_{1,1-\alpha}}.
$$