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 – 2016-11-17T20:32:21.500
@Oliver :D :D :D – noɥʇʎԀʎzɐɹƆ – 2016-11-17T20:32:38.917
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 – 2016-11-17T21:09:11.213
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 – 2016-11-17T22:12:45.3271@ais523n I removed it, it makes the challenge too easy. – noɥʇʎԀʎzɐɹƆ – 2016-11-18T17:06:23.893
Note: The accept goes to the shortest answer, but the bounty may go to an answer I believe is more creative. – noɥʇʎԀʎzɐɹƆ – 2016-11-18T21:31:06.607
Can program A and program B be the same? – Oliver Ni – 2016-11-21T02:22:53.710
@Oliver Sure, why not? – noɥʇʎԀʎzɐɹƆ – 2016-11-21T12:38:57.307
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 – 2016-11-22T18:10:04.573
@mbomb007 You have invested a lot of time. – noɥʇʎԀʎzɐɹƆ – 2016-11-22T22:10:45.503
@mbomb007 Bounty has ended; accept is still up for grabs – noɥʇʎԀʎzɐɹƆ – 2016-11-24T20:21:47.750
@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 – 2016-11-24T21:49:02.850
1@CrazyPython Finished. I started over from scratch yesterday with a different strategy. It ended up being a LOT shorter and easier. – mbomb007 – 2016-12-08T16:44:00.090
1Can
Wrong language!
be output in any form (i.e. all caps, all lowercase, etc.)? – R. Kap – 2016-12-22T04:37:01.530