|
| 1 | +# 100 Prisoners Simulator |
| 2 | + |
| 3 | +A Python simulation of the **100 prisoners problem**, where each prisoner must find their own number hidden in one of 100 boxes. |
| 4 | +This project allows you to run multiple simulations using **custom strategies**, view success rates, and manage runs through a clean working directory system. |
| 5 | + |
| 6 | +If you have any questions or suggestions, feel free to open an issue or submit a pull request! It would make my day. 😊 |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## 🎯 Features |
| 11 | +- Run a predefined number of simulations automatically |
| 12 | +- Use **custom strategies** for box selection |
| 13 | +- Customize the number of prisoners and maximum box checks |
| 14 | +- Calculate and display: |
| 15 | + - Overall chance of success |
| 16 | +- Built-in directory management for saving results and configurations |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## 🧠 About the Project |
| 21 | +I created this simulator because I wanted a way to **easily prove the math** behind the 100 prisoners problem, and to **experiment with different strategies** that people have come up with, maybe even stumble upon a new, better one. 😉 |
| 22 | + |
| 23 | +The 100 prisoners problem is a classic probability and logic puzzle. Each prisoner may open up to half the boxes (50) to find their number. |
| 24 | +If **all** prisoners succeed, they are freed; if even one fails, they all lose. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 📺 Video explanation & best strategy |
| 29 | + |
| 30 | +A clear video explanation of the 100 prisoners problem and the best strategy so far (cycle following) can be found here: |
| 31 | +[https://youtu.be/iSNsgj1OCLA?si=Bgq4OAlChz_tSI_g](https://) |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## ⚙️ Usage |
| 36 | +1. Clone the repository |
| 37 | +2. Copy the config.py file to your working directory and configure your strategy and other parameters inside the config file |
| 38 | +3. Run the main Python file: |
| 39 | + ```bash |
| 40 | + python main.py |
| 41 | + ``` |
| 42 | +--- |
| 43 | + |
| 44 | +## 📜 License |
| 45 | + |
| 46 | +MIT License - feel free to contribute or share it. |
| 47 | + |
| 48 | +See LICENSE.md for details. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 🧩 Future Ideas |
| 53 | +- Additional statistical plots |
| 54 | + |
| 55 | +- Better GUI |
| 56 | + |
| 57 | +- Parallelized simulations for faster results (when Python ) |
0 commit comments