As most PPCG regulars will know, a quine is a program which outputs its own source code when run; and the Levenshtein distance between two strings is the minimum number of insertions, deletions, and edits needed to change one string into the other. In this challenge, we're combining the two concepts into a "levenquine": a program that outputs its own source code, but with one instance of one character inserted, deleted, or replaced with a different character. (In other words, the Levenshtein distance between the program and its output is 1.)
Write a levenquine such that its output is a levenquine, the output of that program is also a levenquine, and so on. Additionally, at some point, the sequence of repeatedly running the program, running its output, running its output's output, etc. must eventually come back to the original program.
There's one additional restriction that makes things much harder: there must be two distinct programs somewhere within this cycle which have no characters in common (in other words, there's no character that exists within one program and also exists within the other program). Your program is therefore going to have to gradually transform itself into a different character set, and back again.
If you're using a programming language which has unavoidable boilerplate that's required in any program that produces output (e.g. it only has one way to write a
- Each of the "programs" in the cycle can be either a full program or a function. They don't all have to be the same, e.g. some could be full programs and some could be functions.
- Not all the programs in the cycle need to use the same form of output. For example, some could output via standard output, and some could output via standard error.
- Your programs will be run with no input (or in languages which require input to do anything at all, the simplest possible input).
- Proper quine rules apply; although a Levenquine is not a true quine, you may not do anything that would be illegal when writing a proper quine. In particular, the null program is never valid output from a proper Levenquine (and thus cannot be part of your cycle).
- The Levenquine restriction is measured in terms of characters, rather than bytes (e.g.
êis one character even when the source is encoded in UTF-8). The no-characters-in-common restriction is also measured in terms of characters. The victory condition, however, counts in bytes.
Please submit at least the following three programs from the cycle: the shortest program (measured in bytes); and two programs from the cycle that have no characters in common. It's possible that two of these are the same, and it's also possible that all three are distinct. The score is based on the length in bytes of the shortest program, with shorter being better, thus making this a kind of code-golf competition.