Functionalities for logical puzzles made up of collectively self-referential questions (as in the below example):
- Logical representation
- Brute-force solution
- Automated search for a puzzle having the desired characteristics: types and nr. of questions, nr. of possible answers for each question, nr. of solutions (without validating beforehand whether it is feasible to create a puzzle with the chosen set of characteristics)
Developed in Python 3.9.1.
Many thanks to my colleague Heidi Pang, because during our free time, she inspired this project by posing the sample puzzle, co-authored with me an earlier version of this code in pair programming and, last but not least, managed to teach me something I did not know about Python. It is great to have colleagues like her, always pushing me to improve!
LOGICAL PUZZLE MADE UP BY COLLECTIVELY SELF-REFERENTIAL QUESTIONS
- The first question with B as the correct answer is:
A. 1 B. 4 C. 3 D. 2
- The answer to Question 4 is:
A. D B. A C. B D. C
- The answer to Question 1 is:
A. D B. C C. A D. B
- The number of questions which have D as the correct answer is:
A. 3 B. 2 C. 1 D. 0
- The number of questions which have B as the correct answer is:
A. 0 B. 2 C. 3 D. 1
SOLUTION(S)
--- List of all possible sequences of answers: ---
1. C, 2. D, 3. B, 4. C, 5. B
--- End of the list ---
This puzzle has exactly 1 solution.