The dominant species in Planet Blancneldos is the chamsonels. There are two types of chamsonels - logicians and philosophers. The chamsonels also have two different skin colors related to their veracity. Pink logician chamsonels always lie while blue logician chamsonels always tell the truth. Pink philosopher chamsonels always speak truthfully but blue philosopher chamsonels always speak falsely.
Four chamsonels A, B, C and D are conversing among themselves. A visitor from a neighboring planet, who is color blind, asks each of the four chamsonels their color and typer. They say:
A's response
1. B and myself are the same color and type.
2. I am blue.
3. C is a philosopher.
B's response
1. A's statements are false.
2. C and myself are the same color.
3. D and myself are the same type.
C's response
A and D are different colors, but the same type.
D's response
A and B are the same color, but different types.
What color and type are each of the four chamsonels?
true = (1 = 1)
col$ = "pb"
occ$ = "lp"
FOR ac = 1 TO 2
FOR ao = 1 TO 2
at$ = MID$(col$, ac, 1) + MID$(occ$, ao, 1)
IF at$ = "bl" OR at$ = "pp" THEN atr = true: ELSE atr = false
FOR bc = 1 TO 2
FOR bo = 1 TO 2
bt$ = MID$(col$, bc, 1) + MID$(occ$, bo, 1)
IF bt$ = "bl" OR bt$ = "pp" THEN btr = true: ELSE btr = false
FOR cc = 1 TO 2
FOR co = 1 TO 2
ct$ = MID$(col$, cc, 1) + MID$(occ$, co, 1)
IF ct$ = "bl" OR ct$ = "pp" THEN ctr = true: ELSE ctr = false
FOR dc = 1 TO 2
FOR doc = 1 TO 2
dt$ = MID$(col$, dc, 1) + MID$(occ$, doc, 1)
IF dt$ = "bl" OR dt$ = "pp" THEN dtr = true: ELSE dtr = false
good = 1
IF atr <> (bt$ = at$) THEN good = 0
IF atr <> (LEFT$(at$, 1) = "b") THEN good = 0
IF atr <> (RIGHT$(ct$, 1) = "p") THEN good = 0
IF btr <> (atr <> true) THEN good = 0
IF btr <> (LEFT$(bt$, 1) = LEFT$(ct$, 1)) THEN good = 0
IF btr <> (RIGHT$(bt$, 1) = RIGHT$(dt$, 1)) THEN good = 0
IF ctr <> (LEFT$(at$, 1) <> LEFT$(dt$, 1) AND RIGHT$(at$, 1) = RIGHT$(dt$, 1)) THEN good = 0
IF dtr <> (LEFT$(at$, 1) = LEFT$(bt$, 1) AND RIGHT$(at$, 1) <> RIGHT$(bt$, 1)) THEN good = 0
IF good THEN
PRINT "a="; at$, atr
PRINT "b="; bt$, btr
PRINT "c="; ct$, ctr
PRINT "d="; dt$, dtr
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
finds
a=pl 0
b=pp -1
c=pl 0
d=pp -1
indicating:
A is a pink logician
B is a pink philosopher
C is a pink logician
D is a pink philosopher
|
Posted by Charlie
on 2012-12-10 14:03:01 |