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

Home > Logic > Liars and Knights
Who Said What? (Posted on 2007-05-17) Difficulty: 3 of 5
You are in a popular tourist town in the land of Liars and Knights. You happen to overhear a conversation another tourist is having with three of the locals: Alex, Bert and Carl. Each of the three could be a knight, a knave or a liar. You know that for each question the tourist asks, Alex, Bert and Carl each give one response, but you don't know who said what. The conversation is as follows:

  1. What type are each of you?
    • I am a knight.
    • I am a knave.
    • I am a liar.
  2. How many of you are the same type?
    • We are all the same type.
    • We are all different types.
    • Exactly two of us are the same type.
  3. What type is Alex?
    • A knave.
    • A liar.
    • Different from Bert.

Can you determine which type Alex, Bert and Carl are?

See The Solution Submitted by Brian Smith    
Rating: 4.5000 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: solution -- the computer way | Comment 3 of 8 |
(In reply to solution by Charlie)

'1=kt:2=L:3=kv,start w/lie;4=kv,start w/truth

CLS

FOR a = 1 TO 4
FOR b = 1 TO 4
FOR c = 1 TO 4
 REDIM tct(4)
 tct(a) = tct(a) + 1
 tct(b) = tct(b) + 1
 tct(c) = tct(c) + 1
 good = 0
 IF tct(1) = 1 AND tct(3) = 1 AND (tct(2) = 1 OR tct(4) = 1) THEN good = 1
 IF tct(2) = 2 AND tct(3) = 1 THEN good = 1
 IF tct(2) = 1 AND tct(3) = 1 AND tct(4) = 1 THEN good = 1
 IF tct(3) = 2 AND (tct(2) = 1 OR tct(4) = 1) THEN good = 1
 IF good THEN
  PRINT a; b; c;
  trct = 0
  IF a = 1 OR a = 3 THEN trct = trct + 1
  IF b = 1 OR b = 3 THEN trct = trct + 1
  IF c = 1 OR c = 3 THEN trct = trct + 1
  IF trct = 1 THEN
    PRINT " *"
    trct1 = 0
    IF a = 1 OR a = 4 THEN trct1 = trct1 + 1
    IF b = 1 OR b = 4 THEN trct1 = trct1 + 1
    IF c = 1 OR c = 4 THEN trct1 = trct1 + 1
    trct2 = 0
    IF a >= 3 THEN trct2 = trct2 + 1
    IF a = 2 THEN trct2 = trct2 + 1
    IF a = 1 AND b <> 1 OR a = 2 AND b <> 2 OR (a = 3 OR a = 4) AND b <> 3 AND b <> 4 THEN trct2 = trct2 + 1
    IF trct1 = trct2 THEN
      PRINT a; b; c; "*****"
    END IF
  ELSE
    PRINT
  END IF
 END IF
NEXT
NEXT
NEXT

1  2  3
1  3  2
1  3  4
1  4  3
2  1  3
2  2  3  *
2  3  1
2  3  2  *
2  3  3
2  3  4  *
2  4  3  *
3  1  2
3  1  4
3  2  1
3  2  2  *
3  2  3
3  2  4  *
3  3  2
3  3  4
3  4  1
3  4  2  *
3  4  2 *****
3  4  3
4  1  3
4  2  3  *
4  3  1
4  3  2  *
4  3  2 *****
4  3  3

  Posted by Charlie on 2007-05-17 15:39: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 (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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