intmain() { char* ancher = "#include <stdio.h> int main() { char* ancher = "?"; for (int i = 0; ancher[i]; i++) { if (ancher[i] == '?') { printf("%s", ancher); } else { printf("%c", ancher[i]); } } return 0; }"; for (int i = 0; ancher[i]; i++) { if (ancher[i] == '#include <stdio.h> int main() { char* ancher = "?"; for (int i = 0; ancher[i]; i++) { if (ancher[i] == '?') { printf("%s", ancher); } else { printf("%c", ancher[i]); } } return 0; }') { printf("%s", ancher); } else { printf("%c", ancher[i]); } } return0; }
No, it doesn’t. What’s the difference? It print twice and there is no
escape of \n, \ and ", they are
all be the real control characters
Why twice? Because there are two ? in the text, we check
the question mark by ?, that’s easy to fix, we could use
the ascii of ?, which is
But how could we solve the escape issue? Notable thing is, we don’t
want the escape happened in the text part rather than the normal code
part.
So we need to manually do the replacing part. It’s basically what the
js code do.
Escape twice
Now the code is identical to the code shown earlier in the Implement section.
What’s next
Yes, there are many other ways, and may transform from one language
to another then back to the original, which is quine relay.
quine-relay there
is an implement of 128 language quine relay
But the method in this article can be use for other languages to make
a single quine. It feels very much like a “Whack-a-Mole” game: fixing
one problem causes another to appear.