Measuring cups puzzle

From IFWiki

A measuring cups puzzle is a classic puzzle where the protagonist must obtain a specific amount of a liquid only by filling, emptying, and transfering liquid between two measuring cups (or flasks, vials, jars, etc.) of different sizes.

In the usual forms of this puzzle, the cups are not graduated in any way, so they can only be filled to the brim, emptied entirely, or have the contents of one cup poured into the other. There is a reservoir or tap from which an endless supply of the liquid may be obtained.

Note that the "liquid" might actually be something like sand or rice -- a granular solid, but still something pourable and still requiring a container in order for it to be carried.

(Note: If this puzzle is known by a more commonly-used name, please let us know.)

How to solve a measuring cups puzzle

It can be useful to draw a graph in order to solve a measuring cups puzzle. For this example, assume that we have a 9-unit measuring cup and a 5-unit measuring cup, and we want to measure out exactly 3 units of oil.

Let the horizontal axis measure units of oil in the larger cup, and let the vertical axis measures units of oil in the smaller cup. We start at (0,0): both cups are empty.

One can only change the current status of the cups in one three ways:

  1. Fill a cup from the reservoir.
    • If filling the larger cup, draw a horizontal line from the current point all the way to the right.
    • If filling the smaller cup, draw a vertical line all the way up to the top.
  2. Empty a cup.
    • If emptying the larger cup, draw a horizontal line from the current point all the way to the left.
    • If emptying the smaller cup, draw a vertical line all the way down to the bottom.
  3. Pour the contents of one cup into the other.
    • If pouring from the larger to the smaller, draw a diagonal line up and leftward.
    • If pouring from the smaller to the larger, draw a diagonal line down and rightward.

It should soon become clear that only points on the outer edge of the graph can ever be reached. Further, that we have two possible solutions:

Method 1

Cups graph1.png

Start by filling the larger cup. Thereafter:

  • When we reach the bottom or right edges, draw a diagonal up and leftward (pouring from larger to smaller).
  • When we reach the top edge, draw a line downward (emptying the smaller cup).
  • When we reach the left edge, draw a line rightward (filling the larger cup).
  • Stop whenever either cup contains the desired quantity.

Method 2

Cups graph2.png

Start by filling the smaller cup. Thereafter:

  • When we reach the top or left edges, draw a diagonal down and rightward (pouring from smaller to larger).
  • When we reach the bottom edge, draw a line upward (filling the smaller cup).
  • When we reach the right edge, draw a line leftward (emptying the larger cup).
  • Stop whenever either cup contains the desired quantity.