This week the #puzzle is: Can You Cheat on the Quiz? #probabilities #statistics #montecarlo #coding

Solution, possibly incorrect:
Ehm. Yes. I think part of the solution is to look at a diagram of how the states change.
At any given point in the quiz, gi is a guess and ai is the correct answer to the question qi. I can choose the dashed strategy, which is to guess the same again, or I can guess something else.
At q1, Charlie knows a1 and therefore must guess g1 = a1, that is the best strategy. So now Charlie’s in the green bubble on the left, and he knows it. Therefore the best strategy for q2 is not the dashed “choose the same again” strategy. With p = 1/3 he happens to guess the right answer and ends up in a new green bubble. With p = 2/3 he doesn’t and ends up in a red bubble. He doesn’t know which one happened, so for the next step of the strategy, his choices are “guess the same again” or “don’t guess the same again”.
Hang on. Let’s just simplify that diagram.
Nice symmetry, if you don’t use the dashed lines, regardless of whether Charlie guessed right or wrong, there’s p = 1/3 of guessing correctly the next time.
Charlie’s strategy should begin with “g1 = a1, g2 ≠ g1“. But then what?
There are 4 choices:
- g3 ≠ g2, g4 ≠ g3
- g3 ≠ g2, g4 = g3
- g3 = g2, g4 ≠ g3
- g3 = g2, g4 = g3
And there are these possible outcomes:
- True True True True
- True True True False
- True True False True
- True True False False
- True False True True
- True False True False
- True False False True
- True False False False
Any strategy leads to this for 1st 2 questions:
- True True, p = 1/3
- True False, p = 2/3
Strategy 1 leads to this for the 1st 3 questions:
- True True True, p = 1/3 * 1/3
- True True False, p = 1/3 * 2/3
- True False True, p = 2/3 * 2/3
- True False False, p = 2/3 * 2/3
And:
- True True True True, p = 1/3 * 1/3 * 1/3 = 1/27
- True True True False, p = 1/3 * 1/3 * 2/3 = 2/27
- True True False True, p = 1/3 * 2/3 * 1/3 = 2/27
- True True False False, p = 1/3 * 2/3 * 2/3 = 4/27
- True False True True, p = 2/3 * 1/3 * 1/3 = 2/27
- True False True False, p = 2/3 * 1/3 * 2/3 = 4/27
- True False False True, p = 2/3 * 2/3 * 1/3 = 4/27
- True False False False, p = 2/3 * 2/3 * 2/3 = 8/27
For this the expected value is:
Let’s try strategy 2, first different, then same. So the 3rd step looks the same.
- True True True, p = 1/3 * 1/3
- True True False, p = 1/3 * 2/3
- True False True, p = 2/3 * 2/3
- True False False, p = 2/3 * 2/3
And then we get something new for the 4th step:
- True True True True, p = 1/3 * 1/3 * 0 = 0/27
- True True True False, p = 1/3 * 1/3 * 1 = 3/27
- True True False True, p = 1/3 * 2/3 * 1/3 = 2/27
- True True False False, p = 1/3 * 2/3 * 2/3 = 4/27
- True False True True, p = 2/3 * 1/3 * 0 = 0/27
- True False True False, p = 2/3 * 1/3 * 1 = 6/27
- True False False True, p = 2/3 * 2/3 * 1/3 = 4/27
- True False False False, p = 2/3 * 2/3 * 2/3 = 8/27
For this the expected value is:
So far strategy 1 beats strategy 2.
Doing something similar leads to these expected values for strategy 3:
- True True True True, p = 1/3 * 0 * 1/3 = 0/27
- True True True False, p = 1/3 * 0 * 2/3 = 0/27
- True True False True, p = 1/3 * 1 * 1/3 = 3/27
- True True False False, p = 1/3 * 1 * 2/3 = 6/27
- True False True True, p = 2/3 * 1/3 * 1/3 = 2/27
- True False True False, p = 2/3 * 1/3 * 2/3 = 4/27
- True False False True, p = 2/3 * 2/3 * 1/3 = 4/27
- True False False False, p = 2/3 * 2/3 * 2/3 = 8/27
For this the expected value is:
And strategy 4:
- True True True True, p = 1/3 * 0 * 0 = 0/27
- True True True False, p = 1/3 * 0 * 1 = 0/27
- True True False True, p = 1/3 * 1 * 1/3 = 3/27
- True True False False, p = 1/3 * 1 * 2/3 = 6/27
- True False True True, p = 2/3 * 1/3 * 0 = 0/27
- True False True False, p = 2/3 * 1/3 * 1 = 6/27
- True False False True, p = 2/3 * 2/3 * 1/3 = 4/27
- True False False False, p = 2/3 * 2/3 * 2/3 = 8/27
Turns out the best strategy is to never choose the same twice in a row. And with this strategy, Charlie can expect 2 correct answers. If I have done all my calculations correctly… And even modelled the problem correctly.
Okay, let me try method 2. Monte Carlo. And this one gives… Something like 1.84. I have no idea why. And I do trust my Monte Carlo more. So that will be my official answer.
Result: 1.84.
And for extra credit:
This is strictly a guess on my part. But I think the best strategy is to cheat on question 4 and then construct the rest of the guesses from that. This gives 1 correct answer in the middle and an expectation of 0.84 correct answer above and below. 2.68 correct answers in all.

