This week the question is: How Many Rabbits Can You Pull out of a Hat?
I have a hat with six small toy rabbits: two are orange, two are green, and two purple. I shuffle the rabbits around and randomly draw them out one at a time without replacement (i.e., once I draw a rabbit out, I never put it back in again).
Your job is to guess the color of each rabbit I draw out. For each guess, you know the history of the rabbits I’ve already drawn. So if we’re down to the final rabbit in the hat, you should be able to predict its color with certainty.
Every time you correctly predict the color of the rabbit I draw, you earn a point. If you play optimally (i.e., to maximize how many points you get), how many points can you expect to earn on average?
And for extra credit:
Now, instead of two rabbits of each of the three colors, my hat contains 10. That is, it contains 10 orange rabbits, 10 green rabbits, and 10 purple rabbits. As before, every time you correctly predict the color of the rabbit I draw, you earn a point.
With optimal play, how many points can you expect to earn on average?

This was the 2nd attempt. Scroll down to find the weird 1st attempt.
If there’s only 1 rabbit left, I guess it correctly and get 1 point.
If there’s more than 1 rabbit left, I probably have to look at some cases. My guess has to be a color with the most rabbits left. The situation a orange rabbits, b green rabbits and c purple rabbits are already out AND the points related to that situation is denoted as [a][b][c]. Let’s look at the example [0][0][1].
- There are 5 rabbits left.
- My guess will be for orange, as that is a color with 2 rabbits left, the most possible.
- There’s p = 2/5 that the rabbit is actually orange.
- In that situation I get 1 point now and [1][0][1] later.
- There’s p = 2/5 that the rabbit is green.
- In that situation I get 0 points now and [0][1][1] later.
- There’s p = 1/5 that the rabbit is purple.
- In that situation I get 0 points now and [0][0][2] later.
- This means my expected points for this situation is
- 2/5 * (1 + [1][0][1]) +
- 2/5 * (0 + [0][1][1]) +
- 1/5 * (0 + [0][0][2])
- I can’t calculate this sum until I have all the numbers.
This means it’s time for recursion! I build a program to handle all this, and get the result 3.3666666666667. I also do the calculation by hand and get 3 11/30.
And for extra credit:
I change a parameter in the program and run it again. The result is 13.703132371085.
1st attempt.
I’m not quite sure how I figured this. But I sort of said, that I could choose the rabbit color that gave me most points. For the fiddler, I actually got the correct number! But for extra credit, my number was too high, 15.367336492712. Well. I was on vacation. Too little time, too little brain power.