# Can YOU Save the Earth?

Aliens from TRAPPIST-1 — or, as they call it,  ·́ͪͪ̾̊̏ͬͭ͊͆̑́̍ͥ͗͜͞҉ ̴̷̉̿́̈͌̊͐ͮ͘͜·̵̵̨́͌̒̾ͦͩͯ͌͐̅̃̂̋̃̀͟·̷̢ͪ͑͆ͥ́ ̷̷̴̛͊͐̅͗̎̎ͬ́·̴̾̋͑͊̊ͥ̓ͣ̆̔̎̋̀͠҉͢ ̵̽̿̄ͩ̀̍ͩ̾̈ͣͬ͗̃̆̍͘͟·ͧ͐̾͆̅͢҉ ̴̢̛̏ͨͨ̾́̈́̋͋͛̓̀͛ͪ̚·̷̧̡́̀̾ͭ̐̏́ ͂̀̾ͥ̓ͮͭ̾ͧͦ̊̚҉̸̧̨ ̧̢̛̐͂ͣ̊̌ͦͮ̈̈ͭͩ͌͘·̴̛̎͊̽̾ͩ̈́̉ͯ̑͐ͯ̈́̂̌̈ — have been scouting the Earth, looking for new sources of important resources for their home world. However, being a civilized people, they have a strict rule against plundering worlds that are home to intelligent species. But their definition of "intelligent" is somewhat nuanced ...

In monitoring broadcasts from the Earth, the Trappists have come to the conclusion that while music, artistry, and much of what comes out of the BBC are definite points in our favor, the majority of what we as a species produce argues against us. In fact, in tallying up the points for and against, they've somewhat embarrassingly ended up with a tie score. This needs to be resolved one way or the other, as the water and mineral resources of our planet are in great demand.

The lead scout, having recently suffered an unpleasant desplicing from its cobiogenitor, had unfortunately skimped a bit on investigatory research, leading it to think that Puzzling Stack Exchange is a nicely representative assembly of the highest caliber individuals our planet has to offer; if life meeting their standards for "intelligent" can be found anywhere on Earth, surely it can be found here. And so, without further ado, the lead scout elects to take one person from the ranks of PSE's user base, and subject them to one final test, to determine the fate of Earth and all mankind.

Naturally, that test subject is you!

You wake unexpectedly, to unexpected surroundings. By the faintly blue light from an unseen source in the ceiling you see you are in a smallish room containing just yourself, five oddly shaped containers, and a device with a crude knob and two tubes. Set into one wall is a panel with another crude knob and a single tube. Another wall has a set of five cube-shaped bays set into it, roughly 1 meter per side, each with a metallic grating for a floor; grooves around each bay's entrance suggest each bay is equipped with a door as well. Left to right, the bays are labelled: ⠁ ⠃ ⠋ ⠛ ⠟
A glowing panel above the bays shows this:

