# Unscramble the Source Code [robber thread for cracking attempts]

This is the companion thread to the main Unscramble the Source Code challenge. If you think you have managed to unscramble one of the cop answers, you should post your solution as the answer to this thread.

As a reminder, you have one attempt at cracking each submission. Your cracking attempt will be an unscrambled version of the source code. If your guess matches the description (same characters, output, and of course language), and you are the first correct guess, then you win a point. It is important to note that your program does not have to exactly match the original, simply use the same characters and have the same functionality. This means there could be more than one correct answer.

The robber with the most points (successful cracks) wins.

Too many solves

20 solves

15 solves

10 solves

7 solves

5 solves

4 solves

3 solves

2 solves

1 solve

• Perl 5, size 27, by Morot - print'pin'=~tr(a-za)(za-z)r – user15244 Nov 6 '14 at 14:34
• @WumpusQ.Wumbley We've all been there... ;) – Martin Ender Nov 6 '14 at 14:35
• I refuse to waste my time attempting to appease it. – user15244 Nov 6 '14 at 14:35
• Given the two question bodies, it appears that the scrambled/unscrambled answers are reversed – Mooing Duck Nov 6 '14 at 23:31
• Ruby, 23 by MegaTom = p %++.methods[80][1..-1] – histocrat Nov 11 '14 at 22:31

# Python, size 48, by kgull

