This is the robbers' thread. For the cops' thread, go here.


For this Cops/Robbers challenge, the cops will write output-producing programs and interweave them together. It is the robber's job to pick apart the cops' programs to produce the desired outputs.

Robber rules

Robbers will try to find the different programs that people post in submissions to the cops' thread (linked above). If a robber solves a cop's code, they must post the separated programs and match them with their outputs in an answer here and post that they have cracked the code on the cop's answer.


There are two components that are added together when scoring a cracked submission.

  • 2 to the power of the number of different programs used in the cop's answer
  • Round the number of bytes in the interweaving down to the nearest power of 2.

For example, if a robber cracks TIliGoEnR as being TIGER and lion, then the robber receives 2^2+8=12 points.

The winner of the robbers' challenge will be the person with the most points after a sufficient period of time for people to participate.

(Who wants to help with a snippet?)


10 Answers 10


Vitsy, 12 points


Try it online!


Try it online!

The NaN in NaNo was a dead giveaway.

The obvious way to push NaN would be to divide 0 by itself, 2\I pushes the input length (0) twice, / performs division, and N prints a float.

We're left with printing o, and 'o' is a string literal that O prints.

Whatever characters were left had to belong to the other program. In fact, a pushes a linefeed, 5F the factorial of 5 (120), \a turns that into 120 linefeeds, and Z prints the entire stack.

  • \$\begingroup\$ So fancy, so beautiful. Well done. +1 \$\endgroup\$ Commented Nov 23, 2015 at 23:01

BitShift, 2^2 + 64=68 points

cops thread


prints ! ?


prints ? !


0101100110110101001001010110111011101110111011101101010 # '! ?'
01011001101101010 # '! '
0101              # XOR 0 with 128 
                  # Making current value 128 (1000 0000)
    10            # Bitshift 1 to left making 10000000 -> 01000000
      01          # Bitshift 1 to left making 01000000 -> 00100000  
        101       # XOR 00100000 with 1 making it 00100001
           101010 # print 00100000 which is binary for !
010010101         #
010               # XOR 00100001 with 1 making it 00100000
   010101         # print 00100000 which is binary for <space>
10111011101110111011101101010  # '?'
101               # XOR 00100000 with 1
   1              # Bitshift 1 to left making 00100001 -> 01000010
                      # This gets repeated till 01000010 becomes 0111111
101010                # print 0111111 which is binary for ?

I will add some description later(split the code in the parts that print individual parts)

  • \$\begingroup\$ Can someone explain how to calculate the score I don't quite understand the calculation \$\endgroup\$
    – Dennis_J
    Commented Nov 23, 2015 at 15:42
  • 1
    \$\begingroup\$ Well done. The score is calculated by 2^programs + 256/bytes=points. In this case it's 2^2 + 256/128=6 points. I think this will be edited though, because as it is now, fewer byte count programs receive a higher bonus for robbers. Which feels off \$\endgroup\$ Commented Nov 23, 2015 at 16:16
  • 1
    \$\begingroup\$ @Bas As of yesterday, that was changed. \$\endgroup\$
    – Arcturus
    Commented Nov 23, 2015 at 17:05

PHP, 68 points


Output: Array

echo quotemeta('^/]'.co.'[$');

Output: \^/\]co\[\$

I like this submission, because it relies on a few lesser know features - one might say misfeatures - of PHP. PHP allows function references to be assigned to variables, so for example:

$f = function($a, $b) { return pow($a, $b); };
echo $f(2, 4);

would do exactly what you expect. As would:

$f = pow;
echo $f(2, 4);

...except it's not doing what you think. $f = pow does not assign a function reference to $f (that would make too much sense, right?), but rather the string 'pow'. The implication is that any string may be used as a function call, if it represents the name of a defined function. Bad code waiting to happen. I don't even know why you'd want to allow this.

Another misfeature of PHP, is that function names and keywords are case-insensitive. I wish I were joking. So echo pow(2, 4), ECHO POW(2, 4), and EcHo PoW(2,4) are all functionally equivalent.

The last misfeature on showcase is that whenever an array is typed as a string, such as for printing, the result is always the amazingly helpful string Array. Take a moment to reflect on the fact that someone actually did this deliberately.

So in the first program, @insertusernamehere builds up the string stR_split, this string is used as a function reference (which, for reasons above, actually works), and the result, an array, is output.

  • 1
    \$\begingroup\$ Nice work that comes with a great explanation. :) \$\endgroup\$ Commented Nov 25, 2015 at 10:05

