36
\$\begingroup\$

Note: This challenge is finished. Submissions are still welcome but can not win.

This is the cops' thread. The robbers' thread goes here.

Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (the same or another), and the code should output 3. Continue like this as far as you can, but maximum up to 10. Default output formats such as ans = 1 are accepted. You can ignore output to STDERR (or equivalent).

You must reveal the language, byte count of your initial code, the number of integers it works for, as well as an optional number of characters of the initial code. Note: You don't have to reveal any characters, but remember that revealing characters might make it harder for the robbers as they must use the same character in the same position. You can choose which character you use to denote unrevealed characters (for instance underscore), but make sure to specify this.

Cops can provide the uncracked code after one week and call the submission "SAFE". The winning submission will be the shortest uncracked submission that produces the number 10. If no uncracked submissions are able to print 10, the shortest code that produces 9 will win, and so on. Note that the robbers don't have to make the same changes as you do, and they don't have to reproduce the exact code (unless you reveal all characters). They must only reproduce the output.

Submissions posted later than November 24th are welcome but not eligible for the win (because there will likely be fewer robbers around).


Example post:

The following post is a submission in the language MyLang, it is 9 bytes long, and it works for numbers 1 - 8.

MyLang, 9 bytes, 8 numbers

This submission works for 1 - 8. Unrevealed characters are indicated with an underscore: _.

abc____i

Leaderboard

Disclaimer: The leaderboard is not tested and uncracked submissions might not appear in the list.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><style>table th,table td{padding: 5px;}th{text-align: left;}.score{text-align: right;}table a{display: block;}.main{float: left;margin-right: 30px;}.main h3,.main div{margin: 5px;}.message{font-style: italic;}#api_error{color: red;font-weight: bold;margin: 5px;}</style> <script>QUESTION_ID=99546;var safe_list=[];var uncracked_list=[];var n=0;var bycreation=function(x,y){return (x[0][0]<y[0][0])-(x[0][0]>y[0][0]);};var byscore=function(x,y){return (x[0][1]>y[0][1])-(x[0][1]<y[0][1]);};function u(l,o){jQuery(l[1]).empty();l[0].sort(o);for(var i=0;i<l[0].length;i++) l[0][i][1].appendTo(l[1]);if(l[0].length==0) jQuery('<tr><td colspan="3" class="message">none yet.</td></tr>').appendTo(l[1]);}function m(s){if('error_message' in s) jQuery('#api_error').text('API Error: '+s.error_message);}function g(p){jQuery.getJSON('//api.stackexchange.com/2.2/questions/' + QUESTION_ID + '/answers?page=' + p + '&pagesize=100&order=desc&sort=creation&site=codegolf&filter=!.Fjs-H6J36w0DtV5A_ZMzR7bRqt1e', function(s){m(s);s.items.map(function(a){var he = jQuery('<div/>').html(a.body).children().first();he.find('strike').text('');var h = he.text();if (!/cracked/i.test(h) && (typeof a.comments == 'undefined' || a.comments.filter(function(b){var c = jQuery('<div/>').html(b.body);return /^cracked/i.test(c.text()) || c.find('a').filter(function(){return /cracked/i.test(jQuery(this).text())}).length > 0}).length == 0)){var m = /^\s*((?:[^,;(\s]|\s+[^-,;(\s])+).*(0.\d+)/.exec(h);var e = [[n++, m ? m[2]-0 : null], jQuery('<tr/>').append( jQuery('<td/>').append( jQuery('<a/>').text(m ? m[1] : h).attr('href', a.link)), jQuery('<td class="score"/>').text(m ? m[2] : '?'), jQuery('<td/>').append( jQuery('<a/>').text(a.owner.display_name).attr('href', a.owner.link)) )];if(/safe/i.test(h)) safe_list.push(e);else uncracked_list.push(e);}});if (s.items.length == 100) g(p + 1);else{var s=[[uncracked_list, '#uncracked'], [safe_list, '#safe']];for(var i=0;i<2;i++) u(s[i],byscore);jQuery('#uncracked_by_score').bind('click',function(){u(s[0],byscore);return false});jQuery('#uncracked_by_creation').bind('click',function(){u(s[0],bycreation);return false});}}).error(function(e){m(e.responseJSON);});}g(1);</script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea"><div id="api_error"></div><div class="main"><h3>Uncracked submissions</h3><table> <tr> <th>Language</th> <th class="score">Score</th> <th>User</th> </tr> <tbody id="uncracked"></tbody></table><div>Sort by: <a href="#" id="uncracked_by_score">score</a> <a href="#" id="uncracked_by_creation">creation</a></div></div><div class="main"><h3>Safe submissions</h3><table> <tr> <th>Language</th> <th class="score">Score</th> <th>User</th> </tr> <tbody id="safe"></tbody></table></div>

\$\endgroup\$
  • \$\begingroup\$ Not sure I understand... given an arbitrary code in CJam that produces 1, how can I prevent the robbers from adding ) repeatedly to generate the rest of the numbers? The same would be valid for quite a few languages \$\endgroup\$ – Luis Mendo Nov 12 '16 at 12:48
  • 2
    \$\begingroup\$ If that's possible for any program that outputs 1 then it appears CJam is a bad choice of language for this challenge. There's no way to prevent robbers from doing that. \$\endgroup\$ – Stewie Griffin Nov 12 '16 at 12:50
  • 3
    \$\begingroup\$ @LuisMendo Well, it will certainly make this more interesting... \$\endgroup\$ – LegionMammal978 Nov 12 '16 at 12:58
  • 1
    \$\begingroup\$ @DanielJour It can be modifiable up to any number, but the maximum number the robbers need to find is 10. That rule is in place because many submissions can probably be extended to infinity (in theory), so scoring based on the highest achieved number wouldn't make sense. \$\endgroup\$ – Stewie Griffin Nov 13 '16 at 16:25
  • 1
    \$\begingroup\$ You may want to try only disqualifying an entry if the header contains cracked in some form. This is what the redesign userscript currently does. \$\endgroup\$ – ETHproductions Nov 15 '16 at 20:51

88 Answers 88

1
\$\begingroup\$

COW, 51 bytes, 10 numbers Cracked by Kritixi Lithos

MoO ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ OOM

Original code:

MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM #Prints 1
MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM #Prints 2
...
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Mo_ Mo_ OOM #Prints 10 (the last two operations were red-herrings)

For a Javascript-based interpreter to use for testing, you can go here.

_ is hidden character

\$\endgroup\$
1
\$\begingroup\$

Perl, 7 bytes, 9 numbers, Cracked!

say$_-_

Underscores represent unknown characters.

The solution (as found by feersum) was to use a literal control-F to replace the first underscore, thus finding the predefined variable that has the value 2.

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 15 '16 at 21:26
  • 2
    \$\begingroup\$ Isn't this 7 bytes? \$\endgroup\$ – feersum Nov 15 '16 at 21:42
  • \$\begingroup\$ Yes, it's 7 bytes. Apparently I can't count today. \$\endgroup\$ – user62131 Nov 15 '16 at 22:19
1
\$\begingroup\$

Wentel x87, 36 bits/8 = 4.5 bytes, 2 numbers

____________0110______00____00______
\$\endgroup\$
  • \$\begingroup\$ Is there an online interpreter? I'm having some trouble getting it to run from the version on github (I don't use Python much). \$\endgroup\$ – Riley Nov 18 '16 at 0:33
  • \$\begingroup\$ @Riley Download "main.py" and run python3 main.py. Type bits in and press enter to start execution. Pass -d to activate debugger. \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Nov 18 '16 at 12:44
  • \$\begingroup\$ Thanks, I must have been using python2. In the documentation (and the examples) it looks like 1001 8 times would print the ASCII value of 11111111, but when I run it, I need a 9th 1001 or 1000 for it to print. To crack this, which method should I use? \$\endgroup\$ – Riley Nov 18 '16 at 20:54
  • \$\begingroup\$ @Riley Go by the specification, not the interpreter. \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Nov 18 '16 at 21:25
  • \$\begingroup\$ Do you have a chatroom for Wentel x87? I had a few questions about the specs. \$\endgroup\$ – Riley Nov 19 '16 at 17:51
1
\$\begingroup\$

Python 2, 26 bytes, 10 numbers, cracked by feersum and Destructible Watermelon

Third try's the charm?

print r___e(3_4____+_[___]

Works for 1-10, _ is hidden.


Destructible Watermelon got the general idea I was going for. Here's my solution:

print r"10e(3246578+9["[0]
print r"10e(3246578+9["[5]
print r"10e(3246578+9["[4]
print r"10e(3246578+9["[6]
print r"10e(3246578+9["[-6]
print r"10e(3246578+9["[-7]
print r"10e(3246578+9["[-5]
print r"10e(3246578+9["[-4]
print r"10e(3246578+9["[-2]
print r"10e(3246578+9["[:2]

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 15 '16 at 20:46
1
\$\begingroup\$

Python 2, 111 bytes, 10 numbers (cracked)

How about some random digits?

The hidden character is E.

print +int('''3EE5EE6EE0EE2EE5EE6EE4EE9EE1EE5EE9EE4EE6EE7EE5EE7E''')%int('''2EE0EE9EE8EE9EE2EE3EE5EE0EE3EE6''')
\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – Sp3000 Nov 16 '16 at 5:56
  • \$\begingroup\$ @Sp3000 Nice job, I don't see any L since print does str not repr. \$\endgroup\$ – feersum Nov 16 '16 at 6:02
  • \$\begingroup\$ Yeah, I forgot that REPL does repr and hence wasn't the same as print - confused myself for a sec there \$\endgroup\$ – Sp3000 Nov 16 '16 at 6:05
1
\$\begingroup\$

OCaml (interpreted), 51 bytes, 10 numbers (Cracked)

By "interpreted" I mean that it should be run with the command ocaml rather than compiled to native code with ocamlopt.

The hidden character is ^.

^^t^r^^^^-^^^^-^^r^^^^=^^^^^^^r^^^^r^^^^^^^(^^^^/0)
\$\endgroup\$
  • \$\begingroup\$ Cracked. This works in both the interpreter (specifying the file name on the command line, which I think is what you wanted?) and the compiler, so it can't be the intended solution. \$\endgroup\$ – user62131 Nov 17 '16 at 15:27
1
\$\begingroup\$

C, 10+ numbers, 216 bytes, Cracked

#include <stdio.h>

FILE *a, *b;

void x() { ____________ int x; x = __; ________a___d____x_;}
void y() { ____________ int x; fprintf(b,"%d\n",x);}
int main() {a=fopen("/dev/null", "w");b=stdout;x();y();return 0;}

If your solution doesn't work with -O1 I will reject it.

Cracked by Dada. Original file:

#include <stdio.h>

FILE *a, *b;

void x() { /**/volatile int x; x = 07; fprintf(a,"%d\n", x);}
void y() { /**/volatile int x; fprintf(b,"%d\n", x);}
int main() {a=fopen("/dev/null", "w");b=stdout;x();y();return 0;}
\$\endgroup\$
  • \$\begingroup\$ The maximum is 10 numbers \$\endgroup\$ – Cows quack Nov 13 '16 at 7:35
  • 10
    \$\begingroup\$ I'm not sure that you can arbitrarily add you own rules. \$\endgroup\$ – Jonathan Allan Nov 13 '16 at 8:49
  • \$\begingroup\$ -O1 needs to stand because works only with -O0 results in too hard to guess what some other machine's undefined behavior does. \$\endgroup\$ – Joshua Nov 13 '16 at 16:07
  • 1
    \$\begingroup\$ @KritixiLithos: The limit may be 10 but mutating it to get larger than 10 doesn't seem to be blockable. \$\endgroup\$ – Joshua Nov 13 '16 at 16:10
  • 1
    \$\begingroup\$ Cracked. I guess you had something like that in mind? \$\endgroup\$ – Dada Nov 13 '16 at 17:20
1
\$\begingroup\$

Octave, 16 bytes, 10 numbers (cracked)

As a cop, it's my duty to keep this site clean and remove any explicit content. I found1 a piece of code referring to a diabolical body part that I've decided to censor here using underscores, _.

ev_l('P_NIS'-2_)

1: Well, I found it on the screen after I wrote it.

\$\endgroup\$
1
\$\begingroup\$

QBasic, 13 bytes, 10 numbers, cracked

__I_T__O_(3))

Works for 1-10. _ is the hidden character.

\$\endgroup\$
1
\$\begingroup\$

QBasic, 12 bytes, 10 numbers, cracked

All right, let's try this:

_INT(_O_(3))

Works for 1-10. _ is the hidden character.


Finally, the crack used my intended approach. :P

\$\endgroup\$
1
\$\begingroup\$

Aceto, 5 bytes, 9 numbers, safe

_ are unrevealed chars

__xx_
Try it online!

\$\endgroup\$
0
\$\begingroup\$

Python, 28 bytes, 10 numbers, cracked!

_____ (__________)_(_____*4)_

Intended solution:

print (ord("a"   )-(24   *4))
\$\endgroup\$
  • \$\begingroup\$ Cracked (python 2): print (0+1+0*1000)+(0*0*0*4) , print (1+1+0*1000)+(0*0*0*4) e.t.c... \$\endgroup\$ – flawr Nov 13 '16 at 20:36
  • \$\begingroup\$ the official post \$\endgroup\$ – flawr Nov 13 '16 at 20:44
  • 2
    \$\begingroup\$ Why did you include so much space? I'd consider that dangerous :) \$\endgroup\$ – flawr Nov 14 '16 at 22:19
  • \$\begingroup\$ @flwar to throw you off \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Nov 15 '16 at 23:50
0
\$\begingroup\$

Java 10+ numbers 126 tokens

____00________007____________00______________________________t____o_____in_(___"___42________00____00____".___________0)___;__

_ is redacted

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 14 '16 at 20:59
0
\$\begingroup\$

Python 2, 26 bytes, 10 numbers, cracked

