ENTROPX - a pretty limited drawing language

Author: Mario Klingemann - @Quasimondo

ENTROPX is a minimalistic language designed to create pixel and glitch art. Letters of the alphabet move the brush by a certain x/y offset, their distance and direction can be looked up in the grid below.

Presets: Show Cursor Draw to Cursor

ENTROPX-Code:

q p i x l
b e s t d
u m o g
w a n r k
v j h c f

Compressed ENTROPX-Code:

Commands a-x and A-X
Lowercase letters move the cursor and set a pixel, uppercase letters just move the cursor but don't draw anything. The drawing always starts with an empty 1x1 canvas and the image will recenter and resize itself automatically based on the set pixels.

Numbers 0-4096
Prepending commands with a number will repeat them that many times - "8o" for example will draw an 8 pixel horizonal line. The maximum limit of 4096 is arbitrary, but put in place to prevent the creation of huge bitmaps in particular when glitching is used.

Command '@'
A '@' is the control code to change the current paint color. A '@' can either be followed by a letter or one or more numbers. The letters a-z and A-Z stand for the numbers 0 to 51, so the command '@d' is equivalent to '@3'. The paint color is taken from the currently selected color palette. If the number is bigger than the colors available in the chosen palette the index will wrap around. The default color black is always '@0' or '@a'

Command ':'
A ':' is the control code to change the current color palette. Same like the color chooser a ':' can either be followed by a letter or one or more numbers. The default color palette is ':0' or ':a'

Command '='
The '=' is a control code and will use the immediately following numbers or letter to change the cursor to a special brush. So for example the command '=1' will pick brush #1 which is a fat 2x2 pixel - alternative this can be written as '=b'. Note: switching a brush will not also draw it. Furthermore some brushes are drawing around the current pixel, others (like bigger pattern fills) will use the current pixel as the top left corner.

Command '#'
A '#' will draw the brush at the current location. With the default 1 pixel brush this will not make any visible difference, but with the other brushes this allows for some interesting combinations.

Commands '+' and '*'
The characters '+' and '*' will apply a bucket fill at the current position using the current color. The '+' will not fill across diagonally connected pixels, whereas the '*' will do that. Since the canvas does not really have a boundary, the bounding box of the currrently set pixels will be the outer limit for the fill.

Command '!'
The character '!' has a special meaning: every occurrence of '!' will be replaced with a random letter from the range a-x,A-X, this can be used to introduce random glitches into the pixture. The replacement takes place in the ENTROPX.decode() routine so the resulting image will always be different whenever the string is decoded again.

Command '.'
The character '.' will move the cursor back to the starting point.

Command ';'
The character '|' will set the current cursor position as the center for the symmetry draw mode, the default center is at 0/0

Command '|'
The character '|' followed by a number will set the symmetry mode: 0 = no symmetry, 1 = horizontal, 2 = vertical, 3 = horizonal + vertical. As with the other commands, the numbers can be replaced by letters.

Command '()'/'[]'
Anything inside brackets will define a pattern. The pattern will be added to a temporary list of patterns and get an index based on the order of definition. The first pattern will get index 0 or 'a', the second pattern will get index 1 or 'b' and so on. Since you can use patterns inside of patterns it is theoretically possible to create infinite loops which is why there is the MAX_CODE_LENGTH limit that stops the recursion once the resulting code gets too long. Also note that if you are having leading or trailing numbers in a pattern it's a good idea to prepend or append a "_" to avoid merging neighboring numbers that might emerge from consecutive patterns. The difference between the parantheses and the square brackets is that () will not draw the pattern when it is defined whereas [] will also draw it immediately.

Command '%'
The '%' followed by a number or letter code will draw a previously defined pattern. If the index is higher than the number of defined patterns it will wrap around. If there are no defined patterns at all the command will be ignored. Since the processing is sequential you cannot use a pattern before it is defined e.g. "(oonnmmss)%0" will work, but "%0(oonnmmss)" will not. Note that inserting a pattern will change the cursor position depending on the relative final cursor position of the stored pattern.

Special character '_'
The underscore '_' can be used to separate numbers. For example when first switching a brush and then drawing it repeatedly: '03_4f'. This necessary since '034f' would mean 'use brush 34 and paint it at offset 2/2'. Don't use spaces to separate numbers since those will be cleaned from the code before the rendering.

Unknown characters
Unknown letters, spaces or line breaks will be simply ignored and processing skips to the next known command. There are no error messages.

Compressed ENTROPX - '$'
ENTROPX has also the option to use LZW compression, the LZW-compressed version starts with a "$" and can be seen in the smaller text edit box. For some unexpected glitch effects you can also directly edit inside the LZW code. Note that compression only works for the entire string, you cannot use compressed strings inside of patterns.

About
ENTROPX is inspired by the concept of Freeman chain codes and PCC line coding as well as L-Systems but is designed to use a charset that is within the printable (and tweetable) code range and offers opportunities for introducing interesting glitches easily. It also adds the option to use colors as well as some other features that are useful for creating pixel art. Another design deliberation was to generate code that can be used to train RNNs or LSTMs for teaching machines how to draw like humans.

When saved to a file, the desired suffix for the ENTROPX format is ".epx" which seems to be already used in the past for some 3d model files but I honestly don't care.

Brushes:
Color Palettes: