1At any point, the probability I eat a chocolate of the same type is m/n +2(n-m)/n*m/n, where m is the number of chocolates of the current type and n is3the total number of chocolates. This means that either we pick the chocolate4the first time or we don't and then we pick it the second time.56For the non-current type, the probability is ((n-m)m/n)^2, since we'd have to7pick the same type twice.89For example, if I have 9 chocolates, 7 dark and 2 milk (having just eaten a10dark), then the probability of eating a dark is 7/9 + (2/9 * (7/9)) ~= 95%.1112The probability of picking a given color after clearing the current color13(either the first choice or by picking a different color) is just m/n.1415It should be possible to programmatically generate all of the possible choices.1617There is a way to categorize all possible scenarios. The product of:1819- By number of each type (D, M) starting at (8, 2)20- By last picked type (D, M, N)2122Naively, that 81 possible states. However, the (8,2,X) state is only valid for X=N, so we can eliminate X=D and X=M.2324Now, we only care about the probability that the last chocolate we eat is milk, so the final state is anything where M=0, so we can delete all of those and have a single END state.2526We can also eliminate all states where D=0 since when that happens we know that the last chocolate we eat will be milk2728That brings the number of states to 53.2930D m D m D m D m D m D m D m D m M M3132D M L338 2 N348 1 D358 1 M368 1 N377 2 D387 2 M397 2 N407 1 D417 1 M427 1 N436 2 D446 2 M456 2 N466 1 D476 1 M486 1 N495 2 D505 2 M515 2 N525 1 D535 1 M545 1 N554 2 D564 2 M574 2 N584 1 D594 1 M604 1 N613 2 D623 2 M633 2 N643 1 D653 1 M663 1 N672 2 D682 2 M692 2 N702 1 D712 1 M722 1 N731 2 D741 2 M751 2 N761 1 D771 1 M781 1 N79END8081These nodes form a DAG, where:82 (D,M,L=D)83 (D-1,M,L=D)84 (D,M,L=N)85 (D,M,L=M)86 (D,M-1,L=M)87 (D,M,L=N)88 (D,M,L=N)89 (D-1,M,L=D)90 (D,M-1,L=M)9192Didn't follow this line of reasoning. Decided instead to brute-force the93solution. I tried a couple ways but messed up the first time (didn't print94enough digits). Figured out the problem by comparing to a second solution I95wrote.9697Let's see if we can get the proof:9899The simplest case is D=1,M=1, where you eat the first one you pick, so it's100obviously P=1/2.101102Let's look at the case where D=2,M=1.1031041/3 chance M => B1052/3 chance D106 1/2 chance D => G107 1/2 chance m108 1/2 chance D => G109 1/2 chance M => B110111So the probability of ending with M is 2/3 * (1/2+1/2*1/2) = 1/2112113So, how does this generalize?