Solution (source code)

= Solution

For the last chocolate to be taken on choice $n$, the first $n-1$ choices must include exactly $C-1$ chocolate choices, and choice $n$ must take chocolate. Before that final success there is still chocolate available, so no forced plain choice has yet occurred. The <negative binomial stopping argument> gives
$$
\boxed{P_{\rm LastChoc,n}=\binom{n-1}{C-1}p^C(1-p)^{n-C},\qquad C\leq n\leq F.}
$$
This is the all-trials convention of the <negative binomial distribution>. The finite examination scenario also has a remaining probability that the tray still contains chocolate after all $F$ choices; the displayed probabilities need not sum to one over $C\leq n\leq F$. At $p=0$ the last chocolate is never taken, and at $p=1$ it is taken on choice $C$.