Deciphering the Door Code

From TheKolWiki
Jump to: navigation, search

This is the method for finding the solution to the "logic puzzle" in the Naughty Sorceress Quest.

Here's the situation:
You are presented with four guards: one who always lies, one who always speaks truth, one who sometimes lies and sometimes tells the truth and one who craves human flesh. They know the code to a nearby door - 3 digits, each 0 through 9 - and you want to decipher it with as few failures as possible (each failure deals you 50 damage). The four guards are labelled "North", "South", "East" and "West". This is an example problem/solution, and it is suitable in that the logic remains unchanged, even though the numbers and positions change.


Guardtable.gif

As you approach the door, you notice that someone has scrawled a message on it with a pencil: "BEWARE: One of the guards always tells the truth, one of them always lies, one of them alternates between the two, and one craves the taste of human flesh!" Ominous.

Hesitantly, you push the door open and enter a small room. You find four guards seated at a round table, playing bridge. You grab your weapon and prepare for a fight, but they just look up at you and nod amicably. "Hello," says the guard playing North.

"Er, hi," you say. "Um, don't mind me, I was just passing through."

The guard playing South says, "I suppose you want the combination to the other door, then? I'm getting really tired of people asking about that."

"He's lying," says North.

"No," says East, "you're the one lying."

"Graaaaagh," says West.

"Great," you sigh. "What's the code, then?"

"Well," says South, "the first digit is 3."

"No it isn't," says East. "It's 8."

North shakes his head. "They're both lying -- it's 9."

"The second digit now -- that's 4," says South.

"Graaaaagh," says West.

"It's 1, in fact," says North.

East grumbles, "It's definitely more than that."

"Sorry, I meant to say 6," replies North. "And the last digit is 5."

"Don't listen to him," says East. "It's 2."

"No, it is 5, I'm sure of it," says South.

"Graaaaagh," says West.

You roll your eyes. "Great. Thanks a lot, guys."


Full Logic

The guard playing South says, "I suppose you want the combination to the other door, then? I'm getting really tired of people asking about that."

"He's lying," says North.

"No," says East, "you're the one lying."

This line always comes up. In this example, either both South and East are lying, or they're both telling the truth. Either way, it means one of them is the flip-flopper, and, more importantly, that North is always telling the truth or always lying.


Looking at the last digit... (North) "And the last digit is 5."

"Don't listen to him," says East. "It's 2."

"No, it is 5, I'm sure of it," says South.

Now, North and South are in agreement. Using the logic of last time, we can say certainly that East is not the flip-flopper, forcing South to be that role.


Now that we know that, let's pretend South is telling the truth. That would make East the one who always lies (hypothetically), and North the one who always tells the truth.

"The second digit now -- that's 4," says South.

"It's 1, in fact," says North.

East grumbles, "It's definitely more than that."

"Sorry, I meant to say 6," replies North.

See the problem? If East was lying, then neither 4 nor 6 would be a viable option. It's not fair to assume that the second line automatically makes North the liar, because people make mistakes, and have brain farts (and the puzzle isn't set up to automatically make him the liar). It is fair to assume, however, that the full code does appear in the puzzle. East is not the liar - East is the one telling the truth. And North is the liar. From there, we simply deduce the code from the clues:

"No it isn't," says East. "It's 8."
"The second digit now -- that's 4," says South.
"Don't listen to him," says East. "It's 2."


Also, regarding this conversation:

"Well," says South, "the first digit is 3."

"No it isn't," says East. "It's 8."

North shakes his head. "They're both lying -- it's 9."

This conversation is a red herring, from what I can tell - no information on lying or telling the truth can be pulled.


For example:

N - X 6 3
E - 7 4 1
S - 5 2 3
answer = 5 6 3

If the second line North says when he shakes his head is "You're full of it.", use Version #2, else use Version #1.

Version #1

This version actually has two slight variants, depending on whether East or South says (13) or (14). So read carefully.

As you approach the door, you notice that someone has scrawled a message on it with a pencil: "BEWARE: One of the guards always tells the truth, one of them always lies, one of them alternates between the two, and one craves the taste of human flesh!" Ominous.

Hesitantly, you push the door open and enter a small room. You find four guards seated at a round table, playing bridge. You grab your weapon and prepare for a fight, but they just look up at you and nod amicably. "Hello," says the guard playing North.

"Er, hi," you say. "Um, don't mind me, I was just passing through."

(1) The guard playing South says, "I suppose you want the combination to the other door, then? I'm getting really tired of people asking about that."

(2) "He's lying," says North.

(3) "No," says East, "you're the one lying."

(4) "Graaaaagh," says West.

"Great," you sigh. "What's the code, then?"

(5) "Well," says South, "the first digit is S."

(6) "No it isn't," says East. "It's T."

(7) North shakes his head. "They're both lying -- it's U."

(8) "The second digit now -- that's V," says South.

(9) "Graaaaagh," says West.

(10) "It's W, in fact," says North.

(11) East grumbles, "It's definitely more than that."

(12) "Sorry, I meant to say X," replies North. "And the last digit is Y."

(13) "Don't listen to him," says South/East. "It's Z."

(14) "No, it is Y, I'm sure of it," says East/South.

(15) "Graaaaagh," says West.

You roll your eyes. "Great. Thanks a lot, guys." Now, here's the solution to the puzzle.

First, notice that North contradicts himself in (10) and (12). Hence, North can't be the truth-teller. Now, suppose North is the alternator. Then either (2) or (7) is true. But (7) contradicts both (5) and (6), and one of those has to be true, since one of South or East has to be the truth-teller. Similarly, (2) contradicts (1) and (3), so it can't be true either. Hence North can't be the alternator either, so he must be the liar.

Now, notice that if North is the liar, then (12) must be false, so (14) is also false, so the person who says it must be the alternator. And thus the person who says (13) is the truth-teller.

So, if South says (13), South is the truth-teller and the code is SVZ, while if East says (13), then he is the truth-teller and the code is TVY.


Version #2

(1) The guard playing South says, "I suppose you want the combination to the other door, then? I'm getting really tired of people asking about that."

(2) "He's lying," says North.

(3) "No," says East, "you're the one lying."

(4) "Graaaaagh," says West.

"Great," you sigh. "What's the code, then?"

(5) "Well," says South, "the first digit is T."

(6) "No it isn't," says East. "It's U."

(7) North shakes his head. "You're full of it."

(8) "Don't interrupt. The second digit now -- that's V," says East.

(9) "Graaaaagh," says West.

(10) "It's W, in fact," South.

(11) North grumbles, "It's definitely more than that -- it's X."

(12) "And the last digit is Y," says South, ignoring North.

(13) "Don't listen to him," says East. "It's Z."

(14) "No, it is Y, I'm sure of it," says North.

(15) "Graaaaagh," says West.

You roll your eyes. "Great. Thanks a lot, guys."

This variant is trickier, since you don't get any easy starts.

Suppose East is the truth-teller. Now, in that case, either South or North is the alternator, which means that at least one of (10), (12), (11), or (14) is true. But notice that East contradicts all of those statements -- if (8) is true, then neither (10) or (11) is true, and if (13) is true, then neither (12) nor (14) is true. So East cannot be the truth-teller.

Now, suppose that East is the alternator. Notice that North and South agree with each other in (12) and (14). But this is not possible if East is the alternator, since one of them must be the truth-teller and one must be the liar. So East cannot be the alternator either, so East must be the liar.

If East is the liar, then (2) must be true, which means that (1) must be false, so South is the alternator and North is the truth-teller. Thus, the answer must be TXY.

External Links

Alternatively, you could go to an automatic door code solver: