7

My girlfriend has been playing a game on her smartphone for a while. The rules are:

  1. there are $n+2$ tubes (with $n\ge 1$) and $n$ colored liquids.
  2. Two tubes are left empty and the others are filled with four doses of liquid.
  3. A tube cannot contain more than $4$ doses of liquid.
  4. There are exactly $4$ doses of each liquid.
  5. Liquids of different colors are non-miscible.
  6. The goal is to move liquids so that the $4$ doses of each liquid are in a single tube.
  7. Only the doses of liquid on the top of a tube can be moved. They have to be moved on top of a liquid of the same color.
  8. All doses of the same color at the top have to be moved at the same time. The only exception is when there is not enough space available when moving into a new tube. Only the doses of the same color that can be moved are then moved. For example, imagine that tube 1 contains three red doses and tube 2 contains a red dose above a blue one. In that case, two red doses from tube 1 can be moved to tube 2.

Here is a picture that illustrates the problem (with $n=9$):

enter image description here

For example, the pink liquid at the top of the fifth tube can be moved to an empty tube. After that, the two doses of red liquid from the same tube can be moved on the remaining empty tube. It is not possible to move only one dose of red liquid.

Is there a general strategy to solve this problem?

My intuition tells me that I could use induction (like the Hanoi towers problem), or graphs, or invariants (defining the degree of disorder of a configuration, the solution of the problem corresponding to a degree of disorder of $0$), but I don't really know how to get started in any of these directions.

Note: I am not sure that it is possible to win from any starting configuration.

Bram28
  • 100,612
  • 6
  • 70
  • 118
Taladris
  • 11,339
  • 5
  • 32
  • 58
  • 1
    Is the maximum capacity of each tube $4$ doses? The picture suggests it, but your description doesn't mention this constraint. – mjqxxxx Feb 17 '21 at 15:16
  • @mjqxxxx: this is what I meant by the point 2. but maybe it is not clear. I will edit. It is easier to understand the rules by playing than describing them, so this kind of comments are welcome. – Taladris Feb 17 '21 at 15:19
  • 1
    @Vepir I think you're missing the rule that I also missed at first: you can't move a color on top of a different color (Rule 7). – Misha Lavrov Feb 17 '21 at 16:05
  • @MishaLavrov Ah yes, I did miss that. Disregard my previous comment then. – Vepir Feb 17 '21 at 16:10
  • This question was already asked multiple times: 1. copy is Does Ball Sort Puzzle always have a solution? where it is shown that not all configurations are solvable, 2. copy is Algorithm for Liquid sort puzzle. – Vepir Feb 17 '21 at 18:23
  • @Vepir Ha! Good thing you didn't post that before I gave my answer .. looks like I found a smaller set-up that is impossible :) – Bram28 Feb 17 '21 at 18:35
  • 1
    A bit of googling tells me that there are a lot of clones of this game on the mobile phone stores, most commonly with 9 or 12 colors. Most have thousands of levels. I wonder if they randomly generate them by brute force solving random starting positions, or if there is a smarter way to generate levels of increasing difficulty. – Vepir Feb 17 '21 at 19:20
  • @Vepir Rather than generating levels at random and testing, I think it is possible to generate solvable levels just by pouring in 'reverse'. The reverse pouring rules might be something like: 0) start with teh 'solved' position and two empty bottles 1) Always pour onto a different color - or into an empty bottle. 2) Always pour from a bottle with at least two contiguous volumes of the color on top 3) Never pour all the measures of the top color. A bit like the way you scramble a Rubic's cube to make a puzzle to solve. – Penguino Feb 18 '21 at 00:34
  • @Vepir: thanks. I couldn't find other questions. I don't mind if this question is closed as duplicate. Sure, there are many clones, it was part of those almost identical games that get advertized on Instagram. – Taladris Feb 18 '21 at 01:12
  • 1
    @Taladris The first one is not an exact duplicate and the second one is a bad duplicate. So this will not be closed, don't worry. – Vepir Feb 18 '21 at 01:16

1 Answers1

3

This one is impossible to solve: enter image description here

It is easy to see that the best thing you can do here is to take two pairs of the same color from the top row and put those in the two extra tubes. This either exposes four new and all different colors, so you are stuck immediately, or you expose two pairs of tiles of the same color on the second row. For example, we can take the two red top tiles and the two grey top tiles and put them in the extra tubes, thereby exposing two brown tiles as well as two blue tiles. So, we can put a brown one of top of another, and also for blue, but after that we expose one orange and one purple one, of which no counterparts have been exposed yet, and hence we are stuck. By symmetry of the configuration, this is true for whatever pairs of colors you choose to start with.

Note that the placement of the tiles on the bottom row doesn't matter, since you'll never get to the bottom row.

Bram28
  • 100,612
  • 6
  • 70
  • 118