Task
Encode a string that entirely consists of uppercase alphabets (A-Z
) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple!
Rules
- Your program/function must correctly handle any valid input string of length 8.
- The results must have the same length for all inputs.
- The results must be distinct for distinct inputs.
- The results must be as short as possible.
- The results must be zero-one balanced (have number of ones similar to that of zeros). They don't have to be equal (i.e. perfectly balanced), but your score will be penalized for that.
You don't have to provide a program/function that decodes your encoding.
Input and Output
- You can decide to accept any set of 26 distinct printable ASCII characters instead of
A-Z
. - You can decide to output any pair of distinct printable ASCII characters instead of
0
and1
. - You are not allowed to output an integer instead of a bit string, since it may have leading zeros and it's unclear if you actually met the rule 2.
- If you decide to deviate from the default (
A-Z
input and01
output), you must specify the input/output character sets in your submission.
Scoring
- Base score: Code size, or 1 if your program happens to be empty.
- Penalties
- Penalty for length: multiply
1.5 ** (encoded length - 42)
- There is no bonus for being shorter; 42 is the minimal length for a perfectly balanced encoding of 8-length strings with alphabet size 26.
- Penalty for being unbalanced: multiply
2 ** max(abs(ones - zeros) for every valid input of length 8)
, whereones
andzeros
are the counts of 1 and 0 in each output, respectively. - Your submission must either show a worst-case example (input/output) or theoretical explanation on the penalty value.
- Penalty for length: multiply
- The lowest score wins.
Example Submission
Hypothetical esolang, 0 Bytes, Score 74733.8906
Here is a hypothetical esolang, where an empty program prints out all the ASCII codes of input's characters in binary.
For example, if you give AAAAAAAA
as input, the program will print 1000001
8 times in a row, i.e. 10000011000001100000110000011000001100000110000011000001
.
The input alphabet is chosen to be CEFGIJKLMNQRSTUVXYZabcdefh
. This way, all of the chars are converted to seven digits in binary, and the zero-one counts differ only by one per char (they all have three 1's and four 0's or vice versa when converted to binary).
The output length is always 56, and the worst-case unbalance occurs on the inputs like CCCCCCCC
, where zeros appear 8 more times than ones.
Therefore, the score of this submission is 1.5 ** (56 - 42) * 2 ** 8 == 74733.8906
.