Ruby, 68 points


p %w(b n n s)*?a%?}


w,=?(.ord,40,?);"jivivi{2".bytes{|b|putc b-w}

It followed pretty naturally from working out the end, with putc.

  • 1
    \$\begingroup\$ Whoops, I had a slightly different intended solution with one more weird syntax trick, but I guess I'll keep that in my back pocket for another challenge. Well done! \$\endgroup\$
    – histocrat
    Commented Nov 25, 2015 at 18:51

JavaScript, 68 points

Cops thread

First program

Output: ffttff


Second program

Output: 1010



+     !!    []             +                [    +[]]          +      (+     !![])                 +     (+[])
 (![]+  [])[  +[]]+(![]+[]) [+[]]+(!![]+[])[ +[]]    +(!![]+[]) [+[]]+  (![]+     [])[+[]]+(![]+[]) [+[]]

Java, 132 points

Cops thread

First program:

interface c{static void main(String[]g){System.out.println("Hell"\u002bg.length);}}

Second program:

class i{public static void main(String[]n){System.out.print("Bye!\n");}}

The first program outputs Hell0 and the second program outputs Bye!

  • \$\begingroup\$ Ah, I was an hour too late. Good job. \$\endgroup\$
    – Arcturus
    Commented Nov 23, 2015 at 19:54

Javascript, 132 points

Program 1

var x;{;alert((f=>(f.reverse(f+~~f,Math.pow(2,Math.E))))(new Array(99).fill(0).map((x,i,f)=>i/3)).join("").replace(/../g,""))}

Program 2

try{"function";Object.keys(f)}catch(e){f=s=>!s?f(1):"";alert(f(f(f(0/0) +f(7/5)))+f(f)+`${f}`.split``.map(e=>e.charCodeAt()*23))}

Whew. This was terrible.

After a lot of debugging I found out that after calling (parts of) the 2nd program, it wouldn't run again. This is because the global variable f was still assigned. Because of f being assigned, the try/catch didn't fail on Object.keys(f). I don't know if this is a sneaky trick or unintentional but it caused me a headache.

Also, I believe the output of the first program is platform specific.
/../g removes all characters on my machine, because of the regex . which means any character. Escaping it with /\../g works however, I hope someone can shed more light onto this. Also, my output is prone to rounding errors, perhaps some global javascript variable can change this?



This was tested on chrome 46 (my only browser), Windows 7.

I hope this is still a valid submission, despite the different output

  • \$\begingroup\$ There was a slash in there, I don't know how it was missed. Good job, though! This is correct. I will update my submission when I am not on mobile ;) \$\endgroup\$ Commented Nov 25, 2015 at 15:15

JavaScript (ES6), 68 points

Program 1


Program 2


Interweaved programs

 al e r t  ( ( c =>c             .replace   (/[a     -z]/gi  ,a  =>String                       .fromCharCode(("Z">=a              ?90:122)>=(a=a.charCodeAt(0                 )+13)?a           :a-26)))    ( "  fv z  cyr " ))
   a l e rt ( ( b   =>b.replace(/        [a-    zA-Z]      /g  ,s        =>String.fromCharCode(s                     .charCodeAt(0)                           +(s.toLowerCase()       <'n'?13:-13        )))) ( "g  b nf   g "  ))

This would've been a lot harder, had the cop torn apart the keywords. ;)

  • \$\begingroup\$ I manually interwove it and got lazy, but good job. I tried being sneaky. Oh well. Actually thank you for cracking this one because I lost The original unweaved programs somehow. \$\endgroup\$ Commented Nov 30, 2015 at 23:35

PHP, 24 points

Program 1


Program 2


Program 3

print print'';

Tested with http://sandbox.onlinephpfunctions.com/.


Python 2, 320 points

print "This"
print "hello"
print "well"
print "no"
print "alas"
print "but"
print "oh"
print "done"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.