The Butterfly puzzle is a beautiful wooden puzzle by Clever Toys that has two loops of balls side by side. In the middle is a sliding part that contains a section of track that is shared by the to loops. If the slide is to the left, only the balls in the left loop can be moved, as the right loop is incomplete. Similarly only the right loop can move if the slide is on the right. The seem to be 18 balls in a complete loop, of which four lie on the section on the slide. However, a loop actually has a single ball, followed by a pair of balls stuck together, then another single ball, another connected pair, and so on all the way around the loop. The five balls (pair, single, pair) in top section of each loop are coloured yellow, and the five balls at the bottom (again a pair, single, pair) are coloured brown. The aim of the puzzle is of course to recover this colour pattern after it has been mixed.
This puzzle was invented and patented by Martin Lapeš, CZ 13357, published 9 June 2003.
I have done a computer analysis of the Butterfly puzzle in order to find God's Algorithm for it. The results are in the table below. Analogous to the Rubik's cube, there are two ways to count the moves. The Face Turn Metric means that a shifting the balls of either loop by any amount is a single move. The "Quarter" Turn Metric means that only shifting a loop by 3 balls is counted as a single move. The tables show that it can be solved in no more than 13 face turns (10.334 on average), or at most 20 three-ball shifts (15.780 on average).
|Face turn metric|
Three of the 68 most difficult positions are shown below. Their mirror images form three more.
This puzzle is very closely related to the Turnstile and Puzzler. In fact there is a direct correspondence between their pieces: The single balls are equivalent to the triangular 'corners', and the ball pairs are equivalent to the rectangular 'edges'. If you understand how to solve Turnstile, then this correspondence makes it quite easy to solve the Butterfly, too.
Let a clockwise shift of the left loop by three balls be denoted by L. An anti-clockwise shift of the left loop by three balls is denoted by L'. Turns of the right loop are denoted in the same way, but using the letter R instead, so R for a clockwise and R' for an anti-clockwise shift of the right loop by three balls.
A solution for the Butterfly puzzle is fairly easily constructed by the use of the simple move sequence LR'L'R. This sequence swaps two pairs of single balls, and also does a 3-cycle of ball pairs. If you perform it twice then the single balls remain unmoved but it is still a 3-cycle of ball pairs. If you perform it three times then the ball pairs remain unmoved but still does a double swap of single balls, though if you solve the single balls before solving the ball pairs you don't need to do this. Below I will explain a solution to the Butterfly puzzle in more detail.
Phase 2: Solve the ball pairs.
|1.||R'LL RRL R'LL R'LL RL' RL'L' R'L'|
|2.||L'RR LLLR' LLRRR LRRL|