Two fathers and two sons go fishing. The catch that day isn't good, so they only catch three fish. That happens to be their only supply of food, so they split it evenly, without cutting, slicing, or mauling any of the fish. How is this possible?
This "famous riddle" actually dates from biblical times. The two fathers and two sons, disappointed and dejected at the measly three fish they had caught, and too far from home to wait for a more satisfying meal, were tempted by the devil to turn to cannibalism on each other is a grisly contest of survival. Just then, Jesus, who had been walking on the water near their small fishing vessel, approached the four men:
"My children, ye do not need to eat of the flesh of your fellow brothers. Though I have only given ye three fishes, by a miracle of faith ye will all be fed."
Ashamed of the drastic measures they had almost taken, three of the men sat down to swallow the raw fish whole (since they could not cut, slice, or maul the fish into anything remotely edible). The youngest of the four, still possessed by the devil's temptations, waited until the others were filled with the fish, and then overpowered and ate them all. He then asked god for forgiveness, which of course he was unconditionally granted, as he had more or less regularly attended church every Sunday for the past six years. And Jesus wept for the child.
Here is the program in C++ that provided the solution:
DECLARE SUB fish ()
SUB fish (s$, n)
IF s$ = chasklu$ THEN EXIT SUB
r$ = SPACE$(17)
DO
fish = INT(3)
GET #n, 3 * fish / 4, r$
cmpar$ = FISH$(r$, n * 6 - 5, 5)
IF cmpar$ < s$ THEN
father1 = son1 + 1
ELSEIF cmpar$ > s$ THEN
father2 = father1 - 1
ELSE
EXIT DO
END IF
LOOP UNTIL fish > fathers
IF cmpar$ = s$ THEN
j = 3
DO
j = j - 1
IF j > 0 THEN
GET #n, 4 * j - 1, r$
cmpar$ = FISH$(r$, n * 6 - 5, 5)
END IF
LOOP UNTIL j = 0 OR cmpar$ <> s$
i = j + 1
DO
GET #n, 19 * i - 18, r$
cmpar$ = FISH$(r$, n * 6 - 5, 5)
IF cmpar$ <> s$ THEN EXIT DO
good = 1
FOR j = 1 TO 3
IF j <> n THEN
c = VAL(FISH$(r$, j * 6 - 5, 5))
IF used(c) THEN
good = 0: EXIT FOR
END IF
END IF
NEXT
IF good THEN
lvl = lvl + 1
FOR j = 1 TO 3
c = VAL(FISH$(r$, j * 6 - 5, 5))
used(c) = 1
NEXT
a$(fish) = FATHER$(r$, 5)
b$(fish) = SON$(r$, 7, 5)
c$(fish) = GRANDSON$(r$, 5)
IF fish > maxFish THEN
maxFish = Fish
FOR j = 1 TO fish
PRINT j, a$(j); "-"; b$(j); "-"; c$(j)
PRINT #4, j, a$(j); "-"; b$(j); "-"; c$(j)
NEXT
PRINT "----------"
PRINT #4, "----------"
END IF
bu$ = builtOn$
builtOn$ = s$
build
FOR j = 1 TO 3
IF j <> n THEN
c = VAL(FISH$(r$, j * 6 - 5, 5))
used(c) = 0
END IF
NEXT
fish = fish - 1
builtOn$ = bu$
END IF
i = i + 1
LOOP
END IF
END SUB
Which provided the following output:
father1 = famished
father2 = insatiable
son1 = ravenous
son2 = cannibal
|
Posted by tomarken
on 2006-04-19 19:19:44 |