143
\$\begingroup\$

Note: This challenge is now closed to new cop submissions. This is to ensure that no one can post submissions that only remain uncracked because there aren't enough robbers interested in the challenge anymore.

In this game of cops-and-robbers, each cop will write a simple program to give a single output. They will then make public four things about their program:

  1. The language
  2. The program length
  3. The desired output
  4. A scrambled-up version of the source code

Then, the robbers must unscramble the source code so that their program functions like the original.


Cop Rules

You are to write a simple program, which the robbers will try to recreate.

Your original program must have a simple functionality: upon execution, it outputs a single string/number and halts. It should give the same output regardless of when/where it is run, and should not depend on extra libraries or the internet.

Your program and output must use printable ASCII (newlines and spaces allowed). The output should be no more than 100 characters long, and the program should take less than about 5 seconds to run on a reasonable machine. You are also not allowed to use hashing (or other cryptographic functions) in your program

Then, you provide a scrambled-up version of the source code and the required output. You can scramble up your source code however you may like, as long as characters are conserved.

Your score is the shortest program you have submitted which hasn't been cracked. After a period of one week, an uncracked submission will become immune. In order to claim this immunity, you should edit your answer to show the correct answer. (Clarification: Until you reveal the answer, you are not immune and can still be cracked.) The lowest score wins.

Simple Example Cop Answers

Perl, 20

ellir"lnto Wo d";prH

Hello World

Or...

Perl, 15

