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

 Doubleton (Posted on 2007-09-20)
Alex, Bert and Carl are all different types. One is a knave, one is either a knight or liar, and one is a doubleton. A doubleton is a type similar to a knave, except that a doubleton's truth pattern is two true statements followed by two false statements repeatedly.

From the statements below, determine who is the doubleton.

Alex:
1. I am a knight.
2. Bert is the doubleton.
3. Carl is the knave.

Bert:
1. I am the knave.
2. Carl is the doubleton.
3. Alex is a liar.

Carl:
1. I am a liar.
2. Alex is the doubleton.
3. Bert is a knight.

 See The Solution Submitted by Brian Smith Rating: 3.5000 (2 votes)

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

Alex is the doubleton.
Bert is the liar.
Carl is the knave.

The only two true statements are Alex's last and Carl's second.

DECLARE SUB permute (a\$)
FOR kv = 1 TO 2 ' truth first or lie first
FOR cons = 3 TO 4 ' knight or liar
FOR db = 5 TO 8 ' start w/ 1st of 2 truths, 2nd of 2 truths, 1st of 2 lies, 2nd of 2 lies
s\$ = LTRIM\$(STR\$(kv)) + LTRIM\$(STR\$(cons)) + LTRIM\$(STR\$(db))
h\$ = s\$
DO
good = 1
a = VAL(LEFT\$(s\$, 1)): b = VAL(MID\$(s\$, 2, 1)): c = VAL(RIGHT\$(s\$, 1))
IF a = 1 OR a = 5 OR a = 6 THEN good = 0
SELECT CASE a
CASE 2, 3, 5, 8
IF b < 5 THEN good = 0
CASE ELSE
IF b >= 5 THEN good = 0
END SELECT
SELECT CASE a
CASE 1, 3, 7, 8
IF c > 2 THEN good = 0
CASE ELSE
IF c <= 2 THEN good = 0
END SELECT

IF b = 2 OR b = 3 OR b = 5 OR b = 6 THEN good = 0
SELECT CASE b
CASE 2, 3, 5, 8
IF c < 5 THEN good = 0
CASE ELSE
IF c >= 5 THEN good = 0
END SELECT
SELECT CASE b
CASE 1, 3, 7, 8
IF a <> 4 THEN good = 0
CASE ELSE
IF a = 4 THEN good = 0
END SELECT

IF c = 1 OR c = 3 OR c = 5 OR c = 6 THEN good = 0
SELECT CASE c
CASE 2, 3, 5, 8
IF a < 5 THEN good = 0
CASE ELSE
IF a >= 5 THEN good = 0
END SELECT
SELECT CASE c
CASE 1, 3, 7, 8
IF b <> 3 THEN good = 0
CASE ELSE
IF b = 3 THEN good = 0
END SELECT

IF good THEN PRINT s\$

permute s\$
LOOP UNTIL h\$ = s\$
NEXT
NEXT
NEXT

The output is 742, which in the code expressed in the comments (after the apostrophes), represents:

7: doubleton who starts with the first of two lies
4: liar
2: knave who starts out with a lie

Edited on September 20, 2007, 10:34 am
 Posted by Charlie on 2007-09-20 10:27:06

 Search: Search body:
Forums (0)