The command ”SHOW” causes the current state of the Power Square to be displayed in n × n
form (each row of n values on a single line, separated by spaces), followed by a blank line.
The command ”MOVE” is followed by one more more moves: ”up”, ”down”, ”left”, or ”right”.
Each move is executed as follows:
– For ”up”, swap 0 with its neighbor above.
– For ”left”, swap 0 with its left neighbor.
– For ”right”, swap 0 with its right neighbor.
– For ”down”, swap 0 with its neighbor below.
If move attempts to swap 0 with a non-existent neighbor, then output ”FAILED” on a single line and stop attempting the remaining moves. If the move succeeds, ”MOVED” is output on a single line. In either case, the state of the Power Square is changed to reflect the moves made.