*3i)xp3rn3*x3t(

272727

Robber Rules

Robbers will post their cracking attempts as answers in a separate thread, located here.

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.

Simple Example Robber Answers

Your program was print "Hello World";. (Although print"Hello World" ; could have also worked.)

Your program was print(3**3x3)x3

Safe Submissions

  1. ASP/ASP.Net, 14 (Jamie Barker)
  2. Befunge-98, 15 (FireFly)
  3. GolfScript, 16 (Peter Taylor)
  4. CJam, 19 (DLosc)
  5. GolfScript, 20 (user23013)
  6. Perl, 21 (primo)
  7. Python, 23 (mbomb007)
  8. Ruby, 27 (histocrat)
  9. SAS, 28 (ConMan)
  10. Ruby, 29 (histocrat)
  11. Python, 30 (mbomb007)
  12. JavaScript, 31 (hsl)
  13. Ruby, 33 (histocrat)
  14. Marbelous, 37 (es1024)
  15. Ruby, 43 (histocrat)
  16. PHP, 44 (kenorb)
  17. Ruby, 45 (histocrat)
  18. Marbelous, 45 (es1024)
  19. Python 2, 45 (Emil)
  20. PHP, 46 (Ismael Miguel)
  21. Haskell, 48 (nooodl)
  22. Python, 51 (DLosc)
  23. Python, 60 (Sp3000)
  24. Python 2, 62 (muddyfish)
  25. JavaScript, 68 (Jamie Barker)
  26. Mathematica, 73 (Arcinde)
  27. Haskell, 77 (proudhaskeller)
  28. Python, 90 (DLosc)
  29. C++, 104 (user23013)
  30. ECMAScript 6, 116 (Mateon1)
  31. C++11, 121 (es1024)
  32. Grass, 134 (user23013)
  33. PowerShell, 182 (christopherw)

Unsolved Submissions

In order of time of posting. This list courtesy of many users.

A small tool to verify solutions, courtesy of n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

$(function(){function e(){var e=$("#ignore-space").is(":checked");var t=$("#source").val().split("").sort();var n=$("#editor").val().split("").sort();var r,i=0;for(r=0;r<t.length;){if(t[r]==n[i]){t.splice(r,1);n.splice(i,1)}else if(t[r]>n[i]){i++}else{r++}}$("#display").val(t.join(""));n=n.join("");if(e){n=n.replace(/[\r\n\t ]/g,"")}if(n.length!=0){$("#status").addClass("bad").removeClass("good").text("Exceeded quota: "+n)}else{$("#status").addClass("good").removeClass("bad").text("OK")}}$("#source, #editor").on("keyup",function(){e()});$("#ignore-space").on("click",function(){e()});e()})
textarea{width:100%;border:thin solid emboss}#status{width:auto;border:thin solid;padding:.5em;margin:.5em 0}.bad{background-color:#FFF0F0;color:#E00}.good{background-color:#F0FFF0;color:#2C2}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<h3>Scrambled Source</h3>
<textarea id="source" class="content" rows="10"></textarea>
<h3>Unused Characters</h3>
<textarea id="display" class="content" rows="10" readonly></textarea>
<h3>Your Solution</h3>
<input type="checkbox" id="ignore-space" name="ignore-space"/>
<label for="ignore-space">Ignore space characters</label>
<div id="status" class="good">OK</div>
<textarea id="editor" class="content" rows="10"></textarea>

\$\endgroup\$
  • 4
    \$\begingroup\$ @xnor Yes, that's what it means. \$\endgroup\$ – PhiNotPi Nov 4 '14 at 20:00
  • 3
    \$\begingroup\$ You might want to forbid hashing... codegolf.stackexchange.com/questions/40304/… \$\endgroup\$ – NinjaBearMonkey Nov 4 '14 at 20:00
  • 7
    \$\begingroup\$ You should probably specify that the winner must post the original source code after one week. What prevents me from posting gibberish and claiming that none of the robbers got the right answer? \$\endgroup\$ – user2023861 Nov 4 '14 at 21:54
  • 64
    \$\begingroup\$ I thought "Oh, il just write a malbolge program, scramble it, and win this thing!". But then, i tried to write a malbolge program. \$\endgroup\$ – rodolphito Nov 5 '14 at 4:56
  • 8
    \$\begingroup\$ Warning: Cops, do not use Ideone to test your submissions, as it stores your programs and other people can see them. \$\endgroup\$ – rodolphito Nov 6 '14 at 4:48

244 Answers 244

1
5 6 7 8
9
0
\$\begingroup\$

C, 117 bytes

Output:

*old meats*

Scrambled eggs:

o]00a;ci&955t[]e,o}ps,;5a(;o1-e=drffe0(px2,m*7^100ni,c=,,40o4xp;xom170&),at{9)x9=]h={p-,o5cm[;(nd4ex,,r([7r},xc)4)7,,

You earn my respect if you can guess how this program was scrambled.

| improve this answer | |
\$\endgroup\$
-1
\$\begingroup\$

Python 2, 89 - Cracked

Code

   ''''''''((()))*,,,,...12;;=BFGGIIIILPRaaaaaabceeeeeeffgggggiiiiiklmmmmmmnnoopprrrsttvw

Output

No output to STDOUT ;)

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Cracked. Turns out no unscrambling was necessary! \$\endgroup\$ – feersum Nov 7 '14 at 9:34
  • \$\begingroup\$ @feersum I don't know if it's allowed, but I clarified what my code should do... \$\endgroup\$ – Beta Decay Nov 7 '14 at 9:36
  • \$\begingroup\$ "Your program and output must use printable ASCII." And no fair adding new output after I already cracked it... \$\endgroup\$ – feersum Nov 7 '14 at 9:37
-1
\$\begingroup\$

Java 6+ / Oracle's implementation (218 bytes)

Code

 ((((((()))))))*+,...........
000000000111222225677;;;
DEIPPSSS\\\\\\aaaaaaaaaaaabccccccccddeeeeeeeeeeeeffggggh
iiiiiiiiiiiijjllllmmmmnnnnnnnnnooooooppppppqqqq
rrrrrrrrssssstttttttttttttttttttuuuuuuuuvvxxxxyyy
{{{{}}}}

There are 5 new lines and 1 space. No other invisible character.

Output

723Unmatched closing ')'

With these many characters, it is probably open for many possibilities.

Hint

I don't know if there is any other solution, but it seems I have limit the solution to the following direction quite well.

import
java.util.regex.*;
class{public
static
void
main(String){try{Pattern.compile(((()))+.....000000000111222225677DI\\\\\\aaacdeeeeeffggiijnnopqqqqrstttuuuuux,);}catch(PatternSyntaxException ){System.out.print();}}}

And second hint is long-standing bug.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hmm, seems familiar, didn't I already do that one? \$\endgroup\$ – feersum Nov 7 '14 at 9:35
  • \$\begingroup\$ @feersum: Yes, it is a rehashed version, but slightly modified - not sure if it can be solved similarly, though. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 7 '14 at 9:38
-4
\$\begingroup\$

Python - 62

Code

odado96\n5oar)mamn0arrd)(snp,nn.2m7dtitit.\nrmr)3i4(n nrope81(ed

Output

60132

Answer:

import random
random.seed(6)
print (random.randint(9805,73241))

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Does this work in both Python 2 or 3? \$\endgroup\$ – Martin Ender Nov 10 '14 at 12:33
  • \$\begingroup\$ Not sure since I don't have Python 3. Probably it does. \$\endgroup\$ – f.rodrigues Nov 10 '14 at 12:35
  • 1
    \$\begingroup\$ Really, even with the argument of print needing parentheses? \$\endgroup\$ – feersum Nov 10 '14 at 12:43
  • 2
    \$\begingroup\$ cracked gg \$\endgroup\$ – feersum Nov 10 '14 at 13:41
  • 5
    \$\begingroup\$ @f.rodrigues One could argue, that using a seed and randomint counts as hashing. \$\endgroup\$ – Martin Ender Nov 10 '14 at 18:13
1
5 6 7 8
9

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