A friend gives you the game of 15 squares that slide in a 4x4 container.
After a little manipulation, expert that you are, you solve the puzzle,
obtaining the following arrangement:
..1..2..3..4..
..5..6..7..8..
..9.10.11.12..
.13.14.15.__..
where __ shows the empty space. If you're unfamiliar with this puzzle,
you have two moves you could make from this position, namely slide 12 down
or slide 15 to the right. And so on. Note a move can be described by giving
the number on the square that is moved.
Here's the puzzle, in two parts. Using only legal moves, can you make a 4x4 magic square?
.
In a magic square, numbers in each of 4 rows, 4 columns and
2 diagonals sum to the same number.
Count the empty space as zero.
.
Hint: not all configurations can be achieved.
For example, two adjacent numbers cannot exchange positions.
For example, you could not get the top row to be 2 1 3 4 with the
other 3 rows unchanged. So if write out a magic square of 0 -15 on paper,
there's a 50% chance it's not reachable from the above starting position.
. If your answer is yes, how can it be achieved with the fewest moves?
The solution is the 4x4 array of numbers and the list of moves: e.g., 12, 8, 7, 6, ... etc. Above all, have fun.