The Guards of Heaven and Hell
mediumlogicpuzzle
Two guards keep two doors: one guards the door to Heaven, the other the door to Hell (this one-to-one mapping is given as door_map). One guard always lies, the other always tells the truth. They answer only Blah or Mlah — one of these words means yes and the other means no, but you don't know which (this one-to-one mapping is given as response_map).
You may ask one yes/no question to one guard.
Your tasks:
- Define
question— the truth value of the question you ask, from the perspective of an honest person (the liar's inversion is applied afterwards byresponse). It takes all the information the guard knows (it may depend on the guard you ask, on their language and doors). Example: Does your door leads to Heaven? question corresponds todoor_map guard_whom_you_ask = .Heaven. - Define
deduce— deduce which door is kept by guard who responded to your question. It takes all the information you know: not the guard's type, notresponse_map, notdoor_map. - Prove
question_exists: your question always works — for every guard, every meaning ofBlah/Mlah, and every arrangement of the doors.
Loading editor...