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

Home > Logic > Liars and Knights
Type Deduction II (Posted on 2012-04-23) Difficulty: 3 of 5
Ethel , Felicia and Gabrielle live on an island inhabitated by three types: the Knights, the Liars and the Weirdos.

Each is either a Knight who always tells the truth, a Liar who always lies , or a Weirdo who may do either - that is, a Weirdo chooses whether to speak truth or lie for each statement.

Ethel says : "If we all belong to the same type, then that type is the Liar."

Felicia says: "If just one of us belongs to a different type from each of the others, then that one is a Liar."

Gabrielle says : "If each of us belongs to a different type from each of the others, then I am a Liar."

Whose type can you deduce with absolute certainty?

No Solution Yet Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3

Their types are:

kwk
kwW
Wwk
wWW

where the key is given in the comments at the beginning of the program below.

So we know that Felicia is a weirdo.

' l = liar
' k = knight
' W = weirdo telling truth
' w = weirdo telling lie


CLS

typ$ = "lkWw"

FOR e = 1 TO 4
 et$ = MID$(typ$, e, 1): etl$ = LCASE$(et$)
FOR f = 1 TO 4
 ft$ = MID$(typ$, f, 1): ftl$ = LCASE$(ft$)
FOR g = 1 TO 4
 gt$ = MID$(typ$, g, 1): gtl$ = LCASE$(gt$)

 good = 1
 IF etl$ <> ftl$ OR ftl$ <> gtl$ THEN same = 0:  ELSE same = 1
 IF same = 1 AND et$ <> "l" THEN stmtTrue = 0:  ELSE stmtTrue = 1
 IF stmtTrue AND (et$ = "l" OR et$ = "w") OR stmtTrue = 0 AND (et$ = "k" OR et$ = "W") THEN good = 0

 IF (etl$ <> ftl$ OR ftl$ <> gtl$) AND (etl$ = ftl$ OR ftl$ = gtl$ OR etl$ = gtl$) THEN oneDiff = 1:  ELSE oneDiff = 0
 stmtTrue = 1
 IF oneDiff THEN
   IF etl$ = ftl$ AND gt$ <> "l" THEN stmtTrue = 0
   IF etl$ = gtl$ AND ft$ <> "l" THEN stmtTrue = 0
   IF gtl$ = ftl$ AND et$ <> "l" THEN stmtTrue = 0
 END IF
 IF stmtTrue AND (ft$ = "l" OR ft$ = "w") OR stmtTrue = 0 AND (ft$ = "k" OR ft$ = "W") THEN good = 0

 IF (etl$ <> ftl$ AND ftl$ <> gtl$ AND etl$ <> gtl$) THEN allDiff = 1:  ELSE allDiff = 0
 stmtTrue = 1
 IF allDiff THEN
   IF gt$ <> "l" THEN stmtTrue = 0
 END IF
 IF stmtTrue AND (gt$ = "l" OR gt$ = "w") OR stmtTrue = 0 AND (gt$ = "k" OR gt$ = "W") THEN good = 0

 IF good THEN PRINT et$; ft$; gt$

NEXT
NEXT
NEXT

 


  Posted by Charlie on 2012-04-23 13:13:39
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 (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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