## On the Subject of Ten-Button Color Codes

A “simple” module about “simple” colors, banking on the fact that you can follow its “simple” directions.

Follow the rules listed below starting**and ending**with the rule corresponding to the digit found for each stage.

- First stage: Last digit of the serial number.
- Second stage: Sum of all numbers in the serial number. Use least significant digit.

**IMPORTANT:**The second stage’s rules are read upwards instead of downwards.

- Change the color of every button once, except for the button equal to the rule you started on (0 becomes 10).
^{‡} - If two buttons horizontally adjacent from each other have the same color, change the right one to red. If it already is red, then change it to green.
^{*}^{†} - If at least three buttons on the top row are the same color, change the color of the first and second of those buttons by pressing them once and twice respectively.
^{‡} - Switch the first and fourth columns, switch the third and fifth columns, and swap the colors of the second column.
- If an entire row is the same color, change the first, third, and fifth buttons in that row once.
^{†}^{‡} - If two vertically adjacent buttons are the same color, change the top one to blue and the bottom one to red, unless the last digit of the serial number is even, in which case change the bottom one to green.
^{†} - If no buttons are red, change the second, sixth, and ninth buttons to red.
^{‡} - If over five of the buttons are green, change the first green one twice, the third green one once, the fourth green one twice, and the eighth green one (if there is an eighth green button) to blue.
^{‡} - If a 3×1 array of buttons anywhere are the same color, change the color of the middle one to whatever color comes next (one press).
^{*}^{†} - If a 2×2 grid of buttons anywhere are the same color, change the top-left and bottom-right buttons twice.
^{*}^{†}

^{*} Only apply these rules to the leftmost area in that row.

^{†} Steps 1, 4, and 8 are applied only once for each row, meaning that they can only be applied once on the top row, and once on the bottom row, up to 2 times overall.

Step 9 can only be applied once.

Step 5 can be applied for up to all 5 columns.

^{‡} Buttons are numbered in reading order, which is left to right, top to bottom.