Loopover puzzles are 2D sliding puzzles that work more like flat rubik's cubes. Instead of having one open slot for pieces to slide into, the entire grid is filled with pieces tha wrap back around when you slide a row or column.
You can try it out at this sketch here: https://www.openprocessing.org/sketch/576328
To complete this challenge, implement a function to return a list of moves that will transform an unsolved grid into a solved one.
Consider the grid:
ABCDE FGHIJ KLMNO PQRST UVWXY
If we make the move
R0 (move the 0th row right) then we get:
EABCD FGHIJ KLMNO PQRST UVWXY
Likewise, if we do
L0 (move the 0th row left), we get:
ABCDE FGHIJ KLMNO PQRST UVWXY Back to normal.
Say we make the move
U2 (move the 2nd column up):
ABHDE FGMIJ KLRNO PQWST UVCXY
D2 (2nd column down) would then return us to the original grid. With all of this in mind, our tests will give you the scrambled grid as input. Please return an array of the moves taken to unscramble the grid.
SCRAMBLED GRID: DEABC FGHIJ KLMNO PQRST UVWXY SOLVED GRID: ABCDE FGHIJ KLMNO PQRST UVWXY
One possible solution would be
["L0", "L0"] as moving the top row left twice would result in the original, solved grid. Another would be
["R0", "R0", "R0"] etc. etc.
Some of these can be kind of tricky. Good luck!
Want to propose a challenge idea for a future post? Email firstname.lastname@example.org with your suggestions!