Solution (source code)

= Solution

Write $N=g+r$. Successive <conditional probabilities> account for the changing bag under <sampling without replacement>:
$$
\boxed{\mathbb P(GGG)=\frac gN\frac{g-1}{N-1}\frac{g-2}{N-2}}.
$$
On this event no equality of the two colour counts has occurred, so the game's stopping rule does not interrupt these three draws.