# Logi Toli

Logi Toli is a simple puzzle consisting of a arrangement of tracks containing six sliding pieces. The tracks form the shape of an elongated letter H, but with a small side track in the centre. At the start three orange pieces fill the vertical section of track on the left, and three yellow pieces fill the vertical section on the right. The aim is to slide the pieces along the tracks until the orange pieces have swapped places with the yellow.

From this:

to this:

The puzzle is easy, so you could set yourself the extra challenge of using as few moves as possible, or to minimise the total distance travelled by the pieces.

This puzzle is listed in L. E. Hordern's book "Sliding Piece Puzzles", entry B33, where it says that it was called "A Motor-Car Problem" when published in the Strand magazine in 1903, and that a cardboard version called "Germans vs. Allies" was sold in 1918.

If your browser supports JavaScript, then you can play the Logi Toli puzzle by clicking the link below:

## The number of positions:

You could consider the puzzle to have 10 piece locations - 3 on each of the outside vertical sections, 3 more on the horizontal track, and one on the small central side track. These ten locations contain 3 orange pieces, 3 yellow pieces, and 4 empty spots. This can be arranged in 10! / (3!·3!·4!) = 4,200 ways.

With the above counting of positions, a single move would be sliding a piece along a track by a distance of one piece diameter. God's Algorithm can be calculated using this definition, and it turns out that the furthest away you can get from the start position is 66 moves, though the goal position is just 62 moves away from start. The average distance from start is 32.727 moves.

Depth#positions
01
12
27
314
426
532
644
754
867
966
1061
1124
1218
1314
1422
1526
1650
Depth#positions
1760
1884
1992
20112
21104
22104
2370
2456
2534
2636
2740
2876
2984
30128
31152
32196
33212
Depth#positions
34252
35200
36164
3776
3856
3936
4052
4148
4288
4392
44104
4592
4696
4776
4864
4940
5036
Depth#positions
5124
5222
5322
5440
5538
5652
5750
5844
5938
6045
6130
6223
6314
6410
654
664
Total4,200

The four antipodes are:

A more natural way to define a move is as a shift of one piece by any distance along any path. With this move definition, the furthest away you can get from the start position is 19 moves, though the goal position is just 17 moves away from start. The average distance from start is 10.380 moves.

Depth#positions
01
18
251
3110
4190
5142
6130
7346
8314
9254
10558
11652
12292
13152
14424
15190
1665
17171
18130
1920
Total4,200

Here are some of the antipodes:

The rest of the antipodes are differ from these by horizontal or vertical reflection.

## Solution:

The following solution is optimal in both metrics, i.e. pieces are moved only 17 times, and the total distance moved is 62 piece diameters. There are 8 such optimal solutions, but they are related to each other by the following symmetries:

• Mirroring the moves, swapping left and right.
• Mirroring the left vertical track, swapping the top left and bottom left locations.
• Mirroring the right vertical track, swapping the top right and bottom right locations.