> Allocate one magic number for "start line with space" another for "start line with asterisk" then any other number means this many of the current character and then swap character.
The galaxy brain move would be to always arbitrarily start with one character, replace the two special numbers with a single "don't output any characters, just swap" number, and then... congratulations, you just reinvented CompuServe RLE!
While the idea of using RLE with implicit swapping is the same, everything else is different. I'm not sure it's better in this case. One thing my version did is that it had explicit linebreaks, this approach was chosen as the map in the article had lines of varying lengths. If you don't now you have to accomplish that some other way, e.g. explicitly fill the line up with spaces and some mechanism of communicating the width of the image.
I also think using a varint encoding is a big win over fixed-width.
The galaxy brain move would be to always arbitrarily start with one character, replace the two special numbers with a single "don't output any characters, just swap" number, and then... congratulations, you just reinvented CompuServe RLE!
http://fileformats.archiveteam.org/index.php?title=CompuServ...