Ramka is a Soviet puzzle with 9 numbered tiles arranged in 3 rows of 3 tiles. These rows
lie in a frame which provides two empty spaces, one on either side of a row, each capable
of holding one of the tiles. The centre section containing the tile rows can be shifted
up and down so that any of the three rows lies between the spaces provided by the frame.
The tiles can individually only slide sideways along a row, not vertically.
The Russian word "Ramka" means "frame". On the back of the puzzle
the price is given as 80 kopeks.
The number of positions:
This depends on what are considered to be distinct positions. There are 11 tile locations, with 9
distinct tiles and 2 empty spaces. That would lead to 11!/2 = 19,958,400 tile positions, or 3·11!/2 =
59,875,200 if vertical shifts of the block of rows are counted as distinct.
I prefer to ignore not only the vertical shifts of the rows, but also horizontal shifts within the
three locations on a row. In that case there are 13 arrangements for the empty spaces (both in the frame;
one on the left of the frame and the other in any row; one on the right of the frame and the other in any row;
both on the same row, or both on different rows). Combined with the 9! ways to rearrange the 9 tiles,
that gives 13*9! = 4,717,440 distinct positions.
I have used a computer to calculate God's Algorithm, and the results are shown in the table below.
A move is the sliding of a tile from a row into one of the frame spaces, or vice versa. Sliding the block
of rows vertically or sliding tiles horizontally within a row are not counted as moves, and arrangements that
differ by such changes are considered identical. The table shows that the puzzle takes at most 42 moves
to solve (26.420 on average).
One of the four antipodes is the mirror image position (with the rows reading 321, 654, 987).
The other three antipodes are similar to that position but with the two outer tiles of one row
slid into the frame's spaces.
This puzzle is slightly trickier than it looks. It can be solved however by using the
following two techniques (both start with the frame locations empty):
- Cycling two rows. This cyclically permutes the 6 pieces of two rows.
- Shift one row to the right (one tile moves into the frame's right-hand side space).
- Shift another row to the left (add the tile from the frame's rhs space to the row, and
that row's left tile goes into the frame's lhs space).
- Finally use the left tile to fill the space in the previous row.
- Swapping two tiles. This swaps the right-most tile of row X with the right-most tile of row Y.
It makes temporary use of row the other row too, which I'll call row Z.
- Push the right-most tile of row X to the right into the frame's rhs space.
- Push that tile left onto row Z (Row Z's left tile goes into the frame's lhs space).
- Push the right-most tile of row Y to the right into the frame's rhs space.
- Push that tile left onto row X.
- Push the whole of row Z to the right (including the tile that went into the frame's lhs space) so
that the tile originally from row X is now in the frame's rhs space.
- Push that tile left onto row Y.
These two techniques are sufficient to solve any position.
Phase 1: Solve the top row
- If the top row contains tiles 1, 2 or 3, then cycle the top row with another row in order
to remedy that. It is always possible to choose the other row and the direction in such a way
that the tiles 1, 2, and 3 will not end up on the top row.
- Cycle the bottom two rows until the 1 is on the right of a row.
- Cycle the top row and the row containing 1 so that the 1 enters the right of the top row.
- Repeat steps b and c for tile 2 so that the 1 is now in the middle of the top row with 2 at the end.
- Repeat steps b and c for tile 3 so that top row is solved.
Phase 2: Bring the tiles to their rows
- Imagine that the tiles 4, 5, and 6 had a different colour from the tiles 7, 8, and 9.
If the last two rows both alternate in colour (i.e. no two of the same colour are next to
each other) then perform the swap sequence.
- Cycle the bottom two rows until on each row, the left two tiles have the same colour.
- If the bottom two rows do not yet have one colour each, then performing the swap sequence
should make it so.
- If necessary, cycle the bottom two rows until all their tiles are in the correct rows.
Phase 3: Order the tiles in each row
In this phase you will reorder each unsolved row by swapping adjacent tiles. You need at
most 3 such swaps to solve a row. The worst case is when you have to swap the two outer tiles,
for example 654 which is solved in three swaps for example like this: 654, 645, 465, 456.
- Look at order of the tiles in one row, and if they are not in the correct order, determine
which two adjacent tiles you would like to swap to improve the situation.
- Cycle the bottom two rows until the two tiles you wanted to swap are at the right
of the rows.
- Perform the swap sequence to swap the two tiles.
- Cycle the bottom two rows back so that the tiles are in their correct rows again.
- Repeat steps a-d until the last two rows are solved.