27
2
A radioactive quine is a quine-like program that has an even number of characters and, when run, outputs itself with exactly half of its characters removed.
The output itself may be a radioactive quine, so the program can "decay" multiple times.
It could be said that the half-life of a radioactive quine is one run, up to a certain number of runs (decays).
Example
The Python 2 program (28 characters)
1234;print'print\'abcdefg\''
is a radioactive quine with 2 decay steps because when it is run it outputs
print'abcdefg'
which is the original program with these 14 characters removed: 1234;print'\\'
.
When print'abcdefg'
is run in turn it outputs abcdefg
which is print'abcdefg'
with the 7 characters print''
removed.
The program abcdefg
is not a radioactive quine so the cycle has come to an end.
Challenge
Write a radioactive quine in 1024 characters or less that has the most decay cycles.
The 1024 character limit means that the maximum number of decay cycles possible is 10 since the
1024 → 512 → 256 → 128 → 64 → 32 → 16 → 8 → 4 → 2 → 1
decay pattern would be optimal.
The example above has 2 decay cycles.
Details
- Just like normal quines, radioactive quines may not take input or read their own source.
- All output must go to stdout or your language's closest alternative.
- You may use any characters. It is not limited to ASCII.
- The characters in a radioactive quine that are removed may be removed from any indices (but the remaining characters may not be rearranged). So
radquine
could decay intoradq
oruine
orrdui
orrain
, etc. - Note that only a program with an even number of characters can possibly be a radioactive quine.
- It's fine if the final output of the decay cycle (
abcdefg
in the example) has an even number of characters. It doesn't matter what happens when this output is run as a program.
Winning
The winner will be the submission with the most decay cycles.
Update: Since trivial answers are possible I'm following yasen's advice and saying that in case of ties, the starting radioactive quine with the most unique characters wins. (Naturally 1024 is the limit here.)
In the rare chance there is still a tie, the highest voted answer wins.
10It may be a good idea to rank the answers by amount of distinct characters in case of a tie in the decay cycles. – yasen – 2014-09-13T08:09:41.157
1@yasen Great idea. I've added that rule. – Calvin's Hobbies – 2014-09-13T17:48:26.523
2Great, now I got the Radioactive cover by Lindsey Stirling and Pentatonix stuck in my head. At least it's not Rebecca Black or Justin Bieber. Welcome to the new age, I guess... – Nzall – 2014-09-15T13:54:52.297