The protocol for programming the Christmas light controller is called Light Interfacing, Santa Helping Protocol (LISHP). There are two types of commands used in LISHP: the mode command, used to make the basic building blocks; and the program command, used to make large complex sequences using the modes. The LISHP protocol ignores all white space.
The complete grammar is as follows:
A mode command consists of an 'M' and a mode number followed by a states list.
A mode number is any number, 0 through 15, uniquely identifying the mode.
A states list begins with a '{' followed by any number of state definitions and ending with a '}'
A State definition begins with a '(' followed by a space-separated list of 16 binary digits, where a '1' signifies on and '0' signifies off for the corresponding light, and ending with a ')'.
Comments may be placed anywhere in the file and begin with a '#' and extend to the end of that line.
Examples:
M 0
{
#alternates the first and last 8 light controls
(1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1)
}M 1
{
#Rainbow up
(1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
(0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
(0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0)
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1)
}
The complete grammar is as follows:
A Program command consists of a P followed by a '{', set of sequence commands, and then a '}'
A sequence command may be either a sequence tuple or a loop command
A sequence tuple begins with a '(', followed by space-separated length, period, and mode values, and ending with a ')'
A length is an integer value, from 1-255, specifying the number of .1 second intervals that one wants to play that specific mode.
A period is an integer value, from 1-15, specifying the number of .1 second intervals between state changes within a mode.
A mode number is an integer value, from 0-15, specifying which mode to load and play.
A loop command begins with an 'L' followed by a loop value then a '{' and a set of sequence commands, ending with a '}'.
A loop value is an integer value representing the number of times that particular sequence is to be repeated. A loop value of '0' is a special value representing an infinite loop.
Comments may be placed anywhere in the file and begin with a '#' and extend to the end of that line.
Examples:
P
{
#this program will run mode 0 for 10 seconds and then repeat mode 1 forever
(100 2 0)
L 0
{
(32 2 1)
}
}P
{
#this program will play mode 0 then mode 1 and repeating 5 times before stopping
L 5
{
(30 2 0)
(32 2 1)
}
}