print r___e(_______+_[___]

Works for 1-10; _ is the hidden character.

\$\endgroup\$
  • \$\begingroup\$ Cracked in a non-intended way, I believe \$\endgroup\$ – Sp3000 Nov 15 '16 at 4:16
0
\$\begingroup\$

ASMD, 8 bytes (non-competing), Cracked!

____+++C

Works from 1-10.

\$\endgroup\$
  • \$\begingroup\$ asmd.py doesn’t implement C, but it’s listed in commands.txt. What’s up there? Also, you should specify if _ is a wildcard (I assume it is.) \$\endgroup\$ – Lynn Nov 15 '16 at 14:08
  • \$\begingroup\$ Cracked, I think \$\endgroup\$ – Lynn Nov 15 '16 at 14:12
  • \$\begingroup\$ @Lynn Oh. I will fix that \$\endgroup\$ – Oliver Ni Nov 15 '16 at 15:16
0
\$\begingroup\$

Python 2, 33 bytes, 9 numbers

#__________________
riny
________

(how mysterious?)

\$\endgroup\$
0
\$\begingroup\$

Hexagony, 15 bytes, 10 numbers, Cracked!

\!?___<3__!?_<3

What kind of love (<3) is this? This is the love of Hexagons :P

I believe this is not a hard one but a hearty one (Pun intended).

\$\endgroup\$
  • \$\begingroup\$ Sorry, cracked, but definitely not the way you intended. \$\endgroup\$ – Martin Ender Nov 15 '16 at 20:02
0
\$\begingroup\$

Hexagony, 12 bytes, 10 numbers, Cracked!

[!_>!_!1_@!_

_ can be replaced by any characters.

Seems that love doesn't belong to here should not stay here, to keep the world more interesting :P

Spent time finding cheap alternatives. So giving out much tips so that it is harder to crack (I hope impossible) with cheap alternatives !_!

\$\endgroup\$
  • \$\begingroup\$ Edited to avoid a cheap solution breaking my <3 \$\endgroup\$ – Sunny Pun Nov 16 '16 at 12:10
  • 2
    \$\begingroup\$ I'm afraid it's still not secure. Cracked. \$\endgroup\$ – Martin Ender Nov 16 '16 at 12:13
  • \$\begingroup\$ Oh... then I should type up my intended solution - seems I don't have the mind to block all unintended mirrors... Thanks for playing @MartinEnder :) \$\endgroup\$ – Sunny Pun Nov 16 '16 at 12:19
  • \$\begingroup\$ Maybe try another one with fewer _? To be fair, it seems pretty hard to get a secure cop in Hexagony. I'd love to see one, but I'm not sure yet how to write one myself. \$\endgroup\$ – Martin Ender Nov 16 '16 at 12:22
  • \$\begingroup\$ Mm... Basically the same for me, ready for a post edit? @MartinEnder This should be my final try :P \$\endgroup\$ – Sunny Pun Nov 16 '16 at 12:29
0
\$\begingroup\$

Ruby, 81 bytes, 10 numbers, cracked by feersum

require'digest/md5'
p Digest::MD5.digest('########')[n=0].ord^'straYNpraq'[n].ord

# is the placeholder character. Is this a standard loophole yet? Not that it's uncrackable I don't think, I've left in some weaknesses intentionally and I'm sure unintentionally.

\$\endgroup\$
  • 2
    \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 16 '16 at 0:13
0
\$\begingroup\$

Python 2, 109 bytes, 10 numbers

from hashlib import *
h=md5()
h.update('__[_')
if h.hexdigest()=='88f4002e27b0902c7018359da9bc5b44':print(0+1)
\$\endgroup\$
0
\$\begingroup\$

Hexagony, 18 bytes, 10 numbers, Cracked!

This submission works for 1 - 10. Unrevealed characters are indicated with an underscore: _.

.__{_]5[$@__=@_!!1

You can try Hexagony online over here.

I posted a follow-up using the same indended solution, but with fewer hidden characters here.

\$\endgroup\$
  • 3
    \$\begingroup\$ Cracked. As I told Sunny Pun, I doubt that a program at this size can be sufficiently constrained with so many wildcards. \$\endgroup\$ – Martin Ender Nov 17 '16 at 8:09
  • \$\begingroup\$ It's hard to not give it away but also not allow trivial solutions. If I had given something like this would you have gotten it? .__{_]5[$@.;=@$!!1 \$\endgroup\$ – Riley Nov 17 '16 at 13:42
  • \$\begingroup\$ That one is definitely a lot harder. \$\endgroup\$ – Martin Ender Nov 17 '16 at 13:59
  • \$\begingroup\$ @MartinEnder I almost went with that one, but because I already knew the intended solution I thought it gave it away. \$\endgroup\$ – Riley Nov 17 '16 at 14:02
  • \$\begingroup\$ Feel free to post that as a new cop, still haven't figured it out. \$\endgroup\$ – Martin Ender Nov 17 '16 at 14:24
0
\$\begingroup\$

Python 3, 56 bytes, 6 numbers, Cracked

Quite a simple concept, should be easily crackable. The 'mystery characters' are indicated with underscores.

print(_______(str(ord(x))for x in ________).___________)
\$\endgroup\$
  • \$\begingroup\$ Cracked. Pretty sure you had something else in mind...? :) \$\endgroup\$ – Stewie Griffin Nov 17 '16 at 14:51
  • \$\begingroup\$ @StewieGriffin yep, shouldn't have put so many mystery chars :P \$\endgroup\$ – FlipTack Nov 17 '16 at 14:55
0
\$\begingroup\$

Acc!!, 46 bytes, 10 numbers, cracked

?
Count i while ?????????????????
}
Write ????

Works for 1 to 10, with ? as the hidden character.


Original solution:

1
Count i while _/10 {
Write 49
0
}
Write 48+_
The initial accumulator value goes from 1 to 9 and then to 99. Whenever it is less than 10, _/10 is 0 and the loop doesn't execute. When it is greater than 10, the inner loop writes a 1 and sets the accumulator to 0, which breaks out of the loop and writes a 0.

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 17 '16 at 9:22
0
\$\begingroup\$

TI-Basic, 13 tokens, 10 numbers, cracked

DelVar A1→θ
__>A
θ

_ represents a hidden token. Hopefully this isn't too easy xD

\$\endgroup\$
  • \$\begingroup\$ How many _s are there? \$\endgroup\$ – Cows quack Nov 13 '16 at 17:46
  • \$\begingroup\$ Two @KritixiLithos \$\endgroup\$ – Timtech Nov 13 '16 at 18:34
  • 1
    \$\begingroup\$ Which calculator version of TI-Basic is this? (Keep in mind that only "free" languages can be used in cops-and-robbers) \$\endgroup\$ – flawr Nov 13 '16 at 19:03
  • \$\begingroup\$ It's TI-83/84 BASIC. Try cemetech.net/sc or cemetech.net/projects/jstified \$\endgroup\$ – Timtech Nov 13 '16 at 19:26
  • \$\begingroup\$ @Timtech It does seem to require a ROM in order to run, is that correct? \$\endgroup\$ – flawr Nov 13 '16 at 21:11
0
\$\begingroup\$

ASMD, 10 bytes (non-competing) Cracked!

1_**_**_*÷

Hidden characters are denoted by _.

This should be really easy to crack.

Works from 1 to 10.

\$\endgroup\$
  • 2
    \$\begingroup\$ Why is this non-competing? \$\endgroup\$ – Stewie Griffin Nov 14 '16 at 7:14
  • \$\begingroup\$ @StewieGriffin The latest commit for ASMD was only a few hours ago and it was created today \$\endgroup\$ – Cows quack Nov 14 '16 at 7:44
  • \$\begingroup\$ Cracked? \$\endgroup\$ – Riley Nov 18 '16 at 1:21
0
\$\begingroup\$

tinylisp, 43 bytes, 10 numbers

((v(d f(q((n)(i n(s 1(s 0(f(___))))1)))))0)

Works for 1-10; _ is hidden.

\$\endgroup\$
  • \$\begingroup\$ I think this is safe now...? 😊 \$\endgroup\$ – Stewie Griffin Nov 28 '16 at 21:35
0
\$\begingroup\$

QBasic, 12 bytes, 10 numbers, cracked

Previous version's red herring created a loophole...

_I_T__O_(3))

Works for 1-10. _ is the hidden character.

\$\endgroup\$
-1
\$\begingroup\$

R, 22 bytes, 10 numbers SAFE

_et___e_(_)____is_1___

_ is hidden character

Solution:

set.seed(4);rpois(1,1)
set.seed(4);rpois(1,2)
set.seed(4);rpois(1,3)
set.seed(4);rpois(1,4)
set.seed(4);rpois(1,5)
set.seed(4);rpois(1,6)
set.seed(4);rpois(1,7)
set.seed(6);rpois(1,7)
set.seed(6);rpois(1,8)
set.seed(6);rpois(1,9)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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