Solution (source code)

= Solution
{c}

There are two paths from $X$ back to $X$ in two steps: $X\to X\to X$ and $X\to Y\to X$. By the <markov property>, their <probabilities> multiply along each path. Therefore
$$
\boxed{p_2=\frac12\cdot\frac12+\frac12\cdot\frac38=\frac14+\frac3{16}=\frac7{16}.}
$$