Logic Puzzle

Logic problem given to students of ElectricalEngineering? and ComputerScience:

An explorer in the jungle finds the lost city of Cigol, fabled to hold riches beyond the dreams of Solomon. It is guarded by two immortal sentinels whose assignment is to ensure that no mortal leaves without attempting entry.

The legend is that one of these sentinels always tells the truth, while the other always lies. The aspirant is allowed a single question. He may ask either sentinel, and that sentinel will answer. Based on this answer, the pilgrim must enter one of two doors.

Behind one door is a family of tigers, also immortal, and hungry for eternity. Not surprisingly, they will devour any who venture through their door.

Behind the other door lies wealth beyond imagining. Whoever shall enter there may take with him all that he can carry, and he shall be protected throughout his journey home.

Given that our explorer has reached the lost city, and given that he will not be allowed to leave without entering one of the doors into it, what single question can he ask, of only one sentinel, that will assure that he obtains the treasure and returns safely home?

Explain your answer.

And, yes, I used to give this to my computer language students, in the same week as the PeanutButterSandwich exercise.

-- GarryHamilton

The usual answers to the above involve a "conditional" question of the form "if I ask Q, would the answer be "Yes"?", so for greater kudos, find a direct question (one not using the word "if" or a synonym thereof) which solves the problem, given that sentinel #1 is standing in front of door #1 and sentinel #2 is standing in front of door #2.

"Which door does the other sentinel claim holds the treasure?" This is the wrong door. The other sentinel makes no claim unless asked, so that question needs to be reworded using "if" (or a synonym), and is then equivalent to the question suggested lower down this page.

Clearly, the question asked must mention the treasure. In all variants, it is assumed each sentinel knows which door leads to the treasure, etc.


Humor

Variant, along with spoiler:

You're lost in a jungle, which somewhere contains a village with two kinds of people, one who always tell the truth, and one who always lie. You come to a fork in a path and meet both a Liar and a Truthteller.

Problem: with only a single question, determine which native is which, and also how to get to the village.

Solution: Say "hey guys, did you hear they're giving out free beer in the village?" The Liar will say "yes", the Truthteller will say "no", and they'll both run down the correct path to the village. QED.

-- DougMerritt


Samurai Jack had a variant on this puzzle. Same two-pronged setup, and Samurai Jack gave the same answer. . . Afterwards the guards try to eat him, mentioning to each other "too bad we both lie"

-- LayneThomas

But if they both lie, then they mean they're both telling the truth... but then...... popFizZzt...

Not really - they may have lied earlier when they said they *always* do something - They might only lie some of the time (like saying they always lie). Or the real lie may have been "it's too bad" (when obviously it wasn't bad for them)"

It's like the old genie/satan paradox. They may follow the letter, but not the spirit. The genie/satan still has a choice as to how they want to interpret words.


Ask one sentinel "which door will the other sentinel tell me leads to treasure" -- RonJandrasi

For that answer to work, it needs to be reworded to include the reason why the other sentinel says anything. This rewording produces something like "if I ask the other sentinel such-and-such, what will he reply?" Hence, the original puzzle can be solved this way, but not the variant which requires a direct question.

AhHa! I could also ask one sentinel what door he will tell me leads to treasure... but this is also an indirect question... only involves one sentinel though. -- Ron p.s. I liked your bit on "WhySympathizeWithTheUnemployed" Garry. my skills seem to have mysteriously disappeared for the moment...

Correct.

That has the same indirection... it's not a direct question: "If I asked you which door leads to treasure, which one will you tell me?"

Ron had stated it was indirect, but it correctly deals with the original puzzle and also the variant below.

But not the kudos puzzle requiring a direct question... watch your wording next time :p


Ask either sentinel, "Is the liar guarding the Treasure door?". -- GregBurns

It's easier to ask, "Is the Truthteller guarding the Treasure door?"

Whoever answers "Yes" is guarding the Treasure door, whoever answers "No" is not guarding the Treasure door. You can therefore act as if you asked "Are you guarding the Treasure door."

However, correct answer, hence much kudos.


Variant - there is a sentinel who always either tells the truth or always lies. Now what single question do you ask?

Imagining that there is a door on the left and another door on the right, you ask the sentinel, "If you gave the opposite answer to that which you would normally give, would you say that the door on the left leads to the treasure?". If the sentinel says "Yes", the door on the right leads to the treasure. If the sentinel says "No", the left door leads to the treasure. You can obviously substitute left for right in the answer and it will also work. -- GregBurns

There's no point in referring to the opposite answer - the normal answer suffices (ie., ask "what would you reply if asked whether the left door leads to the treasure?"). -- vk

Some consider that the question about the lawyers buried up to their necks in sand (LogicPuzzleTwo) is better.


CategoryLogic


EditText of this page (last edited August 31, 2006) or FindPage with title or text search