You only have these three containers, all irregular in their shape (though it doesn´t appear in the simplified drawing below), with no marks in them, and all that you know is the capacity of each one.
The 3-liter is empty, the 5-liter is full of 50ºC water, and the 6-liter is full of 90ºC water.
|/////|
|/////| |/////|
|/////| |/90º/|
| | |/50º/| |/////|
| | |/////| |/////|
| | |/////| |/////|
+-----+ +-----+ +-----+
3-lit 5-lit 6-lit
With a succession of moves, how do you get some water at 76ºC? At 75ºC?
How many different integral temperatures, from 50ºC to 90ºC, can you get?
Since room temperature is about 20°C, you could just wait until the 90 has cooled to the desired temperature.
But if the puzzle is to accomplish this adiabatically, using only the mixing of different temperature waters being transfered from container to container until either the receiving container is full or the sending container is empty, then the computer program finds no solution for either 75 or 76 when limited to at most 16 pourings.
Label the containers 1 to 3 from smallest to largest.
Those temperatures that are achievable with at most 16 pourings are:
transfer temperature in
/ from to / last "to" container
3 1 / 2 3 / 3 2 / 62
3 1 / 2 3 / 3 2 / 2 3 / 66
3 1 / 2 3 / 70
3 1 / 2 3 / 3 2 / 1 3 / 3 1 / 2 3 / 71
3 1 / 2 3 / 1 2 / 3 1 / 2 3 / 72
2 1 / 3 2 / 74
3 1 / 2 3 / 3 2 / 2 3 / 3 2 / 1 3 / 78
3 1 / 2 3 / 3 2 / 1 3 / 80
2 1 / 3 2 / 2 3 / 82
DECLARE SUB choose ()
CLEAR , , 26000
DEFDBL A-Z
DIM SHARED cap(3), vol(3), temp(3), lvl
DIM SHARED hBestCt(51 TO 89)
DIM SHARED hBestS(51 TO 89, 20)
DIM SHARED hBestR(51 TO 89, 20)
cap(1) = 3: vol(1) = 0: temp(1) = 0
cap(2) = 5: vol(2) = 5: temp(2) = 50
cap(3) = 6: vol(3) = 6: temp(3) = 90
lvl = 0
DIM SHARED hSend(20), hRcv(20)
OPEN "water76.txt" FOR OUTPUT AS #2
choose
FOR i = 51 TO 89
IF hBestCt(i) > 0 THEN
FOR j = 0 TO hBestCt(i) - 1
PRINT USING "# # / "; hBestS(i, j); hBestR(i, j);
NEXT
PRINT i
END IF
NEXT
CLOSE
SUB choose
FOR s = 1 TO 3
FOR r = 1 TO 3
IF r <> s THEN
hSend(lvl) = s: hRcv(lvl) = r
IF vol(s) > 0 AND vol(r) < cap(r) THEN
amt = vol(s)
IF amt > cap(r) - vol(r) THEN amt = cap(r) - vol(r)
vol(s) = vol(s) - amt
tempSave = temp(r)
temp(r) = (temp(r) * vol(r) + temp(s) * amt) / (vol(r) + amt)
vol(r) = vol(r) + amt
IF temp(r) - INT(temp(r)) > .9999999000000001# OR temp(r) - INT(temp(r)) < .0000001# AND temp(r) > 50.5 AND temp(r) < 89.5 THEN
temp(r) = INT(temp(r) + .5)
FOR i = 0 TO lvl
PRINT #2, USING "# # / "; hSend(i); hRcv(i);
NEXT
PRINT #2, temp(r)
IF lvl < hBestCt(temp(r)) OR hBestCt(temp(r)) = 0 THEN
hBestCt(temp(r)) = lvl + 1
FOR i = 0 TO lvl
hBestS(temp(r), i) = hSend(i)
hBestR(temp(r), i) = hRcv(i)
NEXT
END IF
END IF
lvl = lvl + 1
IF lvl < 16 THEN
choose
END IF
lvl = lvl - 1
vol(s) = vol(s) + amt
temp(r) = tempSave
vol(r) = vol(r) - amt
END IF
END IF
NEXT
NEXT
END SUB
|
Posted by Charlie
on 2008-06-17 16:07:02 |