Halve Code Regen
TODO: This is a horrible title.
Your challenge is to write a program, and when I half the program, the output must stay the same. Then, I will halve it and add the last two characters, and the output should be the same with the program's last two characters at the end.
Sometimes the code can't be halved evenly, and when that happens, I will do something similar to floor division:
blahy => bl
horse => ho
meddle => med (regular halving)
oof => o
Example for "the output should be the same with the program's last two characters at the end"
Let's say we have this code:
q|w_a2e(o+2ei2ere
and the output is
q|w_a2e(o+2ei2ere
when I change it to
q|w_a2e(o+2ei2erere
by adding the last two characters (re
), the output should look like
q|w_a2e(o+2ei2erere
(Note the extra re
at the)
Rules
- No padding with comments
- The program must have at least 2 characters.
- Standard loopholes apply
- The output cannot be empty.
Scoring
This is code-golf, so the answer with the least bytes wins.
How I came up with the random code in the example two sections ago
q
means quine. |
is a separator. w_a2e
means when the last two characters are added to the end. (o+2e
means add the last two characters to the end. i2ere
means ignore a repeated 2e
at the end.
Meta
- Is this even possible?
- If so, any other suggestions?