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.
A's response
1. B is a pink philosopher.
2. My color is pink.
B's response
C is a blue logician.
C's response
1. Each of the two statements made by A is a lie.
2. B is a blue logician.
What are the type and skin color of each chamsonel?
If A is speaking truthfully, he's a pink philosopher and so is B.
That would make B to be telling the truth and therefore C, a blue logician telling the truth.
But C contradicts A, so our original assumption that A speaks the truth is wrong.
A lies and is therefore a blue philosopher. Also C is telling the truth, as he contradicts A, so B is a blue logician and is telling the truth about C, whose truth telling is therefore the result of his also being a blue logician.
I guess that was faster than the 20 minutes it took to write the below program:
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 <> (bt$ = "pp") THEN good = 0
IF atr <> (LEFT$(at$, 1) = "p") THEN good = 0
IF btr <> (ct$ = "bl") THEN good = 0
IF ctr = atr THEN good = 0
IF ctr <> (bt$ = "bl") THEN good = 0
IF good THEN
PRINT "a="; at$
PRINT "b="; bt$
PRINT "c="; ct$
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
finds
a=bp
b=bl
c=bl
indicating
A is a blue philosopher
B is a blue logician
C is a blue logician
|
Posted by Charlie
on 2012-10-19 12:48:20 |