# 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

# PHP, 33, by kenorb

This one was quite easy:

<?=strlen(highlight_string(0,1));


In case you were wondering, highlight_string(0,1) produces this result (with a total of 52 characters):

<code><span style="color: #000000">
0</span>
</code>


# Bash, size 33, by Debasis

echo shellpower|awk '{print $1}'  Had to ssh into uni to test that... • I got ${pintwk1ar} |echo 'shellpower' – jimmy23013 Nov 6 '14 at 23:50

# JavaScript, size 10, by Chris

{newa:(1)}


That was finally solvable...

# SAS, size 17, by user3490

%put%eval(a>1>b);


Simply evaluates the expression a>0>b left to right (giving the results of FALSE, which is represented in SAS by 0) and prints the result to the log.

(Thanks to Sp3000 for noting I originally wrote a>0>b.)

• Just formatted the code a tad with the {} button, if you don't mind :) – Sp3000 Nov 7 '14 at 2:47
• Also, the original code has a 1 instead of a 0. Does this change anything or does swapping 0 for 1 still work? – Sp3000 Nov 7 '14 at 2:56
• Whoops, I'll fix that. They both return 0, because of the way SAS evaluates the expression. – ConMan Nov 7 '14 at 5:31

# Java, size 70, Rodolvertice

enum n{s;public static void main(String[]acl){System.out.print((s));}}


I had no idea how enums even worked, with a default toString() returning their name in the source code and all, but there were so few non-boilerplate characters available that it was easy to discover.

• congrats! original used println and a as class name. :) – rodolphito Nov 7 '14 at 7:19
• @Rodolvertice I didn't use println, because you didn't list a newline as part of the output. – feersum Nov 7 '14 at 7:49

# Javascript, size 285, by Beta Decay

alert(String.fromCharCode(65,90))//      """"""(((((()))))),,,......../////001111222222333334666677777788999:========AEGHJLLLMNORTTX[]_aaaaaaaaaaaaaaaabbbccdddeeeeeeeeeeeeeeeeffffghhhhiiiiiiiijmmmmnnnnnnnnoooooooooooooopppppqrrrrrrrrrrrrrrssssssssssssssstttttttttttttuuuvvvwwwwxz


and some newlines after that.

• Well that's one way :) – Beta Decay Nov 7 '14 at 11:36

# Ruby, size 33, by Doorknob

