A valuable painting was stolen from the Liars' Club, but the police are having a hard time identifying the culprit because every statement made by a member of the Liars' Club is false. Only four members visited the club on the day that the painting was stolen. This is what they told the police:
- Ann: None of us took the painting. The painting was here when I left.
- Bob: I arrived second. The painting was already gone.
- Chuck: I was the third to arrive. The painting was here when I arrived.
- Tom: Whoever stole the painting arrived before me. The painting was already gone.
Who of these four liars stole the painting?
DECLARE SUB permute (a$)
CLS
a$ = "abct": h$ = a$
DO
FOR thiefArr = 1 TO 4
good = 1
AnnArr = INSTR(a$, "a")
IF AnnArr < thiefArr THEN good = 0
BobArr = INSTR(a$, "b")
IF BobArr = 2 THEN good = 0
IF BobArr > thiefArr THEN good = 0
ChuckArr = INSTR(a$, "c")
IF ChuckArr = 3 THEN good = 0
IF ChuckArr < thiefArr THEN good = 0
TomArr = INSTR(a$, "t")
IF thiefArr < TomArr THEN good = 0
IF good THEN PRINT a$, thiefArr
NEXT
permute a$
LOOP UNTIL a$ = h$
produces
btac 2
btac 3
indicating that the order of arrival was Bob, Tom, Ann, and then Chuck, and that the thief could be either the second (Tom) or third (Ann) to arrive. However, it's likely that, this being a club, at least Ann and Chuck left at the same time, so no one would be at the club alone. Since Chuck lied when he said the painting was there when he arrived, it must have been gone already when he arrived and Ann was still there. That leaves Tom as the culprit, having left with the painting before Chuck arrived.
|
Posted by Charlie
on 2013-06-05 12:55:33 |