The following challenge is basically a simpler version of the one proposed by Dennis (Lossy ASCII art compression). I found the idea super interesting but a bit too convulted, and seeing as it didn't seem to be getting much attention I decided to modify it a little bit.
You'll be downloading 5 ASCII art text files, each of them composed only of the following characters:
Each char represents a different brightness level (1-10 from @ to the whitespace).
Given a quality ratio q, which varies from 0.5 to 0.9 in 0.1 increments, your job is to output a compressed version of each ASCII file, while making those files able to decompress themselves.
That is to say, ImageX.txt is compressed by Program.py into CompImageX-xx.cpp (xx being the quality of the compressed image). Once CompImageX-xx.c is executed, a final decompressed image ImageX-xx.txt is created.
The .py and .c extensions are just an example, you can write the compressor and compressed images in any language that you want (doesn't have to be the same language for both, but you can't use different languages for different images).
The quality changes the image output in a relatively simple way. We'll call the array of usable chars Arr. Each char of ImageX becomes Arr[RoundHalfDown((Arr.Index(char)*q))], with the exception of the whitespace which remains the same no matter the quality.
RoundHalfDown(0.6) = RoundHalfDown(0.7) = RoundHalfDown(1) = 1 RoundHalfDown(0.5) = RoundHalfDown(0.4) = RoundHalfDown(0) = 0
For a short example:
at q=0.5 would become
You have to implement your own compressor, can't use any libraries that handle it for you.
Your score is the square root of the size of your compressor, multiplied by the sum of the size of all the compressed files --> sqrt(c)*sum(f). Lowest score wins.
USER LANGUAGE SCORE Dennis CJam 1046877