# Overlapping Polyglots

Unlike many C&R challenges, this does not require a separate robbers post; the goal of the robbers is to crack the previous answer and then post a new one as a cop.

As answerers, you will write a series of polyglots that look like this (each column is a language, and each entry is the output of the answer in that language):

Language:  1  2  3  4  5  6  7  8  ...
...


(blank spaces mean that no behavior is required in that case).

Each answer should work in 3 languages and print 3 different consecutive numbers which are each one more than the numbers printed by the previous answer (the first answer prints 0, 1, and 2). Each answer uses two languages from the previous submission, and a third new language. The answerer should try to obfuscate what this third language is.

To post a new answer, you should:

• Crack the most recent answer by finding what its third language is.
• Preferably, add an explanation for your crack and notify the poster of the answer. Once your submission has been cracked, you should preferably add an explanation as well.
• Write a polyglot consisting of this answer's second and third languages, along with another language of your choice. Reveal your first two languages, but do not reveal your new one. It will be the next poster's goal to find this language (or any other language in which it works), so you should try to obfuscate it.

## Specifications

• The criteria for a valid programming language are the same as those of The Programming Language Quiz, Mark II - Cops:

• Each answer must run in less than a minute on a reasonable PC.

• You can reuse programming languages, but there must be at least two answers in between (so an individual answer cannot reuse a language).
• Cracking a submission consists of finding any programming language that prints the correct result, not just the intended one. If a submission is run in any language that was not declared or found to work, there are no requirements to do anything.
• You may not post twice (or more) in a row.

## Winning Criterion

The winning answer is whichever answer took to most time to be cracked. The challenge will never end, so it is always possible for the winning answer to change.

• Opened a chatroom for discussion about possible cracks and building polyglots. – Bubbler Sep 10 '18 at 23:35
• Can the answer output other things apart from the desired number? – NieDzejkob Sep 30 '18 at 9:21
• @NieDzejkob No, the program should only output the number, and yes, I'd prefer if the programs ran in under a minute. – Esolanging Fruit Oct 13 '18 at 10:59
• Here's a SEDE query that calculates the amount of time the answers stayed safe (in hours). – NieDzejkob Oct 15 '18 at 20:50
• @EmbodimentofIgnorance Yes, you can require command-line flags as they essentially define separate interpreters, and yes, the program must print only the number. The program may output to STDERR, but only the output to STDOUT is relevant. – Esolanging Fruit Feb 17 at 8:53

# Hexagony, Klein (101) and ???

  xx={puts/}
gets87!@xx=p

main\

>9.*5,6v


This prints 7 in Hexagony, 8 in Klein (101), and 9 in ???.

The 9 does not work if a newline is added at the end of the code. Be careful if you're testing locally.

Edit: Being live for 20 hours is already a record, so I'll give some hints from now on. (Also because the language in question is IMO not yet well-known.)

### Hints

