A prison director offers 100 inmates, numbered 1-100, a chance at freedom. A room has a cupboard with 100 drawers, each containing one prisoner's number. Prisoners enter the room individually and can open 50 drawers. If all prisoners find their numbers, they are granted freedom; if not, they return to prison. They can strategize beforehand but not communicate after the first prisoner enters. What is their optimal strategy?
Read more on WikipediaEach prisoner first opens the drawer labeled with their own number. They then open the drawer labeled with the number found in the previously opened drawer. They continue this process until they either find their own number or exhaust their allowed attempts. This strategy offers a survival probability of around 30%.
The success of this strategy lies in the prisoners following a cycle in the drawers, ultimately leading to the drawer containing their number. A prisoner would fail to find their number only if it belongs to a cycle longer than their allowed attempts. The probability of such a cycle existing is approximately 70%.
Click start to run the simulation with these settings.
Try changing the simulation speed as it's running. When set to 0, the simulation will skip most drawing to the screen but run much faster.