print('h'+hex(ord('\r')*pow(ord('#')//2,2))[2:])


# PHP, size 22, by kenorb

echo(1.*0+(int)(7.1));


Or something like that... it's not really unique.

• Great job, it was echo(int)((.1+.7)*10); – kenorb Nov 5 '14 at 14:14

# Python 2, size 38, by FryAmTheEggMan

print([].__iter__[::2].split()[-~1])


Taking letters from object at.

• Congrats! also, Curses! ;p I also just noticed that 2 == -~1 which was probably not the best idea :S – FryAmTheEggman Nov 5 '14 at 15:10
• @FryAmTheEggman Ahaha was this not the intended solution or something? – Sp3000 Nov 5 '14 at 15:17
• No this is exactly what I had, it just didn't matter where you put 2 or -~1. I probably should have also done something like [30].__iter__ to make it more confusing... – FryAmTheEggman Nov 5 '14 at 15:20
• @FryAmTheEggman Ahaha that wouldn't really change much though, seeing as the repr is still the same – Sp3000 Nov 5 '14 at 15:21
• Yes, the point of that change would be to make guessing how I chopped the string more difficult, but I guess it probably wouldn't have changed much. By the way, did the  give it away? – FryAmTheEggman Nov 5 '14 at 15:27

# C - 43, by Allbeert

This solution really ,sux, but it does actually work if you ignore the grumbling from gcc:

main(){printf(&__DATE__[10],1+1+1+',sux');}


(It will stop working in a few weeks, however...)

• Nicely done! I realized printf worked as well as puts (intended solution) after I had posted the code. I also didn't know you could use single quotes for more than one character without an error! Learned something today :) – Allbeert Nov 5 '14 at 16:55

# PHP, size 23, by bwoebi

echo@$c=b,$b.$$c=c.c;  I'm confused by why echo@$$c=b,$$c.$$cc.=b; doesn't work, while calling echo@$$c=b,{""}.$$cc.=b; directly does.

• Interesting, I had echo$$c=c.c=@b,$$c.b; – Martin Ender Nov 5 '14 at 17:53
• My original was echo$$c=c.c=@b,c.b; ... tiny difference to that one from @MartinBüttner – bwoebi Nov 5 '14 at 17:58 • I can tell you why echo@$$c=b,$$c.$$cc.=b; doesn't work. in case of an expression (variable variables are considered as an expression), operands are evaluated in order. If there are simple variables, they're evaluated only when the operation between the two operands is done. $a.$a=1: $a is here only fetched when the concat operation has to be done, means after $a=1 was executed. But for $$a.$$a=1: $$a is an expression (as opposed to a being a simple variable) is then evaluated just in order and only then $$a=1 is evaluated, ending up with effective NULL.1 == 1. – bwoebi Nov 5 '14 at 18:10

# JavaScript, length 32, by hsl

Interesting use of the map() function there:

[atob('cHVHaVht')].map(alert)//+

• Or couldn't you just comment the map stuff out and alert the string directly? – feersum Nov 6 '14 at 9:43
• @feersum Hah, that never occurred to me :-P – r3mainer Nov 6 '14 at 9:56
• Nice one! In my quest to have it start with valid code, I never thought of using alert directly. +1 for getting the more complex answer. – NinjaBearMonkey Nov 6 '14 at 12:49

# JavaScript, size 47, by palerdot

alert("a surprise!")//if("est")(it will tell  )

This was super easy though. There can be so many solutions to this too.

• This is not my original code, though a lot of variations exist for this particular snippet. My original snippet does not contain any comments. – palerdot Nov 6 '14 at 11:14
• Heh, I find the runnable code snippet quite amusing; it's not exactly very difficult to predict what it will do. :P – Doorknob Nov 7 '14 at 1:16
• @Doorknob In a simple case like this, yes. Not when the whole compiler is present there. – Optimizer Nov 7 '14 at 7:15

# PHP, size 44, by kenorb

$_=get_class_methods(@new phar);die($_[70]);


IMO, that one was pretty obvious (took me 10 minutes after first look).

I did a quick google search and observed that there were a lot of class having valid() as method... An coincidentally get_Class_methods() was in the string. After extracting that one, no issues anymore.

# CJam, size 19, by Martin Büttner

"hunt !tacos" 'hiCt


This one seemed easy...

• That was quick. – Martin Ender Nov 6 '14 at 15:46

## PHP, 21, by kenorb

This one is easy if you know that one of the new features in PHP 5.6 (the version of PHP the code was tested in) is a ** operator for exponentiation:

<?=27**5;///***134689


Or alternatively:

<?=3**15;///***246789


# C, size 30, Ethiraric

main(){printf("%d",__LINE__);}

• Wow, didn't expect it to be that fast :) It is __LINE__ though, not LINE. I used gcc to compile it, don't know if it is different on other compilers – Ethiraric Nov 6 '14 at 15:26
• @Ethiraric it is __LINE__ of course, but the site mangled it. – feersum Nov 6 '14 at 15:59

# C, size 39, imallett

_;main(){putchar(_^'_');_++<9&&main();}

• Almost character for character identical to the original (my ^ arguments are swapped). +1, as this was sortof nasty. I'm curious about how > would have helped? – imallett Nov 7 '14 at 6:39
• @imallett Actually it wouldn't have--I really was thinking <=. My first idea was something with just one statement like ;_;main(){_<=9&&main(putchar(_++^'_'));} although I guess that seems more convoluted than the actual solution. – feersum Nov 7 '14 at 6:47
• @feersome: [N.B. GraphicsResearch|->imallett] I actually tried for a while to get a single statement inside the putchar, but couldn't figure out a nice way (precedence kindof kills it). – imallett Nov 7 '14 at 6:52

# Little Man Computer, size 63, The Wolf

503902000051000000000001111122223334455555666777888999999999999


If I'm understanding this correctly, all I have to do is put the number in the out box and then halt? OK...

{data S=S{}deriving Show;main=print S;S=S}


Some clever things were done here: the empty record in the definition of S to reduce the number of spaces (this confused me a long time!), and it looked awful hard to use that extra equals sign from the extraneous S=S equation.

• I didn't know you could group top level definitions together. I intended it to be an empty record pattern S{}=S. Should have had two more parentheses. – proud haskeller Nov 7 '14 at 11:00
• I actually just thought the record definition would be harder to guess. – proud haskeller Nov 7 '14 at 11:37

# Lua, size 28, by ChipperNickel

a=math print(a.asin(1)*a.pi)


Wow, this was actually really simple, why did I not try this earlier? Also, I learned that you can separate statements with nothing but a space in Lua.

# Mathematica, size 18, by Arcinde

D[2#&@d!!,d]/.d->0


That was quite interesting. :)

• Dang, nice job. – jcai Nov 7 '14 at 12:13

# Ruby, 49, by Doorknob

$><<"'"+' ""' %'' %'' %"'<<<<<<<<>>>>>>>>>% ?;"  I think I found a tiny shortcut? # Python (2), size 41, muddyfish print(sum(map(ord,repr(exit.__repr__))))  I observed the result 6831 from this code for both Pythons 2 and 3 on my local machine. However, I managed to reproduce the output 6314 with (http://ideone.com/700qVt). Ideone's Python 3 didn't even recognize the exit function. ## C, size 53, by FireFly s(x){return x?x*s(~-x):!x;}main(){printf("%x",s(9));}  Nice factorial program :) # Arithmetic, size 31, by Cris (((((2*2+1)*2+1))*(1+(1+2)*2)))  This may not have been the intended solution because of the unused parentheses, or maybe they were red herring. • I think that this was the intended output: ((((2*2)+1)*2)+1)*(((1+2)*2)+1) But the functionality is the same. Great catch! – Ismael Miguel Nov 8 '14 at 6:48 # Cris, ECMAScript, 66 eval(atob("J2slzzuuuspmlkihgccbbbaZZYYWSSKKKED995555222S2AnCjsx"))  ... # Cris, ECMAScript, 70 eval(atob("DScg12224599ACDDMMNNNOQQTTYZZbcgjklmpssuuuwwyzzzOScKMSY1"))  ...... # Python 2, muddyfish, 37 print(memoryview(str(Ellipsis)).ndim)  I'm glad I made that Python builtins anagrammer. # Java, 108, durron597 class o{{ }public static void main(String...r){System.out.printf("%.6f",('a'*'+'/'\t'-'l')/('m'+'\n'-6.));}}  This was my second pi-printing program today. Given the low precision of this one, the second-most famous rational approximation, namely 355/113, was sufficient to produce the correct digits. It seemed like this fraction should be obtainable with some math on character literals. After some trial and error I finally found an expression ('a'*'+'/'\t'-'l')/('m'+'\n'-6.) which used all the characters it needed to. One convenient thing was that I had the choice between printf or format which both behave identically here. • Nicely done. It's quite different from my original though (which is also just math on character literals), which has no wasted {}, for example. If you want to try to figure out mine, my hint is that it's class pi{public static void main(String...lnr){. Perhaps the answer set would be smaller with class z and String...z – durron597 Nov 8 '14 at 19:34 ## QBasic, 37 bytes, by DLosc PRINT 1E7 AND 11053811 R=LEN("*?RY")  I immediately noticed that all the letters of AND were present in the code. (In QBasic, the Boolean operators are bitwise, and true is -1.) Then I wrote a script to find possible combinations of operands by brute force, ignoring zeros to allow for E notation. Once I found a usable combination in the list, all that was left was to deal with the remaining characters. A single space is printed before the number (where the minus sign would go for a negative number). The scrambled code also prints a space before the number it prints, and that is not described as part of its output, so I assume that that detail is insignificant or was mistakenly omitted. • My original actually multiplied two numbers before ANDing the result with 1E7 (thus the *), but I guess with bitwise operators there's always going to be lots of possibilities. Nice work! – DLosc Nov 11 '14 at 2:07 # Python, size 55, by FireFly ____acdfiimmnooprrt={2:.9,} print(801**sum(range(5))+1)  The funny thing is, my initial solution only worked on Python 3 and it was only until FireFly pointed out that I should inline my 801**sum(range(5)) instead of assigning it to a variable that I got this working for both Python versions. # Java, Size 97, Olavi Mustanoja class _{public static void main(String[]s){for(int b:"534g".getBytes())System.out.write(b^'m');}}  There are not too many possibilities with only 1 character ^ usable as operator and lack of p (for printing operation). I wither the input down to 345_gsm and do some math to map it to the output. # Ruby, 23 by MegaTom p %++.methods[80][1..-1]  Edit: So that's where the answer went. Converting back to an answer, hopefully. Thanks for specifying an interpreter, methods[80] is definitely version- and implementation- dependent. Using + for the percent-string delimiter is a nice touch. I think I found this easier than I would've just because I'd been thinking of doing some similar tricks. # Ruby, size 17, by Stephen Touset $><<$-W?$?:$:>-pi  Test it on ideone. Most certainly not the original code. $-W is the value of the command-line argument -W (warning level) which defaults to 1. The rest is just to get rid of the other characters, so I'm putting some undefined variables and operators in the else branch of a ternary.

• My original was $-p??:>$i:$><<$-W. I wanted to use the $><< trick, and the (very not well-known) flag-based globals like $-W. Unfortunately, that's short enough (7 characters) to be easily brute-forceable. I rationalized that it might be tricky to include the letter p as a red herring, and the rest was there to reduce the effectiveness of brute force. – Stephen Touset Nov 13 '14 at 19:32