Below, you can find another hint for the Generalized Challenge.
You should only get here after reading, digesting, and applying the .
The self-reproducing program in Hint 39 contains various write statements. These are executed in such a way that together they reproduce a copy of the entire program.
In particular, we encounter the following write statements:
writequ(); writeln('+'); write(' '); write(ESC); write(c); writeln();
We could make some changes to the write statements to do some other processing. For instance, in order to produce the shadow, we could respectively replace these statements as follows:
writequ(); --> write('W'); writeln('+'); --> writeln('W'); write(' '); leave as is write(ESC); --> write('W'); write(c); --> if (c == ' ') write(c); else write('W'); writeln(); leave as is
Complete the transformation of a self-reproducing program into a well-structured program that outputs its own shadow. And then see if you can do it in an even better, more general, way.
It is your turn ...
If you have no idea how to get started, or if you tried some programs and do not see how to proceed, then you are ready for the .