1. "The 9 does not work if a newline is added at the end" is very significant, as well as the first two spaces (which are ignored by both Hexagony and Klein).
2. The language is on TIO.
3. The first two spaces make the program jump to the last line. (It's not a 2D language.)
4. There's no explicit output command, and the v command ends the program.

### Explanation (cracked post)

In the source code

abcd={} -- a gaffe avoiding tactic in C++/C#
abcd[!1]=   1+2+3+4+5+6+7+8+9+10+11+12+13+17!
print(abcd[0>1+2+3 and 4+8+6<0-0]//35)
if 0>1 then a.next=';' en\
>1+6.@.@


The relevant instructions in Klein (101) are:

IP->.....................^...........IP->/
.........................|...................
.........................8
.........................\<-.............IP<-
@


Klein is fungelike 2D language where crossing the boundary of code area (which is a square) depends on the Klein topology. / and \ are mirrors.

The IP starts at upper left corner facing right. It meets a mirror towards the top boundary, and re-enters the code area on the right side as shown above. Then it hits the mirror again, 8 is pushed, and then (after passing through the boundary several times) stops at @. Then the content of the stack is printed to stdout, which is single 8.

# Befunge-96, Hexagony and ???

abcd={} -- a gaffe avoiding tactic in C++/C#
abcd[!1]=   1+2+3+4+5+6+7+8+9+10+11+12+13+17!
print(abcd[0>1+2+3 and 4+8+6<0-0]//35)
if 0>1 then a.next=';' en\
>1+6.@.@


This prints 6 in Befunge-96, 7 in hexagony and 8 in ???.

### Explanation

The hexagony code, when "prettified" is:

       a b c d = { } -
- a g a f f e a v
o i d i n g t a c t
i c i n C + + a b c d
[ f a l s e ] = 1 + 2 +
3 + 4 + 5 + 6 + 7 + 8 + 9
+ 1 0 + 1 1 + 1 2 + 1 3 + 1
7 ! p r i n t ( a b c d [ 0 >
1 + 2 + 3 a n d 4 + 5 + 6 <
0 - 0 ] / / 3 5 ) i f 0 >
1 t h e n a . n e x t =
' ; ' e n d > 1 + 6 .
@ . . . . . . . . .
. . . . . . . . .
. . . . . . . .


The path of execution begins in the top left heading East. The top row doesn't do much. - changes the current memory edge so the value in it is 0. Execution continues heading east on the middle row where 7! loads 7 in the current memory edge and prints is as an integer. [ changes the instruction pointer to North East starting back at 7. After 7+3, execution then reaches [ which changes the instruction pointer to North West starting in the South East corner. Finally the path is ..@ where @ terminates the program.

# Lua, brainfuck, ???

abcd={} -- a gaffe avoiding tactic in C++
abcd[false]=1+2+3+4+5+6+7+8+9+10+11+12+13+14
print(abcd[0>1+2+3 and 4+5+6<0-0]//35)
if 0>1 then a.next=';' end

Prints 3 in Lua, 4 in brainfuck and 5 in ???.

Explanation for cracked post:

a=1+2+3+3+4+5+6+7+8+9
b=1+1+1
f=3--(-1)
c=7+9+13+11+12+3--1
g=a+b+c+1+2+3+4+5
j=9+7+g+c+b+a+g+g+g+g+g+g+1+2+3+4+1+1
h=1+1+1+1+333+1+1+1+111+1+1+1+333+1+1+1+1+1.
print(f)
• In Python 3, 3--(-1) is 2, so print(f) prints 2 (the other stuff is unnecessary)
• In Lua, -- again is a comment, so 3--(-1) is just 3, so print(f) prints 3 (other stuff is again unnecessary)
• In brainfuck, there are 57 plusses and 5 minuses setting the first cell on the tape to 52, and the . outputs character 52 which is 4.
• +1 and Cracked – Zacharý Sep 9 '18 at 11:50

# Trigger, JavaScript and ???

[ //aТ/\\ ][ //е"6
console.log(111-111+12)]
//!'!/-²6-²52


Prints 11 in Trigger, 12 in JavaScript, and 13 in REDACTED.

Since this has not been cracked for longer than any other answer so far, here are some hints:

• In case you didn't notice, the Т and е on the first line are multibyte characters.
• [ // and \\ ][ // are no-ops.
• The second line, as well as -²52, is dead code.
• The language does not have a concept of termination, so ²6 forms an infinite loop.
• To be specific, the second byte of the UTF-8 encoding of ², together with the 6, forms an infinite loop.
• The number being outputted is encoded by the /!'!/
• The language is not on Try It Online, Rosetta Code or Esolangs.
• The only available form of output is a 1bpp screen.
• The screen's aspect ratio is 2.
• While the language was not originally intended as machine code, FPGA implementations do exist.
• According to Wikipedia, the intended purpose of the language were video games.
• The only way to access the screen is a special instruction, that takes coordinates in selectable registers, and the height as an immediate, and XORs an 8 by n bitmap onto the screen. To make collision detection easier, as well as make it possible to clear the screen, one of the registers will be set when any pixel gets set back to off.

## Explanation

Well, this took some time to get cracked. Let's see how the code looks:

0200 5b20    SE VB, V2   ; Skip the next instruction if VB = V2. Since all
0202 2f2f    CALL 0xF2F  ; registers start at 0, this call will be skipped. This
; hides the bytecode from JavaScript.
0204 61d0    LD V1, 0xD0 ; A useless load. Necessary to use a UTF-8 continuation
0206 a22f    LD I, 0x22F ; byte as an instruction and load the address of
; the sprite.
0208 5c5c    SE VC, V5   ; A red herring supposed to suggest symmetry is
; important, as well as a totally intended eliminator
; of inaccurate implementations. Most documentation
; claims that the lowest nibble must be zero, but in
; the original COSMAC VIP implementation it's
; a don't-care.


This means that, while many available emulators behave correctly, the by-the-rules implementation is linked to in the second sentence of the Wikipedia page. Of course, it can't be run directly on an average PC, but I've found the Emma 02 emulator linked to on the COSMAC VIP page to work the best.

020A 205d    CALL 0x05D    ; Skipped.
020C 5b20    SE VB, V2     ; Same as with the very beginning. Red herring.
020E 2f2f    CALL 0xF2F
0210 d0b5    DRW V0, VB, 5 ; Draw the sprite pointed to by I. Since V0 and VB
; haven't been written to yet, the sprite will be drawn
; in the top-left corner of the screen. The height is
; an immediate.
0212 2236    CALL 0x236    ; Jump over the JavaScript and Trigger code. It doesn't
; matter that we never return.
0214-022E *never used*
022F 2f      DB %00101111  ; Sprite data.
0230 21      DB %00100001
0231 27      DB %00100111
0232 21      DB %00100001
0233 2f      DB %00101111
0234-0235 *never used*
0236 b236    JP V0, 0x236  ; Since V0 is still zero, this is an infinite loop.
0238-023C *never used*     ; Together with the previous two lines, it's the
; -²6-²52. It's a red herring supposed to suggest
; prefix, or Polish, notation.

• Don't tell me this is machine code on some processor. – SIGSTACKFAULT Sep 21 '18 at 12:35
• @Blacksilver I've been assuming so since two hints ago - what else would look like this, not be on Esolang, but still be notable enough for Wikipedia? – Ørjan Johansen Sep 21 '18 at 18:31
• @Blacksilver OK. – NieDzejkob Sep 22 '18 at 8:51
• @ngm sorry, but no – NieDzejkob Sep 23 '18 at 9:23
• cracked, I believe, according to the rules. – ngm Sep 26 '18 at 18:26

# Python 2, Python 3, ???

a={1,2}
print(1+#a
--bool(1/2)
)


This prints 1 in Python 2, 2 in Python 3, and 3 in ???.

Crack explanation (Cracked post):

#define print(A) main(){puts("0");}
print(1+bool(1/2))

• 0: C: The first line defines a function-like macro print that ignores its single argument and evaluates to main(){puts("0");}, a full program that prints 0 and exits. The whole expression 1+bool(1/2) is ignored when the print( ) macro on the second line is expanded to main(){puts("0");}.

• 1: Python 2: The first line is a comment. 1/2 uses integer division in Python 2, giving 0. This value is then interpreted as a boolean (bool(0) -> False) and then added to 1 (1+False -> 1), and then printed.

• 2: Python 3: The first line is a comment. 1/2 uses float division in Python 3, giving 0.5. This value is then interpreted as a boolean (bool(0.5) -> True) and then added to 1 (1+True -> 2), and then printed.

# JavaScript, CHIP-8, and ???

[ //aТ/\\ ][ //е"6
console.log(111-111+12)]
//!'!/-²6-²52@++++2345


12 in JavaScript, 13 in CHIP-8, and 14 in ???

I'm going to go out on a limb and call this one cracked, although I can't quite get it to work I'm sure of the language (which seems to be what the rules ask for.)

Here is an imperfect explanation of the cracked post

The code in hexadecimal "is" (I might be slightly off):

[ 0x5b, 0x20, 0x2f, 0x2f, 0x61, 0xD0, 0xA2, 0x2f, 0x5c,
0x5c, 0x20, 0x5d, 0x5b, 0x20, 0x2f, 0x2f, 0xD0, 0xB5,
0x22, 0x36, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x2e, 0x6c, 0x6f, 0x67, 0x28, 0x31,
0x31, 0x31, 0x2d, 0x31, 0x31, 0x31, 0x2b, 0x31,
0x32, 0x29, 0x5d, 0x0a, 0x2f, 0x2f, 0x21, 0x27,
0x21, 0x2f, 0x2d, 0xb2, 0x36, 0x2d, 0xb2, 0x35, 0x32 ]


You can go here, click "Binary Tools" and paste this into the byte array box. Click "Decompile".

The key elements of the code are: instructions to say where the "number" is, the sprite command that prints the number, the correct amount of junk here and there, and the following:

: label-0
0x2F
0x21
0x27
0x21
0x2F


To see what this represents you can click "Sprite Editor" and paste these hexadecimals into the box underneath. You'll see the answer:

I'm pretty sure you can then put anything you like at the end and the CHIP-8 result will not change, hence the new entry.

I would be delighted if someone could get this fully working, rather than the "proof" of the answer I've given here.

• I'm gonna allow that. I'll edit in an explanation later today. Good job. – NieDzejkob Sep 27 '18 at 9:29
• Cracked – Jo King Sep 29 '18 at 11:50
• Also, your hexadecimal must be wrong since it does not decode as valid UTF-8... – NieDzejkob Sep 29 '18 at 19:56

# C, Python 2, ???

#define print(A) main(){puts("0");}
print(1+bool(1/2))


This prints 0 in C, 1 in Python 2, and 2 in ???.

This will be extremely easy to crack for people who know Python, but I wanted a starting-off point for other answers. Subsequent answers should try to obfuscate the third language (I did not do this).

# Python 3, Lua, ???

a=1+2+3+3+4+5+6+7+8+9
b=1+1+1
f=3--(-1)
c=7+9+13+11+12+3--1
g=a+b+c+1+2+3+4+5
j=9+7+g+c+b+a+g+g+g+g+g+g+1+2+3+4+1+1
h=1+1+1+1+333+1+1+1+111+1+1+1+333+1+1+1+1+1.
print(f)


Prints 2 in Python 3, 3 in Lua and 4 in ???.

Explanation for cracked post:

a={1,2}
print(1+#a
--bool(1/2)
)

• In Lua, -- is a comment. In Python 2 and 3, -- indicates double negative in arithmetic.
• In Python 2 and 3, # is a comment. In Lua, # is the length operator.
• In Python 2, 1/2 is floor division, so it evaluates to zero. In Python 3 this is not the case. Because both versions of Python evaluate 0 to False, bool(1/2) evaluates to False in Python 2 and True in Python 3. When used in arithmetic, False is cast to 0 and True is cast to 1.

# ><>, Befunge-96 and ???

abcd={} -- a gaffe avoiding tactic in C++
abcd[false]=1+2+3+4+5+6+7+8+9+10+11+12+13+17!
print(abcd[0>1+2+3 and 4+5+6<0-0]//35)
if 0>1 then a.next=';' end
>1+6.@


This prints 5 in ><>, 6 in Befunge-96 and 7 in ???.

I know the intended solution was Befunge-93, but I couldn't resist.

### Explanation:

Befunge-96 follows the same path as ><>, but ignores unknown instructions, ending up adding one to the 5 and multiplying it by 9 to get 54, the ascii code for 6.

• cracked – jslip Sep 9 '18 at 13:10

# Commentator, Beatnik, ???

// k... nak... naKaka pagpAbaGaBag

fn llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch(s: &String){
}

fn pneumonoultramicroscopicsilicovolcanoconiosis(){
}

fn main(){
let s = String::from("17");
let t = "Hi! I am a cat. AOOOWRRRWWW! Me need Whiskas! Noow! Mee hungry hast bekommen. Feedme! sudo !!. Sad... six cable hostage wire cable diediediediee #               */";
llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch(&s);
pneumonoultramicroscopicsilicovolcanoconiosis();
}


Outputs 15 in Commentator, 16 in Beatnik, and 17 in the hopefully one language you are supposed to find.

Okay, it's clue time:

• The name of the language refers to a compound of two elements, both of which make up your body, but with wildly varying percentages (which way depending on whether you're a robot).
• The language itself is on TIO, but the implementation isn't.
• Oh come on.
• Looks like Rust( fn main(), among other things), but it doesn't actually run in Rust (explicit lifetime required in the type of 's'), neither on TIO nor another interpreter I found. And I can't find any other language that uses fn as a function identifier. – Draco18s Oct 14 '18 at 18:34
• Huh, even the hint looks like Rust, which is a compound of Fe and O. I can't think of anything else. Maybe different compiler versions? – Bubbler Oct 18 '18 at 23:35
• I suspect this might be Rust compiled with mrustc, which is basically Rust without the borrow checker. – Esolanging Fruit Oct 20 '18 at 5:23
• @EsolangingFruit try it – NieDzejkob Oct 29 '18 at 20:57
• Three months later, I finally got around to cracking this – Esolanging Fruit Feb 2 at 8:54

# Brainfuck, ><>, and ???

abcd={} -- a gaffe avoiding tactic in C++
abcd[false]=1+2+3+4+5+6+7+8+9+10+11+12+13+14
print(abcd[0>1+2+3 and 4+5+6<0-0]//35)
if 0>1 then a.next=';' end
>1+9*,@


Prints 4 in Brainfuck, 5 in ><>, and 6 in ???

• In brainfuck, nothing changes.
• In ><>, v redirects the flow of the program downwards. The n is numeric output. ; ends execution.
• Cracked – Jo King Sep 9 '18 at 12:23

# Klein (101), Z80Golf, ???

!!8@e6v+4>9 \
Almost everything you can find on the internet is true
~Albert Einstein
~HUMAN IMAGE MACROS


# Beatnik, Rust, ???

fn avreg(){}
fn/*azxzzz avreg k zqyzzz ax quke
>>P0 ++puts++puts[pov]
\@�{>*}++puts++puts++puts++puts++puts++puts++puts++puts%
*/main(){print!("17")}


This prints 16 in Beatnik, 17 in Rust, and 18 in ???.

The � character on line 4 should be replaced with ASCII character 18 (this was not done in the TIO links since it's not relevant to either of them).

## Explanation (cracked):

The previous answer's language was Rust: specifically, Rust compiled with mrustc. mrustc is an experimental compiler, and as it is mostly intended for bootstrapping a valid version of rustc, it ignores borrow checking and mutability checking, allowing @NieDzejkob's snippet to compile without errors.

This program will work with the normal Rust compiler, so you don't need to install mrustc to test it.

## Hints

Since this answer has now gone the longest without being cracked, I'll leave a hint, and continue to do so regularly until it is cracked:

• It is a 2D language.
• While throwing languages at this at random (having not found much searching for "ascii codepoint 0x12 esolang"), I noticed that it actually outputs 15 in ><>, so that's neat – Unrelated String Mar 21 at 2:05
• It would appear that this doesn't print 18 in any language on TIO (without any header, footer, or command-line flags added at least). I do hope I didn't miss any, because it seems like it will probably be quite a bit harder to check through everything on esolangs, Wikipedia, and Rosetta Code... My best guess is that this is some sort of 2D language where either @, P, {, or m starts a character literal and something afterwards prints its codepoint in decimal, but that doesn't explain all of the ++s... – Unrelated String Apr 2 at 22:37
• @UnrelatedString Yes, I will confirm that it isn't a language on TIO. – Esolanging Fruit Apr 3 at 3:48
• Well, I might have wasted a day going through 100 languages on esolang.org trying to find one that fits... Then I read the ASCII 18 character thing and realized my approach was completely wrong as I searched for a totally different class of languages... – IQuick 143 Apr 19 at 17:23
• @IQuick143 herrings are red – Esolanging Fruit Apr 20 at 21:14

# Z80Golf, Somme, ???

!!8@e6v+4>9 \
1((111+111)/111)
00
~tz


This prints 9 in Z80Golf, 10 in Somme and 11 in ???.

Credit to Bubbler for cracking the previous post as Somme, which takes the column sum as the instructions. The first three columns evaluate to

A.;


Which pushes 10, prints it and exits.

# Somme, Trigger and ???

[,,E,D,,$,H,_,K,,$,,_,F,L]=!
[]+[]+!![]+[][111]
_=[111][F+L+E+E];[,J,,A,I,,B,C,S]=
[]+_;$=A+B+C+D+I+H+J+A+I+B+H R=_[$](H+K+I+J+H+C+S+H+B+B+I)();G=($[$]+[])[14]
R[A+B+C+D+B+E+K][E+B+G](12);
iP<


This prints 10 in Somme, 11 in Trigger, and 12 in ???.

Since the last two languages are easy to polyglot, I decided to mix that language in.

### Explanation (cracked post)

Trigger sees the whole code as a series of tokens (tokenization is greedy):

• Single byte (denote A)
• Two same bytes followed by a different byte (denote AAB)
• Three same bytes (denoted AAA)
• Four same bytes (denoted AAAA)

In the source code

!!8@e6v+4>9 \
1((111+111)/111)
00
~tz


the significant tokens are ((1 11+ 111 111, where the first two does nothing and the last two prints 1 each - thus 11.

# CHIP-8, Klein (100), ???

[ //aТ/\\ ][ //е"6
console.log(111-111+12)]
//!'!/-²6-²52@++++2345
%/    <#> 13
say 14
+ not not 15


Outputs 13 in CHIP-8 (I assume), 14 in Klein, and 15 in ???.

Another Klein topology, tsk tsk. I've preserved the code before the @, since I don't know what will affect CHIP-8.

### Clues

I'm kinda overdue for these, sorry. I'll try and add one a day.

• Removing the first half (first three lines) of the program still works.
• This is not a 2D language
• The language is on TIO
• The nots and the say can be removed without affecting the program

For reference, the program without that stuff looks like this:

 %/    <#> 13
14
+   15


Try it online!

• ...I'm scared. This runs in Runic and outputs 16. – Draco18s Sep 29 '18 at 17:48
• @Draco18s Intentional – Jo King Sep 30 '18 at 0:29
• It won't after my next update, as I added some better string handling to several operators (currently TIO pops a 1 and a string that is the made up from first line and goes "this isn't a value" and discards them, the update will concat, even though I have an operator for that, but concat operates on characters and numbers as well as strings, where as + treats them as numbers). But it was super spooky to be like "I wonder what...oh god, this could be left unmodified and be the next entry...if only I knew the ??? language..." – Draco18s Sep 30 '18 at 1:43
• Are you defining half by bytes, characters, lines, or something specific? – NieDzejkob Oct 8 '18 at 16:42
• – Bubbler Oct 12 '18 at 1:18

# Klein (100), Commentator, ???

/@++++2345
start:
program:
db 'function',10
jp null+\$8
sbc rbp,rbp
jnz program
jr program
halt
ex:


Outputs 14 in Klein (100), 15 in Commentator, 16 in ???.

I'm seriously bad at obfuscating polyglots.

### Explanation (Cracked post)

 %/    <#> 13
14
+   15


In Commentator, common comment tokens and spaces are the important commands, and any other characters are ignored.

• Space increments the current memory cell.
• <# does XOR 1 on the current memory cell.
• % is used to reset the current memory cell to zero.

Wait, there are 16 spaces after %, what happened?

It's actually a small bug (or feature?) in the interpreter. / is treated as the start of a 2-char command, so the space after it is consumed. But /<space> is undefined command (thus a no-op), so the space is effectively skipped.