Solving and simulating a probability puzzle.