Introduction
A polyglot is a program that is valid in multiple languages at once. An iterative quine is a program that outputs another program that outputs another program that outputs the source of the original program. Note that the number of chained programs does not have to be 3; it could be 2, 4, or 97384.
Challenge
Your task is to write a polyglot iterative quine. Each program in the program chain must be a polyglot.
- Each of your programs must take no input.
- As stated above, each of the programs must output the source of the next program in the chain. The last program in the chain must output the source code of the first program.
Scoring
Your score is calculated as follows:
- For each program in the chain, take the number of languages it is valid in. Sum the results.
- Sum the byte count of each program in the chain.
- Divide the byte count by the number from the first program.
Rules
- The length of the chain must be at least 2.
- Each program in the chain must be valid in at least 2 languages.
- The program with the lowest score wins.
- "Different language" is defined as follows:
- A language where the source code of the compiler or interpreter is not the same as another, and the compiler or interpreter does not run the same language as another. Some examples of different languages are: Python 2 and 3, C and C++, Java and C, and Lua and Ruby. However, by this definition, using
tcc
instead ofgcc
does not count as a different language, becausetcc
runs the same language asgcc
: C.
- A language where the source code of the compiler or interpreter is not the same as another, and the compiler or interpreter does not run the same language as another. Some examples of different languages are: Python 2 and 3, C and C++, Java and C, and Lua and Ruby. However, by this definition, using
- Programs are allowed to throw errors, but only after they print out the output of the program. For example,
print(1/0);print(<quine stuff>)
in Python 3 would be invalid, butprint(<quine stuff);print(1/0)
would be.
print(1/0)
considered valid in Python 3, for example? \$\endgroup\$#
, does my score suddenly decrease because it can be run in hundreds of different languages with erroring? On the other hand, my><>
program works perfectly fine but terminates in an error (which is also fine by community standards). Perhaps you should just say the program has to output the next program in the sequence for each language and leave it at that? \$\endgroup\$