Saturday, August 20, 2011

How to move two aligned tile pieces to the top of a scheme in sliding puzzles?

Question

While playing Cogs, I have found myself plenty of times in this irritating situation. I have this:

.--. 
|XY| (where I don't really care about X, Y, or Z)
|AB|
|Z |
....

...while what I want is this:

.--. 
|AB| (where again, I'll sort X, Y and Z later.)
|XY|
|Z |
....

I'm tired of trying to get this by accident. By goodness, you how do you make that happen consistently?

Answer

.--.   .--.   .--.   .--.   .--.   .--.   .--.   .--.   .--.   .--. 
|XY| → |XY| → |XY| → |↓Y| → |Y←| → |YA| → |YA| → |↓A| → |A←| → |AB|
|AB| → |A↓| → |→A| → |XA| → |XA| → |XB| → |XB| → |YB| → |YB| → |Y↑|
|Z | → |ZB| → |ZB| → |ZB| → |ZB| → |Z↑| → |→Z| → |XZ| → |XZ| → |XZ|
....   ....   ....   ....   ....   ....   ....   ....   ....   ....

10 moves.

No comments:

Post a Comment