18
3
Challenge:
Write a code that, when executed will output the source code of a second program that can be executed in another language. The second program should output the source code of a third program that can be executed in a third language and so on. The last program should output PPCG with an optional single trailing newline.
The winner will be the submission with the most languages. Code length of the first program will be the tie breaker.
Important rules:
- No programs can be identical
- Each language must only work on one of the source codes. It should be impossible to use the same language two places in the chain without breaking it(see examples).
- A shortened chain is not a broken chain. If you can use a language in a different place than intended and the end result is still PPCG then it's invalid
- All versions of a language count as unique languages (but keep in mind rule number 2)
Examples:
An invalid submission:
print("""print'disp("PPCG")'""")
- Python 3:
print("""print'disp("PPCG")'""")printsprint'disp("PPCG")' - Python 2:
print'disp("PPCG")'printsdisp("PPCG") - Octave :
disp("PPCG")printsPPCG
This works properly, but: you can run both the first and the second code in Python 2 without breaking the chain, so this violates rule number 2.
A valid submission with score 3:
print("""print'disp("PPCG")'""")
- Python 3:
print("""print'disp("PPCG")'""")printsprint'disp("PPCG")' - Perl :
print'disp("PPCG")'printsdisp("PPCG") - Octave :
disp("PPCG")printsPPCG
This is the exact same code as the invalid example. The difference is, we have chosen languages that adhere to rule number 2: You can't run the first code in Perl/Octave, the second code in Python 3/Octave nor the last code in Python 3/Perl. This is valid even though Python 2 can run the two first programs, because we haven't used Python 2 as one of the languages.
Related, but not a duplicate. – Stewie Griffin – 2017-01-24T22:21:43.520
Related, possible duplicate. Practically the same challenge, but the scoring system takes into account the length of the code. – ETHproductions – 2017-01-24T22:26:04.583
3Ah yes, I hadn't really noticed rule 2. That makes it definitely not a duplicate in my eyes. – ETHproductions – 2017-01-24T22:32:17.117
1Rule 2 makes Rule 1 redundant. – Pavel – 2017-01-24T23:27:10.850
It's unfortunate this challenge has the no-repeats rule, which is novel, but ALSO has the "must end with PPCG" instead of it being otherwise a normal ouroboros challenge. – Sparr – 2017-01-25T02:01:43.437
The final output of PPCG can optionally have a trailing newline. Can the intermediate stages have trailing newlines that "don't count"? E.g. if stage 2 outputs a trailing newline, must that newline be included in the stage 3 code? – DLosc – 2017-01-25T10:20:20.670
Yes, that's ok. You don't need to include trailing newlines in the code in the intermediate stages. – Stewie Griffin – 2017-01-25T10:29:16.993