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

Home > Logic > Liars and Knights
The Rebel III (Posted on 2010-01-05) Difficulty: 3 of 5
In planet Realmamber, the inhabitants are either Knights, who always speak truthfully; Liars, who always speak falsely; Knaves, who make statements that are alternately true and false, but in which order is unknown; or those few Rebels who do not abide by the planet's traditions.

How truthful a Rebel's statements are is unknown, except that they are not the same as those who are Knights, Liars, or Knaves. Thus, a rebel will never make just one or two statements; he will always make three or more.

A, B, C and D are four inhabitants of the planet, who are busy in a conversation when a visitor from a neighboring planet stops by and asks each of them their identity. They say:


Inhabitant A:
  1. My statements are not all truthful.
  2. We are overworked.
  3. We are all lucky to be here.
  4. We Realmamberians are favored by the gods.

Inhabitant B:
  1. I agree with A's third statement.
  2. Every time I see a visitor, I think maybe it is one of the gods, in disguise.
  3. I am doing more than my share of the work.
  4. My statements are all truthful.

Inhabitant C:
  1. My statements are all truthful.
  2. D's second statement is false.
  3. The gods do not visit us in disguise.
  4. We are all overworked.

Inhabitant D:
  1. C's first statement is truthful.
  2. B's third statement is truthful.
  3. My statements are all truthful.
  4. The gods frequently visit us in disguise.
Which one is the Knight, which one is the Liar, which one is the Knave, and which one is the Rebel?

See The Solution 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 2 of 4 |

FOR a1 = 1 TO 1
FOR a2 = 0 TO 1
FOR a3 = 0 TO 1
FOR a4 = 0 TO 1
IF a2 + a3 + a4 < 3 THEN
  FOR b1 = a3 TO a3
  FOR b2 = 0 TO 1
  FOR b3 = 0 TO 1
  FOR b4 = 0 TO 1
  IF b4 = 0 OR b1 + b2 + b3 = 3 THEN
    FOR c1 = 0 TO 1
    FOR c2 = 0 TO 1
    FOR c3 = 0 TO 1
    FOR c4 = a2 TO a2  ' 0 TO 1
    IF c1 = 0 OR c2 + c3 + c4 = 3 THEN
      FOR d1 = c1 TO c1
      FOR d2 = 1 - c2 TO 1 - c2
      FOR d3 = 0 TO 1
      FOR d4 = 1 - c3 TO 1 - c3
      IF d3 = 0 OR d1 + d2 + d4 = 3 THEN
       IF d2 = b3 THEN
          kt = 0: li = 0: kv = 0: rb = 0
          IF a1 + a2 + a3 + a4 = 4 THEN kt = kt + 1: ad = 1:  ELSE ad = 0
          IF b1 + b2 + b3 + b4 = 4 THEN kt = kt + 1: bd = 1:  ELSE bd = 0
          IF c1 + c2 + c3 + c4 = 4 THEN kt = kt + 1: cd = 1:  ELSE cd = 0
          IF d1 + d2 + d3 + d4 = 4 THEN kt = kt + 1: dd = 1:  ELSE dd = 0
          IF a1 + a2 + a3 + a4 = 0 THEN li = li + 1: ad = 1
          IF b1 + b2 + b3 + b4 = 0 THEN li = li + 1: bd = 1
          IF c1 + c2 + c3 + c4 = 0 THEN li = li + 1: cd = 1
          IF d1 + d2 + d3 + d4 = 0 THEN li = li + 1: dd = 1
          IF a1 + a2 = 1 AND a2 + a3 = 1 AND a3 + a4 = 1 THEN kv = kv + 1: ad = 1
          IF b1 + b2 = 1 AND b2 + b3 = 1 AND b3 + b4 = 1 THEN kv = kv + 1: bd = 1
          IF c1 + c2 = 1 AND c2 + c3 = 1 AND c3 + c4 = 1 THEN kv = kv + 1: cd = 1
          IF d1 + d2 = 1 AND d2 + d3 = 1 AND d3 + d4 = 1 THEN kv = kv + 1: dd = 1
          IF ad = 0 THEN rb = rb + 1
          IF bd = 0 THEN rb = rb + 1
          IF cd = 0 THEN rb = rb + 1
          IF dd = 0 THEN rb = rb + 1
          IF kt = 1 AND li = 1 AND kv = 1 AND rb = 1 THEN
           PRINT a1; a2; a3; a4, b1; b2; b3; b4, c1; c2; c3; c4, d1; d2; d3; d4
           solCt = solCt + 1
          END IF
       END IF
      END IF
      NEXT
      NEXT
      NEXT
      NEXT
    END IF
    NEXT
    NEXT
    NEXT
    NEXT
  END IF
  NEXT
  NEXT
  NEXT
  NEXT
END IF
NEXT
NEXT
NEXT
NEXT
PRINT solCt

finds

1  0  1  1    1  1  1  1    0  0  0  0    0  1  0  1

which represent the truth value of the statements in order with 1=true and 0=false.

That means A, B, C and D are Rebel, Knight, Liar and Knave in that order.


  Posted by Charlie on 2010-01-05 12:56:38
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