One of easiest code written by a programming language is a program printing sequence of characters (ex. "Hello, world!"). However, some esoteric programming languages like Brainfuck, even this simplest code is quite annoying to write.
Your task is to write a program (don't have to written in brainfuck), which prints a (minimum-length) Brainfuck program printing the given text.
Input
A sequence of characters (between 1 and 255) is given by any format (variable, argument, stdin, file, ...).
Output
Output is a valid (no non-matching [ and ]) brainfuck code (assume unsigned 8-bit wrapping cell and unlimited number of cells to left and right) printing exact string that was given as input.
For example, one possible output for input A is ++++++++[<++++++++>-]<+..
Your program shouldn't take long time (>2m) to run.
The BF program shouldn't take long time (>10s) to run.
Scoring
(Notice : current scoring method may change, since it is not easy to calculate...)
The length of program (generating BF code) itself doesn't matter. However, hard-coding BF codes in the program code is not OK. Only acceptable range (ex. a BF code printing a single character 0x01 : +.) of BF codes might be hard-coded.
The score is sum of length of BF codes printing these strings.
- A string
Hello, world!appended with a single0x0A(\n) (i.e. the "Hello, world!" program) - Single character from
0x01~0xFF - Sum of length of these 255 BF codes are multiplied by
1/16, rounded, and added to the score. - List of first 16 strings, generated by splitting a random sequence of bytes generated on 11-11-11 by
0x00, removing all zero-length strings. - Lenna.png, removing all
0x00s. - Lyrics of the song 99 bottles of beer, starting with
99 bottles~, newlines are0x0A, paragraphs are separated by two0x0As, and no newline character at the end. - Other strings you may provide.
Your program may include calculating the score of itself.
Of-course, lowest-score code will be the winner.