All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic > Liars and Knights
Pages and Squires (Posted on 2007-02-13) Difficulty: 5 of 5
The famous Singapore Detective, Nguyen Bao, was on vacation in the remote country of Proth. Proth is a country where the population follows the rules of Knights, Knaves, Liars, Squires and Pages. Knights always tell the truth. Knaves strictly alternate between truths and lies. Liars always lie. Squires, trying to impress people, copy the last person who made a statement, by following that personís lie with a lie, or that personís truth with a truth. Pages, trying to irritate people, do the opposite of the last person who made a statement, by following that personís truth with a lie, or their lie with a truth.

As it turned out, while enjoying his vacation, Detective Nguyen was asked to give his insights into a local crime. Sometime the previous evening, the Magistrateís Custard Pudding had disappeared. There were five people who had access to the Pudding. One or more of them could have perpetrated the crime, but the local police were baffled and were unable to crack the case.

Prior to questioning the suspects, Detective Nguyen asked the constable to have the five suspects assembled into an interrogation room. Realizing that he could not trust the constable to provide any truthful insight into the case, Detective Nguyen entered the room alone, and took a seat.

Hoping to find a suspect who would help, Detective Nguyen asked, "Who here is a Squire?"

A: "B is not a Squire."
B: "C is not a Squire."
C: "E is not a Squire."
D: "A is not a Squire."
E: "D is not a Squire."

Seeing a possible flaw with his tactic, Detective Nguyen then asked, "Who here is a Knight?"

B: "I am a Knight."
E: "I am a Knight."
C: "I am a Knight."
A: "I am a Knight."
D: "I am a Knight."

With a sense of frustration, Detective Nguyen quickly asked, "Who stole the Custard?"

C: "I didnít do it."
B: "I didnít do it."
D: "I didnít do it."
A: "I didnít do it."
E: "I didnít do it."

Detective Nguyen took a breath. After a brief pause he asked, "How many of you were involved?"

D: "Only one of us did it."
A: "Only two of us did it."
C: "Only three of us did it."
E: "Only four of us did it."
B: "All of us did it."

Thinking to himself that perhaps there was a chance to solve this, Detective Nguyen asked, "Who did it?"

E: "B did it."
B: "D did it."
D: "A did it."
C: "E did it."
A: "C did it."

Standing up, Detective Nguyen left the room and made his report to the Magistrate.

What trait did each suspect exhibit, and who ate the pudding?

See The Solution Submitted by Leming    
Rating: 4.3333 (9 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 7 |
A through E are as follows, where a 0 indicates innocent and 1 indicates guilty:

knight 0
knaveT1 0
liar 1
page 1
squire 0

(knaveT1 indicates a knave telling the truth on the first round.

The program:

DECLARE FUNCTION test! (tVal!, tpe!)
' types: 1=Kt,2=Kv(start true),3=Kv(start false),4=L,5=Sq,6=Pg

CLS
DIM SHARED round, truth, pTruth, tp$(6)
DATA knight,knaveT1,knaveF1,liar,squire,page
FOR i = 1 TO 6: READ tp$(i): NEXT

FOR at = 1 TO 6
FOR ag = 0 TO 1

FOR bt = 1 TO 6
FOR bg = 0 TO 1

FOR ct = 1 TO 6
FOR cg = 0 TO 1

FOR dt = 1 TO 6
FOR dg = 0 TO 1

FOR et = 1 TO 6
FOR eg = 0 TO 1

round = 1
perpCt = ABS(ag + bg + cg + dg + eg)
IF bt = 5 THEN truth = 0:  ELSE truth = -1
IF (at = 1 OR at = 2) = truth OR at > 4 THEN

IF test(ct <> 5, bt) THEN
IF test(et <> 5, ct) THEN
IF test(at <> 5, dt) THEN
IF test(dt <> 5, et) THEN
  round = round + 1

IF test(bt = 1, bt) THEN
IF test(et = 1, et) THEN
IF test(ct = 1, ct) THEN
IF test(at = 1, at) THEN
IF test(dt = 1, dt) THEN
  round = round + 1

IF test(cg <> 1, ct) THEN
IF test(bg <> 1, bt) THEN
IF test(dg <> 1, dt) THEN
IF test(ag <> 1, at) THEN
IF test(eg <> 1, et) THEN
  round = round + 1

IF test(perpCt = 1, dt) THEN
IF test(perpCt = 2, at) THEN
IF test(perpCt = 3, ct) THEN
IF test(perpCt = 4, et) THEN
IF test(perpCt = 5, bt) THEN
  round = round + 1

IF test(bg = 1, et) THEN
IF test(dg = 1, bt) THEN
IF test(ag = 1, dt) THEN
IF test(eg = 1, ct) THEN
IF test(cg = 1, at) THEN
  round = round + 1
PRINT "x"
PRINT tp$(at); ag
PRINT tp$(bt); bg
PRINT tp$(ct); cg
PRINT tp$(dt); dg
PRINT tp$(et); eg



END IF
END IF
END IF
END IF
END IF

END IF
END IF
END IF
END IF
END IF

END IF
END IF
END IF
END IF
END IF

END IF
END IF
END IF
END IF
END IF

END IF
END IF
END IF
END IF

END IF

NEXT eg
NEXT et

NEXT dg
NEXT dt

NEXT cg
NEXT ct

NEXT bg
NEXT bt

NEXT ag
NEXT at

FUNCTION test (tVal, tpe)
 pTruth = truth
' types: 1=Kt,2=Kv(start true),3=Kv(start false),4=L,5=Sq,6=Pg
 SELECT CASE tpe
  CASE 1
   t = tVal
  CASE 4
   t = NOT tVal
  CASE 2
   IF round MOD 2 = 1 AND tVal OR round MOD 2 = 0 AND NOT tVal THEN
      t = -1
   ELSE
      t = 0
   END IF
  CASE 3
   IF round MOD 2 = 0 AND tVal OR round MOD 2 = 1 AND NOT tVal THEN
      t = -1
   ELSE
      t = 0
   END IF
  CASE 5
   IF tVal = pTruth THEN t = -1:  ELSE t = 0
  CASE 6
   IF tVal <> pTruth THEN t = -1:  ELSE t = 0
 END SELECT
 truth = tVal
 test = t
END FUNCTION

... and the speaker and value of each question, in order:

knight telling truth.
knaveT1 telling truth.
liar lying.
page telling truth.
squire telling truth.

knaveT1 lying.
squire lying.
liar lying.
knight telling truth.
page lying.

liar lying.
knaveT1 telling truth.
page lying.
knight telling truth.
squire telling truth.

page lying.
knight telling truth.
liar lying.
squire lying.
knaveT1 lying.

squire lying.
knaveT1 telling truth.
page lying.
liar lying.
knight telling truth.

  Posted by Charlie on 2007-02-13 17:12:20
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information