puts [?$+?*+?]]-[?..$*$$.next  I don't know Ruby and have no idea what does ?..\ really mean. Apparently ? and \ are the only things having the same type (or both undefined?) which will not throw an error. • ? is the Process::Status from the last call to Kernel#system. ! is the Exception being rescued. Both are usually nil. Your code makes the Range object nil..nil. – kernigh Nov 9 '14 at 23:01 • @kernigh It's \. – jimmy23013 Jan 7 '15 at 16:37 # Python, size 41, by Sp3000 exec("import re\x0Aprint(re.__all__[1])")  Fairly sure this is the intended solution. • I had exactly this! But I thought it was wrong because there were left over rs... apparently I messed up counting this. I don't think this is the intended solution because it only works on Python 2. – feersum Nov 7 '14 at 22:09 • @feersum: It works in Python 3.3 (as noted in the original posting). It fails in Python 3.4 because they added fullmatch in front of search. – nneonneo Nov 7 '14 at 22:59 • @feersum This was the intended solution. I thought something like that might happen so I tested in 5 different ways, but unfortunately I forgot about Python 3.4. Sorry about that. – Sp3000 Nov 8 '14 at 2:08 • @Sp3000 At least it gives me a clue about this question... – feersum Nov 8 '14 at 2:17 # Ruby, size 37, by Rodolvertice puts 5423187690^2351479806^1523406978  I noticed that the code had exactly three of each digit 0-9, so I guessed the solution would be three numbers that were permutations of 1234567890. Rather than check all of those, I decided to start with numbers of the form 1234500000, xor them, and see if the first 13 bits were correct; if so, then I would fill in the last five digits of each number with a permutation of 67890 and check the final result. The Python 3 script I threw together found this solution within a few seconds. • I guess there could be hundreds of solutions to this type of problem, but my original used an octal... I thought it would make it a lot harder, but it didn't. Original: puts 0741605235^7928381406^1254936789. +1 – rodolphito Nov 9 '14 at 3:34 • @Rodolvertice Yeah, xor by nature has a lot of possible solutions. Interesting about the octal (and the non-even distribution of digits among the three numbers). – DLosc Nov 9 '14 at 5:23 # C#, size ~600, eshansingh1 using System;class Program{static void Main(string[]a){Console.WriteLine("Hello, World!");Console.WriteLine("Other World!"); String c=""+""+""+"wwTxRExpphk= hckhew@hm.cm hw Csole.Reae how al vod old); ry statc bool othval try ex) bool retur >catch us Excepton(); } ex) { Excepton(); } { new { { checker) Check(someval); } } catch } Console.rteine(ther } (Exception ystem; usin { finally { catch (Exception new { Console.riteLine(ello @^A-Z0-9._%-@[A-Z0-9.-].[A-Z]{24}); ain(string[] try Regex.IsMatch(checker, args) static { } } } Exception(Uh rogram bool CopsAndRobbers { oh.);";}}  I found a size of 587 rather than the claimed 604, but it hardly matters as it's all dead weight. I wouldn't have done this as I didn't have any interest in installing C#, except that I noticed that I already had a C# SDK on my computer, and it seemed simple enough to figure out how to print a string without needing to look at any documentation. Oddly string and String both appear to be types. • string is an alias for System.String. Similarly, int is an alias for System.Int32, and so on. – Alex Van Liew Nov 14 '14 at 18:32 # QBasic, 42 bytes, by DLosc A=2+EMOORT 1PRINT"QBasic!" IF A THEN RUN 1  There isn't WHILE, NEXT, DO, GOTO, GOSUB or CALL, and there isn't a second PRINT or other ways to get a new line. So I must find some other weird control structures. • Nice work! RUN is one of my favorite QBasic quirks, and it seemed like a good thing to abuse for this challenge. (The seven garbage characters were originally a comment, REM+TOO... I didn't think of it becoming an uninitialized variable, for some odd reason. Should've left the + out.) – DLosc Nov 10 '14 at 3:12 # JavaScript, 29, by Joe [,,].join([,,,].join(3))|74*2  Probably not unique, because I didn't really use one join. So the idea was to somehow find the number with repetition of digits, multiplication and bitwise or. All of those operations increase the resulting number, so I could limit my search to numbers below 181. Conveniently 181 is prime, so the final operation had to be | (I doubted I could get to [1,1].join(8)). So I just looked at all pairs of numbers that I could bit-or to 181, and looked through those that have at least one operand completely from the available digits. One way is 33|148, and the latter could be found as the product of 74 and 2, so here we are. • Nice. I went with the slightly more awkward [,,,].join(3)|[,4,].join(7)*2 but I thought making it non-prime might be a bit too unfair. From the speed you cracked it, maybe not :P – Joe Nov 10 '14 at 16:47 ## JavaScript, 46 characters, by FireFly alert(/ordered/.source) this. aaeeefnnrstvw  • Oh, right.. perhaps I shouldn't have added this. to make it a bit 'harder'. (the original one used this.alert and var theotherletters) – FireFly Nov 10 '14 at 21:15 # JavaScript, size 28, by Shawn Holzworth var eeivy;((atob['length']))  I guess, that's not what we were looking for... Turns out it's exactly the original. :) • That's exactly it (down to the junk variable name, which is just weird). The eval/atob was a red herring. – SLuck49 Nov 10 '14 at 21:22 • @ShawnHolzworth Ha, great. The junk variable name is just sorted alphabetically. – Martin Ender Nov 10 '14 at 21:24 # C, 44, Art n;main(aaa){while(1-printf(&"a%nb"[n],&n));}  Lacking any assignment operators to use for flow control, it seemed a good idea to look for some function which would take an address and write something to it. I found a %n specifier for printf which does this. I think this was the intended general idea. I had to test on ideone because there was some bug in the implementation on my computer where it refuses to write anything after a %n... Something to do with this maybe. • Good job, that was fast. I should have used the longer version that also had an assignment and a few more operators as a red herring. Now it's too late because %n is used up as the weird functionality few know about. – Art Nov 11 '14 at 14:03 • Man, we just talked about %n in my UNIX class recently too. I couldn't really fathom a good reason to use it. Now I know: golfing. – Alex Van Liew Nov 14 '14 at 19:19 # JavaScript, 42, by Shawn Holzworth (function nn(n){return !n||n+nn(--n)})(58)  And to test it : alert((function nn(n){return !n||n+nn(--n)})(58)) • Good job, that's pretty much the original. – SLuck49 Nov 11 '14 at 16:45 • Only difference was the location of the decrement: (function nn(n){return !n||n--+nn(n)})(58) – SLuck49 Nov 11 '14 at 16:50 • Ah, didn't think of that .. – Optimizer Nov 11 '14 at 16:51 # Java, 134, Olavi Mustanoja class Shit{public static void main(String[]rtr){for(int n=74;n<=84<<19;n=n<<3^911-'g')System.out.print(""+(char)94+n+(char)(5<<1));;}}  At the beginning I checked the logarithms of the numbers and noticed that the later ones differed by almost exactly 3 log 2. Then it was easy to find that excluding the first number, the next could be obtained by (n << 3) - 728. Instead of the subtraction, an xor operation can give the next number for all of them. • Gotta love the class name. Good job :) – Olavi Mustanoja Nov 11 '14 at 23:22 ## JavaScript, size 73, by Mig alert([o=(eval.e+'(((()))),-....0cceefgillpprrrssst')[2],o].join('enie'))  Thanks for the string literal to dump all the excess characters in! I'm pretty sure this is an unintended solution, but it seems to work nonetheless. • Well done ! Here is my original code : alert(([].g+[]).split(o='').reverse().slice(0,-2).join(o).replace('f',o)) – Michael M. Nov 14 '14 at 9:05 # Marbelous, 48, by es1024 @110&1 @0@111 @011.. \/=0.. :.- }0}0}0 {0&0-0<<  So what's the challenge? • Ah, I forgot that " is 22 in hex. – es1024 Nov 15 '14 at 9:14 # Marbelous, 55, by es1024 1111 11<< 10/\ 10 10 &0..&0 :--.....01=@@@@}} {0}00000  # Python 2, 13 by Emil print (070-7)  I'm not sure either why Python has octal literals. Ruby has them too, I was thinking of including one in a puzzle myself. • That was fast. :) Until today I had never seen octal literals written with a 0 prefix. It somehow seems like a bad idea. – Emil Nov 19 '14 at 21:07 # Python 2, 16, by imallett Produces no output in Python 3, but outputs "-2" in Python 2. This technically depends on two's complement arithmetic, which is a reasonable assumption on Python-supporting architectures: eval("\x7eTrue")  # CJam, size 12, by COTO T1mp!+~[]_^oE  # MATLAB, COTO, size 41 disp(magic(all(cos(eye(rank(now))))))  • You cracked that in about 1 20th the time it took me to come up with an actual working anagram. >___< Also, you appear to have posted the answer as a comment in the OP...? – COTO Nov 6 '14 at 6:50 • @COTO Several people have had this problem I think...apparently there is a secret minimum answer length. – feersum Nov 6 '14 at 6:51 • Yes, I figured that was the purpose of the lorem ipsum. And the comment in the OP is gone now, so... no worries. – COTO Nov 6 '14 at 6:53 # CoffeeScript, size 25, by Martin Büttner alert /hees /.test []  Try it out at http://jsfiddle.net/33qa3guk/. • Oh wow... I forgot two characters in my answer... there were supposed to be two " as well. And I didn't think test would work on arrays. ^^ But thinking about it, even then it's fairly simple to create a solution that's not the intended one. I was actually going for alert "eehs ".test /[]/. – Martin Ender Nov 4 '14 at 22:06 # JavaScript, size 13, by Caridorc {}-[]+[]+([])  I'm not sure though if the cop's submission is valid, because it requires a REPL environment. # CJam, size 18, by Ypnypn 987"12268*"0*~543%  Probably not the original solution. • For the record, the original solution was 458"792*602%"813*~ – Ypnypn Nov 5 '14 at 1:35 # Python, size 154, by Fox Wilson print("".join(chr(int(130-o))for o in [51%35,13,ord(" (()),..////00188==[]________aaccddeeeeffffgiiiiiiiiijjjjllnnnoopprrrrttuu"[1]),sum([8,1])]))  This is almost certainly not the intended solution. • Nice! For reference, the intended solution was: print("".join([chr(i) for i in __import__("functools").reduce(tuple.__add__,[[(j,i//j)for j in range(i//115,0,-1)if i%j==0][0] for i in (13338,11858)])])) – Fox Wilson Nov 5 '14 at 13:24 • @FoxWilson I think if you specified Python 2, I'd have less characters to play around with from the reduce :P – Sp3000 Nov 5 '14 at 13:35 # Python, size 54, by kgull 'head'#(o)op'/r),2\x'12.)w/)],c'dp*((rx:(h('r'ol'e)[re  This most likely is not the intended answer, but it works; the # comments out everything but the result. The OP stated that this is supposed to be run in a shell, so there is no print statement. # Perl 5, size 47, by chilemagic print((0..])x]); ""."$$()**.///[[~==1fors";


I think this is valid. The \$] part took me a while.