$$\require{enclose}\enclose{box}[mathcolor=white,mathbackground=red]{\begin{array}{c}\\0300000\\\\\bbox[5px,#ff6e69]{\small\color{white}{\textsf{Post Your Answer}}}\vphantom{\Space{1pt}{1pt}{10pt}}\end{array}}$$

Beyond these features, the room is empty and nondescript, without even a visible door.

You go to look at the containers. Four look similar in design, though different in shape and size; they are rigid and transparent, and have two markings clearly visible from both inside and out: a lower one, labelled with ●●, and one very near the top, labelled with ●●●●. The fifth container is larger and looks to be made of flexible opaque plastic — basically a wide bucket — and has no markings of any kind.
As you are looking at the large container, you notice a piece of paper(?) inside it on which is crudely written the following:

• usE waLL taP it PovidEs ExatLy $5$ Freem oF FLuid
• usE syFon it movE FLuid From vEssEL to vEssEL
• LargE vEssEL caPacity no LEss to $3\frac12$ Freem, but LEss to $5$ Freem
• smaLL vEssELs caPacity to ●●●● no LEss to $\frac34$ Freem, but LEss to $1\frac12$ Freem
• ExatLy onE of vEssEL caPacity ExatLy $1$ Freem
• Each vEssEL caPacity to ●● ExatLy $\frac12$ caPacity to ●●●●
• no two of vEssELs samE caPacity
• PLacE ExatLy $\frac12$ Freem oF FLuid in bay ⠁
• PLacE ExatLy $\frac12$ Freem oF FLuid in bay ⠃
• PLacE ExatLy $\frac12$ Freem oF FLuid in bay ⠋
• PLacE ExatLy $\frac12$ Freem oF FLuid in bay ⠛
• PLacE ExatLy $3$ Freem oF FLuid in bay ⠟
• PrEss to PanEL whEn FinishEd
• iF corrEct soLution you and Earth survivE ELsE aLL wiLL harvEstEd

As you finish reading the note, it disintegrates, vanishing without a trace; fortunately its details are pretty simple to remember. Suddenly you hear an ominous click. You glance around and notice the wall panel's digits now read $\bbox[red,5pt]{\color{white}{\small{0299274}}}$ and are counting down ... quite ... quickly ....

Can you fulfill the Trappists' challenge?
Can YOU Save the Earth?!

______
- You cannot use anything not provided
- You cannot make any additional markings on the containers
- Measurements must be exact; your process cannot involve estimating
- The knobs on the wall tap and the syFon control flow rate -
it is possible to hit the provided markings on the containers with high precision
- Pressing the panel vaporizes everything in the bays other than Freem, which then falls through grates to be measured
- is not an excuse to indulge in wild flights of fancy; I can't close every loophole… and shouldn't have to

• ELLPPESELFFF - EFEFLFEELEEL - LEEELPLEFLEL - LLEELPLEFLEF - ELEEELPEF - EEELPEP - EELEP - PLEELFFF - PLEEFFF - PLEEFFF - PLEEFFF - PLEEFFF - PEPELEFE - FELEEELELLLLEE - All the capitalized letters in the written instructions. Mar 8 '17 at 16:52
• @n_palum I'm thinking they are alien compass directions Mar 8 '17 at 16:56
• I'll save you the bother. There is no cipher, steganography, or anything else similar. Textual oddities are pure flavor; the problem is exactly what it appears to be.
– Rubio
Mar 8 '17 at 16:56
• can wE syFon thE FLuid oFF FLoor? Mar 9 '17 at 9:25
• I'm starting to worry about how often my inability to solve puzzles quickly has doomed the Earth... May 10 '17 at 15:02

Assuming you cannot dump freem in the rooms except in filled containers, and that you cannot fill container beyond ●●●● mark:

Pour half to one of small containers. Pour to the next one till ●● If doesn't reach it, it is larger, otherwise smaller and use that one. Continue with other containers, noting relations we have obtained so far. Say ordering is ABCD. The minimum number of siphons and fillings depends on your luck selecting containers, best case is 1>2>3>4 which gives order with single fill and 3 siphons (numbers correspond to order of trying containers), and all containers have something in them. Worst case scenario is 1<2,3,4, followed by 2<3,4 and 3>4, which requires 3 fills and 6 siphons, and ends up with D with some freem and the C filled to ●●.

Now assume this worst case scenario (no reason to hope for anything better)

We can obviously do better than starting with A and working our way to the top. So, we start with B. Siphon everything from C and D to B, then fill it up. Siphon to C. Fill B and siphon to big container 3x if it fits. If it does not, B > big/3 (say B=1.2 and big is 3.5), which means A is the unit container, and should be easy to proceed (similar to procedure for A below). If it fits, fill B 5th time. If it doesn't get full, A is the unit container. In this case siphon B to A, siphon remaining B to big container (surely fits) or if there is nothing left and A isn't full, siphon from big to A. Then siphon half A to B, siphon other half to D. Siphon C to A and remainder to big container. Siphon half of A to C.

If it gets full, if there was nothing left in the tap, B was the unit container. Siphon half to A, siphon remaining half of B to D, siphon from C till B is half filled and that's it.

If there is still something in the tap, C or D are the unit container. Big container now holds 3B, A is empty as is D, B and C have B. Fill up C from tap, siphon to D. Siphon from B to C till B is empty, then fill up C from tap. Siphon from C half to A and half to big container, so the big container now holds 3B+0.5C < 3.5. Small containers have A=0.5C, B=0, C=0, D=C and some freem is left in tap. Now siphon from big container to B, then B->C, then fill up C from tap, then pour to big container and keep repeating till you empty B from big container. In the last step you should have big with 2.5C, A with 0.5C, B empty, C with C and D with C. If there is no freem left in the tap, C is the unit container. Siphon half of C to B, half to big container and half from D to C, and you are done. If freem is left in tap, D is the unit container.

Now for D, in buckets there is 5C of freem. 2.5C in the big container, 0.5 in A, 0 in B, 1 in C and 1 in D. Fill D up from tap. Siphon half D to B, siphon A to big container, siphon half D to A. Siphon C to D, fill up from tap. Siphon half D to C and fill up big container from tap, completing the procedure.

I optimized the procedure a bit and do not see how I could meaningfully speed it up further. This solution assumes we can stop siphon to the big container in time so it doesn't overflow. Previous version works without this assumption and is slightly slower.

Starting with C could be as fast or faster (you already have half of C in container so there might be 1 step less), but I haven't checked, and you might be hitting that 3.5 units in the big container limit in the way to optimal solution - right now we can rely on 2B+1.5C<3.5, but with C>1 we couldn't.

• Thanks (and thanks for editing this). Fixed that mistake and eliminated some small inefficiencies I spotted. May 10 '17 at 14:33
• Can you elaborate on the etc etc part? I'm having trouble to fill in the blanks.
– ffao
May 10 '17 at 18:01
• Well done! This solution is now complete, well explained, and works properly. For A/B cases it is optimal (and uses fewer operations than my solution, because ...) but for C/D cases the extra cycling to set up to check C is less efficient. Your solution is very close to the first solution I found, before I found a way to avoid some of that extra churn. Across all possible scenarios I'm not sure which ends up being optimal, but it's certainly not far off in any case. Congratulations on seeing it through - Planet Earth is saved!
– Rubio
May 11 '17 at 8:24
• @Rubio I did some further optimization for all cases, I doubt it can be optimized further by starting with B. But it relies on this big container being able to stop siphon in time so it doesn't overflow in a particular edge case of 3xB > big container. It isn't against the any of stated rules though :P May 11 '17 at 9:07
• Optimizing more for C/D comes at the expense of being less optimal for A/B cases. To see if B is it, you have to fill B five times and see if the tap runs dry. However, by siphoning B to C repetitively and counting fills of C also, you can simultaneously be making progress toward seeing if C is it should B not pan out. (fill B; B→C; fill B; B→C to full; C→big; rest of B→C; fill B; B→C to full; C→big; ... eventually leaving 2C in big, C in D, C in C, and B filled. This ends up greatly reducing setup operations to check for C being it, but you pay them even if A/B end up being it.
– Rubio
May 11 '17 at 9:20

Label the 4 smaller buckets A,B,C,D (and set them in a line, in that order). As a shorthand, ••A will be "the contents of A from empty to •• or from •• to ••••" and ••••A will be "the entire contents of A when filled to ••••".

### First step: Sorting

When buckets are swapped, their lettering changes also (order will still be ABCD).

1. fill A to ••.

2. syFon contents of A into B. If more than ••B, syFon back to A and swap buckets. Else fill B to ••B

3. repeat step 2 from B to C and C to D. At the end all the buckets will be empty except ••D.

4. repeat steps 1-2, except syFoning from D instead of filling from the tap. Do this between B and C also.

5. repeat steps 1-2, except syFoning from C instead of filling from the tap.

Now the buckets are all sorted, with A being the smallest and D being the largest.

### Second step: Testing A

Since ••••A > 3/4 and ••••D < 1-1/2, we can pour all the fluid used so far into A. When that's done, top up to ••••A so that A will be full and everything else is empty.

1. Empty A into E (big bucket) and refill to ••••. Do this two more times so that there is 3*••••A Freem in E.

2. Pour ••••A into B and refill. If there is no additional fluid, then you have 3 Freem in E and 1 Freem each in A and B. Go straight to the last step.

### Second step: Testing B

At the start of this, there is 3*••••A Freem in E, and ••••A in each of A and B. We will end with 3*••••B in E and ••••B in B and C.

1. syFon A into B until we've reached ••••, and then empty the rest into C.

2. syFon ••••A from B into A, and the rest of B into E. The amount added to E here is ••••B - ••••A. syFon all of A back into B, and repeat twice more, adding 3*(••••B-••••A) in total. Now E contains 3*••••B.

3. Top up B to ••••B from tap. Pour contents into D. Pour contents of C into B and top up to ••••B. Now put contents of D back into C. If no more fluid, then we've got 3 Freem in E and 1 Freem each in B and C. Go straight to last step.

### Second step: Testing C

At the start of this, there is 3*••••B Freem in E, and ••••B in each of B and C. We will end with 3*••••C in E and ••••C in C and D.

This basically is the same as testing B, except using "••••B", "••••C", "C" and "D" instead of "••••A", "••••B", "B" and "C", respectively. Instead of using bucket D as swap space you can use A and B combined.

If no more fluid when you finish, then we've got 3 Freem in E and 1 Freem each in C and D. Go straight to last step. Else, you know that D (by process of elimination) is your 1-Freem bucket. If that's the case, instead of the last step do the alternate version.

### Last step: Portioning buckets (A,B,C)

At the start of this, there is 3 Freem of fluid in E and 1 Freem in two other buckets, one of which is the 1-Freem bucket. (Let's just call it A, here.)

syFon ••A from A into an empty bucket. syFon ••A from A into the other empty bucket. syFon up to •• in A from the last remaining bucket, which has 1 Freem. Now your buckets are correct, and you can put A,B,C,D into bays 1-4 and E into bay 5.

### Last step (alternate): Portioning buckets (D)

At the start of this, there is 3••••C Freem of fluid in E, ••••C fluid in C and D. We also know that ••••D=1 Freem, by process of elimination. Empty bucket C into buckets B and A, partitioning however.

1. fill D to •••• from the tap. syFon ••••C into C, remainder (••••D-••••C) into bucket E, and then move all fluid from C back into D. Repeat twice, adding a total of 3*(••••D-••••C) to E. Now there's 3••••D=3 Freem in E.

2. Put fluid from A and B (totalling ••••C) back into bucket C. Top up bucket D to •••• from tap, and then syFon ••D from D to A and the remaining ••D into B. put all of bucket C into bucket D, and then fill remaining fluid up to ••••D. Put ••D into C.

Now your buckets are correct, and you can put A,B,C,D into bays 1-4 and E into bay 5.

EDIT: I forgot; also you have to push the panel at the end.

• "Testing B", #2, appears to be missing a step; as written, the process does not do what you claim. "Testing C" is also affected by this, as you include the "Testing B" process by reference. This seems pretty close, though it's rather longer than the optimal solution ... I hope the timer doesn't run out on you!
– Rubio
Mar 9 '17 at 23:22

Step 1: Figuring out the smallest container

Take any container, pour Fluid up to the mark ●●. Then proceed to try to fill the other containers up to mark ●● in turn: if you can't fill the container up to mark ●●, it is larger; if you fill the container up to ●● and there's still fluid left, the new container is smaller; continue the test using the new smaller container as a reference. After testing each container you'll find the smallest one, let its volume be A Freem.

Use the Fluid you have and from the tap as needed to drop ½ A into each of bays ⠁, ⠃, ⠋, ⠛ and 2A into bay ⠟.

Step 2: Which is the vessel with volume 1?

Pour the remaining Fluid from the tap into the bucket and try to fill the smallest container. If it fits exactly, A is 1: pour the remaining fluid into bay ⠟ and you're done. In case there's fluid left in the bucket, one of the other containers has volume 1: pour all of the fluid back into the bucket and test the other containers one by one.

Let the container you picked for testing have volume B. Pour liquid into the testing container up to ●●●●, then use that liquid to fill the smallest container to mark ●●●● and transfer what's left in the testing container to one of the other two containers. Try to repeat this a total of four times (if the Freem does not fit into the other two containers, then B-A is bigger than ¼, which means B is not 1: the test fails). The other two containers should now have a volume of 4(B-A). If the fluid that remains fills B to exactly ●●●●, the remaining fluid has volume exactly equal to 5B-4A, which means B is 1 Freem and the test succeeds: pour ½ B - ½ A into bays ⠁, ⠃, ⠋, ⠛ and dump the remaining into bay ⠟. If the test fails, pick a different container for testing until you find the right one.

Don't forget to press the panel after you're done!

• ^vote with a note: I think Freem is a unit of volume measure, not a liquid (that would be the FLuid) May 10 '17 at 7:06
• And these might help load time and mobile viewing: ¼ and ½ May 10 '17 at 7:36
• @boboquack The container with the smallest volume has volume A, I don't think I redefine it to 1 anywhere, or at least I shouldn't...
– ffao
May 10 '17 at 7:55
• Oh, sorry. I thought when you said A Freem you meant a Freem (as in a single Freem). Comment retracted. May 10 '17 at 8:11
• @Rubio seems like a very unnatural requirement. At the final point you pour the liquid to the bays, invariably at least some of it is going to be lost, so the puzzle becomes impossible. Maybe the puzzle would have been better if you had no bays at all and had to divide fluid among the containers.
– ffao
May 10 '17 at 17:59

This one depends on a simple fact:

How accurate the countdown timer is.

First step:

Fill the four labeled buckets to the halfway mark. Time each one. You have now distributed at least $4\cdot \frac 34 \cdot \frac 12= \frac 32 \text{ freem}$ of fluid. There is at most $3\frac 12$ freem left.

Second step:

Distribute the rest of the fluid into the large container. There is at most $3 \frac 12$ freem left, so there's room. Time this as well.

Third step:

Add up all the times. This is the amount of time it takes to distribute $5$ freem.

Fourth step:

Divide by $10$. The bucket that took that amount of time to fill to the halfway mark is the $1$ freem bucket.

Final steps:

We now have a $1$ freem bucket (half full), which we'll call A, and three other buckets (half full), which we'll call B, C, D and one large bucket (unknown - maybe close to full?), which we'll call E. Take liquid from the other buckets to fill up A. A now has one freem in it. Take any remaining liquid in bucket B and distribute to C-E so it's empty. Pour half of A into B. Put B into one of the first four bays. Repeat with C and D. With A half full, the remaining liquid in E should be $3$ freems and can go into bay 5. Press the button!

Notes:

There should be plenty of room for the redistribution in the final steps, as the capacity of E and any other bucket is at least $3.5 + .75 = 4.25$ freem and we'll be keeping $1$ freem aside in bucket $A$ and one of $B,C,D$.

Also, if the timekeeping can't be that specific, then I'll need to work on something else :)

• The countdown is very fast, on the order of hundreds per second, so it's not going to be useful as a timer to any practical precision. You'd be left making an estimate on elapsed time. Your specific procedure has other issues, such as expecting you to both fill containers with precision (i.e. watching the fill level) and watch the timer at the same time, which is infeasible, as well as maintaining a completely consistent fluid flow throughout (it's too fast at full-open to hit marks with any accuracy, and to stop the flow and restart again at any lower flow rate is, again, estimating).
– Rubio
Mar 10 '17 at 1:29
• Finally and most fatally, you've assumed the flow rate for a particular knob setting is consistent. I can tell you it's not; the flow rate at the beginning is higher than at the end, for any given knob setting, including full-open.
– Rubio
Mar 10 '17 at 1:32
• Well these guys are just no fun. Mar 10 '17 at 1:38
• As it turns out, they don't have a word for "fun". :)
– Rubio
Mar 10 '17 at 1:39