## On the Subject of Color Morse

-- .- - .... / .. ... / ..-. ..- -. !

- There are three flashing lights of different colors and operations and parentheses surrounding them.
- Each flashing light displays a single number/letter in Morse code. If it displays a letter, consider it as a number with value equal to the letter's numeric position in the alphabet plus 9 (A=10, B=11, etc.).
- For each number, apply the color's special operation found in the table below that corresponds to the color of the light for that number. If the color of the light is white, do nothing to the number.
- Use the (potentially) new numbers in place of the lights in the mathematical expression to get a single result.
- If the result is not an integer, consider only the integer part of the number.
- If the result is negative, make sure to send a hyphen before the rest of the number. (-0 becomes 0.)
- If the result's absolute value is greater than 999, consider only the three least significant digits.
- If more than one of the previous rules apply, apply them in order.
- Disregard any leading zeros.

- Using the buttons, enter the result in Morse code using the blank button as a digit separator.
- Upon a strike, any characters you have entered so far are reset.

If a rule refers to a *number*, it refers to the base-36 value (A=10, ..., Z=35).
If a rule refers to a *character*, it refers to the digit or letter shown in Morse code.

Color |
Action |

Red | If the number is odd, double it. Otherwise, halve it. |

Orange | If the number is divisible by 3, divide by 3. Otherwise, add the number of lights that flash with primary colors. |

Yellow | Square the number. |

Green | Swap the position of the parentheses to be around the 2nd and 3rd light if they are around the 1st and 2nd light, or vice versa. |

Blue | Triple the number and take the digital root until the number is a single digit. |

Purple | Subtract the number from 10. |