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.
Three chamsonels A, B and C are approached by a visitor from a neighboring planet who asks each of their skin color and type. Their responses are given below. It is known that the visitor is color blind and he is not very familiar with the planet’s geography.
A's response
1. This continent contains precisely twenty countries.
2. C is a logician.
B's response
1. A's first statement is true.
2. I am a logician.
3. A is a philosopher.
C's response
1. This continent contains less than twenty countries.
2. A and B are the same color.
3. I am a philosopher.
What color and type are each of the three 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
good = 1
IF atr <> (RIGHT$(ct$, 1) = "l") THEN good = 0
IF atr = true THEN exact20 = true
IF btr <> atr THEN good = 0
IF btr <> (RIGHT$(bt$, 1) = "l") THEN good = 0
IF btr <> (RIGHT$(at$, 1) = "p") THEN good = 0
IF ctr = true AND atr = true THEN good = 0
IF ctr <> (LEFT$(at$, 1) = LEFT$(bt$, 1)) THEN good = 0
IF ctr <> (RIGHT$(ct$, 1) = "p") THEN good = 0
IF good THEN
PRINT "a="; at$, atr
PRINT "b="; bt$, btr
PRINT "c="; ct$, ctr
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
finds
a=pp -1
b=bl -1
c=pl 0
meaning that
A is a pink philosopher, who therefore speaks the truth.
B is a blue logician, who therefore also speaks the truth.
C is a pink logician, who lies.
So, BTW, the continent does contain precisely twenty countries.
Note that I didn't really use the exact20 variable, but used instead:
IF ctr = true AND atr = true THEN good = 0
(in other words A and C couldn't both be truth-speakers.)
|
Posted by Charlie
on 2012-11-16 15:13:29 |