# Merlin's Magic Square

The applet consists of two 3x3 arrays. On the left, the small one shows the target configuration. To modify the target configuration, click on the squares you want modified. On the right, a bigger one holds the puzzle itself and, if the Hint box is checked, the hint or, rather, the solution to the puzzle. The hint configuration is also modifiable and the current state of the puzzle changes accordingly. States are represented by a cyclic arrangement of digits - the residues modulo the number of states. I allow only 2, 3, and 4 state buttons for two reasons. For one, with more states the puzzle grew too difficult for me to solve. The second reason will become apparent from the puzzle's theory.

The effect of pressing a button is best described by the following diagram

where the button pressed is colored red and the affected buttons are blue. Other corner and side moves have an analogous effect.

The applet allows for a second puzzle. Imagine the buttons wrapped on a torus. Then all buttons have exactly the same number of "across-the-edge" neighbors, 4. (In Computer Graphics terms, these are 4-neighbors.) In this modification, all 4-neighbors of a pressed button advance their states along with the button itself. Naturally, the first puzzle is rather Plane whereas the second is played on a Torus. For technical reasons the latter is only played with 3-state buttons.

### If you are reading this, your browser is not set to run Java applets. Try IE11 or Safari and declare the site https://www.cut-the-knot.org as trusted in the Java setup.

 What if applet does not run?

The theory