Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavel-durov/prisoners-riddle
Prisoner riddle solution
https://github.com/pavel-durov/prisoners-riddle
Last synced: 19 days ago
JSON representation
Prisoner riddle solution
- Host: GitHub
- URL: https://github.com/pavel-durov/prisoners-riddle
- Owner: Pavel-Durov
- Created: 2019-02-24T09:23:39.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-24T09:43:22.000Z (almost 6 years ago)
- Last Synced: 2024-12-06T21:32:46.919Z (30 days ago)
- Language: Python
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/Pavel-Durov/prisoners-riddle.svg?branch=master)](https://travis-ci.org/Pavel-Durov/prisoners-riddle)
# Prisoners riddle### The riddle
10 prisoners are in circle-shape prison.
Each prisoner can see the rest 9 prisoners.
Each prisoner receives a number between 1-10 (there is a possibility that one, two or more will have the same number).
The number of each prisoner is hanged above the cell, in a way that each prisoner cannot see the number of itself but can see all other prisoners numbers…
Each prisoner can guess his number, if at least one prisoner guesses right - all prisoners will be free.Prisoners are allowed to establish a strategy before they enter the cells, but once they are in and get the numbers - they cannot communicate.
Question:
What strategy prisoners can take in order to ensure that at least one of them will guess his number for sure?
## Tests:Running tests:
```
python -m unittest discover -s ./test -p "*_test.py"
```