32
4
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C.
Program B, when run in language B produces Program A, and running program B in language A produces program C.
Program C, when run in language A or language B, prints "Wrong language!".
Program | Language | Result
--------|----------|----------
A | A | Program B
B | B | Program A
A | B | Program C
B | A | Program C
C | A | "Wrong language!"
C | B | "Wrong language!"
Your answer should use this template:
Language A/Language B, {a bytes} + {b bytes} = {total bytes} bytes
Program A:
a code
Program B:
b code
Program C:
c code
Source:
# Language A/Language B, <a bytes> + <b bytes> = <total bytes> bytes
Program A:
a code
Program B:
b code
Program C:
c code
- None of these programs should take input.
- Different versions of the same language do count as different languages. (although this is discouraged because it leads to boring solutions)
- Languages A and B must be distinct.
- You must not read your own source code from a file. Programs may not be empty
- Standard loopholes apply.
Hints
- C++ and [Python/Bash/other
#
commented languages] are good combos because you can define macros that one language can ignore
This is code-golf, so the smallest sum of the byte counts Program A and B wins.
I'm working on this... – Oliver Ni – 8 years ago
@Oliver :D :D :D – noɥʇʎԀʎzɐɹƆ – 8 years ago
Are the programs allowed to exit via crashing? (That is, running an invalid command and thus ending, with errors spewed to STDERR.) Polyglots are typically much easier if this is allowed. – None – 8 years ago
6
@CrazyPython Don't do penalties or percentages. Simply allow it, or don't. Percentages make scoring no longer [code-golf]. http://meta.codegolf.stackexchange.com/a/8106/34718
– mbomb007 – 8 years ago1@ais523n I removed it, it makes the challenge too easy. – noɥʇʎԀʎzɐɹƆ – 8 years ago
Note: The accept goes to the shortest answer, but the bounty may go to an answer I believe is more creative. – noɥʇʎԀʎzɐɹƆ – 8 years ago
Can program A and program B be the same? – Oliver Ni – 8 years ago
@Oliver Sure, why not? – noɥʇʎԀʎzɐɹƆ – 8 years ago
I'm working on a Python/Retina solution, and it's taking me to hell and back. I've already spent more than 12 hours on it. If I should succeed, I can guarantee it won't be readable by the average PPCG user. – mbomb007 – 8 years ago
@mbomb007 You have invested a lot of time. – noɥʇʎԀʎzɐɹƆ – 8 years ago
@mbomb007 Bounty has ended; accept is still up for grabs – noɥʇʎԀʎzɐɹƆ – 8 years ago
@CrazyPython There's no way it'd be that short. Program A is at least 1300-1400 bytes right now, and B is longer. I've been working on it off and on, but I take big breaks for sanity now. – mbomb007 – 8 years ago
1@CrazyPython Finished. I started over from scratch yesterday with a different strategy. It ended up being a LOT shorter and easier. – mbomb007 – 8 years ago
1Can
Wrong language!
be output in any form (i.e. all caps, all lowercase, etc.)? – R. Kap – 8 years ago