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

Home > Logic
Realmazure Rationale (Posted on 2009-08-02) Difficulty: 3 of 5
The inhabitants of the planet Realmazure are Knights, Pretenders, Prevaricators or Liars. All the statements by a Knight are true, a Pretender will tell precisely one true statement, a Prevaricator will tell precisely two true statements, and all the statements made by a Liar will be false.

Four inhabitants E, F, G and H of Realmazure were busy in a conversation, when a visitor from a neighboring planet stopped by and asked each of them their identity. They said:

Inhabitant E
  1. I am a Pretender
  2. Gs second statement is false.
  3. F is not a Prevaricator.
Inhabitant F
  1. H is a Liar.
  2. Gs second statement is true.
  3. Es second statement is true.
Inhabitant G
  1. Fs second statement is true.
  2. Es first statement is false.
  3. F is a Prevaricator.
Inhabitant H
  1. I am a Knight.
  2. E is a Pretender.
  3. Fs third statement is true.
Determine the type of each of the four inhabitants in terms of the above statements.

See The Solution Submitted by K Sengupta    
Rating: 3.0000 (1 votes)

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

The statements (1 = true, 0 = false):

---E---       ---F---       ---G---       ---H---
0  0  0       1  1  0       1  1  1       0  0  0
making the types:
E  F  G  H
0  2  3  0

where 0 = liar, 1 = pretender, 2 = prevaricator, 3 = knight

DECLARE SUB choose (s!)
DIM SHARED stmt(12), typ(4)

choose 1

END

SUB choose (s)
 FOR tr = -1 TO 0  ' -1 is true
   stmt(s) = tr
   SELECT CASE s
     CASE 3
      typ(1) = 0
      FOR i = 1 TO 3
        typ(1) = typ(1) + ABS(stmt(i))
      NEXT
      choose s + 1
     CASE 6
      typ(2) = 0
      FOR i = 4 TO 6
        typ(2) = typ(2) + ABS(stmt(i))
      NEXT
      choose s + 1
     CASE 9
      typ(3) = 0
      FOR i = 7 TO 9
        typ(3) = typ(3) + ABS(stmt(i))
      NEXT
      choose s + 1
     CASE 12
      typ(4) = 0
      FOR i = 10 TO 12
        typ(4) = typ(4) + ABS(stmt(i))
      NEXT
      good = 1
      FOR j = 1 TO 1
        IF stmt(1) <> (typ(1) = 1) THEN good = 0: EXIT FOR
        IF stmt(2) <> (stmt(8) = 0) THEN good = 0: EXIT FOR
        IF stmt(3) <> (typ(2) <> 2) THEN good = 0: EXIT FOR
      
        IF stmt(4) <> (typ(4) = 0) THEN good = 0: EXIT FOR
        IF stmt(5) <> (stmt(8) = -1) THEN good = 0: EXIT FOR
        IF stmt(6) <> (stmt(2) = -1) THEN good = 0: EXIT FOR

        IF stmt(7) <> (stmt(5) = -1) THEN good = 0: EXIT FOR
        IF stmt(8) <> (stmt(1) = 0) THEN good = 0: EXIT FOR
        IF stmt(9) <> (typ(2) = 2) THEN good = 0: EXIT FOR

        IF stmt(10) <> (typ(4) = 3) THEN good = 0: EXIT FOR
        IF stmt(11) <> (typ(1) = 1) THEN good = 0: EXIT FOR
        IF stmt(12) <> (stmt(6) = -1) THEN good = 0: EXIT FOR
      NEXT
      IF good THEN
        FOR j = 1 TO 12
          PRINT -stmt(j);
          IF j MOD 3 = 0 THEN PRINT "     ";
        NEXT: PRINT
        FOR j = 1 TO 4: PRINT typ(j); : NEXT: PRINT
        PRINT
      END IF

     CASE ELSE
      choose s + 1
   END SELECT
 NEXT
END SUB

 


  Posted by Charlie on 2009-08-02 15:07:28
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 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information