24
\$\begingroup\$

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

Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made.

The winner will be the robber that cracked the most posts.

Example post:

MyLang, 9 bytes, 8 numbers (including link to answer), Cop's username.

Original code:

abc1efghi

Code that produces 1 - 8:

1: abc1efghi
2: abc2efghi
3: abc2efghij
4: kbc2efghij
5: kbc23fghij
6: kbc23fghi
7: kbc63fghi
8: kbc63fhi

Explanations are encouraged. The exact format of the robber post is optional.

\$\endgroup\$

85 Answers 85

3
\$\begingroup\$

Python 3, 19 bytes, 10 numbers, Sp3000

Newlines are a real bummer.

print(##bin()

0+1)

0+1 ... 9+1.

\$\endgroup\$
  • \$\begingroup\$ Yeah... I forget about newlines every CnR... :/ \$\endgroup\$ – Sp3000 Nov 15 '16 at 3:22
3
\$\begingroup\$

JavaScript, 21 Bytes, 10 Numbers, Shaun H

Original:

alert(b_oa_"3____1"))

First:

alert(btoa|"3"&("1")) 

Then:

alert(btoa|"3"-("1")) 
alert(btoa|"3"-("0")) 
alert(btoa|"4"-("0")) 
alert(btoa|"5"-("0")) 
alert(btoa|"6"-("0")) 
alert(btoa|"7"-("0")) 
alert(btoa|"8"-("0")) 
alert(btoa|"9"-("0")) 
alert(btoa|"9"-(~"0"))

//Using console.log instead of alert

console.log(btoa|"3"&("1"))
console.log(btoa|"3"-("1"))
console.log(btoa|"3"-("0"))
console.log(btoa|"4"-("0"))
console.log(btoa|"5"-("0"))
console.log(btoa|"6"-("0"))
console.log(btoa|"7"-("0"))
console.log(btoa|"8"-("0"))
console.log(btoa|"9"-("0"))
console.log(btoa|"9"-(~"0"))

\$\endgroup\$
3
\$\begingroup\$

Python 2, 26 bytes, 10 numbers, DLosc

Original:

print r___e(3______+_[___]

Solve:

print range(3,)[1]#+_[___]
print range(3,)[-1]#+_[___]
print range(3,4)[-1]#+_[___]
print range(3,5)[-1]#+_[___]
print range(3,6)[-1]#+_[___]
print range(3,7)[-1]#+_[___]
print range(3,8)[-1]#+_[___]
print range(3,9)[-1]#+_[___]
print range(3^9)[-1]#+_[___]
print range(2^9)[-1]#+_[___]

Yeah, I'm fairly sure this still isn't the intended solve.

\$\endgroup\$
  • \$\begingroup\$ I am learning things about Python that I never knew. Never expected range(3,) to be valid syntax. \$\endgroup\$ – DLosc Nov 15 '16 at 6:34
3
\$\begingroup\$

Befunge-93, 11 bytes, 10 numbers, James Holderness

"15:**-6-.@
"15:**-6-2.@
"15:**-6-2+.@
"15:**-6-3+.@
...
"15:**-6-9+.@

A more complete crack of James' Befunge cop, after Martin's here. Because Befunge-93 has a limited board, the IP actually waits until it gets to the end of the board before wrapping around, unlike other 2D languages such as ><>. This means that a wraparound char push with " ends up pushing the values of the empty cells too, which by default is 32 for space.

Hence here at the start we push a bunch of chars, with 32 on top, then 1:5**- on that gives 32 - (1*(5*5)) = 32 - 25 = 7. Subtract another 6, and we have 1 to start off the ladder.

\$\endgroup\$
  • \$\begingroup\$ Not only was your quote trick unexpected, but I never realised you could so easily get the rest of the sequence once you had the 1. In retrospect, Martin's solution could have been made to work in the same way without having to resort to the -1 hack. \$\endgroup\$ – James Holderness Nov 15 '16 at 15:00
  • \$\begingroup\$ @JamesHolderness Come to think about it... yeah, that would have been much simpler (and nicer) \$\endgroup\$ – Sp3000 Nov 16 '16 at 6:00
3
\$\begingroup\$

Python 2, 111 bytes, 10 numbers, feersum

Original, then the program for 1:

print +int('''3EE5EE6EE0EE2EE5EE6EE4EE9EE1EE5EE9EE4EE6EE7EE5EE7E''')%int('''2EE0EE9EE8EE9EE2EE3EE5EE0EE3EE6''')
print +int('''39951562603020050069949998519154798549467371659275''')%int('''2000009008009002\x3005000\x3006''')

The other programs are just appending 1-9 before the +. With numbers of this size the problem is fairly simple, since we have a lot of freedom in the lower digits of the larger number. To make things a bit easier, a few of the 3s in the modulus have been turned into \x30, which is the code point for 0.

\$\endgroup\$
3
\$\begingroup\$

Perl, 31 bytes, 10 numbers, by Gabriel Benamy

I'm pretty sure this is the intended answer this time (up to trivial variations, such as using '<' rather than "<").

Original code (must be saved to a file and run via giving the file at the command line, it doesn't matter what the name is):

__e_$a,_<__$_;1 while_$a_;say$_

Crack for 1:

open$a,"<",$0;1 while<$a>;say$.

To crack for the other values, append a newline to the file each time (e.g. the above prints 2 with one newline appended, 3 with two newlines appended, and so on). The program works by reading its own source code from disk (this isn't a quine competition, so you're allowed to do that!) and printing the line number of the line just beyond the end.

I found this via deducing that it probably started with a keyword or built-in function with a four letter name, and searching the list of keywords and builtin functions for functions matching ..e.. As soon as you realise that open is a possibility, everything is straightforward from there (the unknown character before the final semicolon is in retrospect very suspicious).

\$\endgroup\$
  • 1
    \$\begingroup\$ Yes! This was it all along! \$\endgroup\$ – Gabriel Benamy Nov 17 '16 at 15:45
2
\$\begingroup\$

Pyth, 3 bytes, 10 numbers, by Yotam Salmon

Original code was __Q, with_ unknown.

1.Q: Implicit print 1, throw error when trying to evaluate empty input. Same answer for 2-9 (with the number 1 replaced by 2-9), and the code T.Q for 10 (since T is initialized to 10).

\$\endgroup\$
  • \$\begingroup\$ Cool solution! Not what I thought of ;-) But my solution worked for any number, and yours works up to 10. Is that accepted? \$\endgroup\$ – Yotam Salmon Nov 13 '16 at 15:39
2
\$\begingroup\$

Octave, 19 bytes, 10 numbers, by flawr

Probably not the intended solution, but hey.

'psca'(1 )+'1'-160'
'qsca'(1 )+'1'-160'
...
'ysca'(1 )+'1'-160'
\$\endgroup\$
  • \$\begingroup\$ Wasn't even close to my solution=) \$\endgroup\$ – flawr Nov 13 '16 at 10:48
2
\$\begingroup\$

Octave, 26 bytes, 10 numbers, by LuisMendo

original
__a__repmat(_+one___1+__))

solution:
mean(repmat(0+ones, 1+0 ))
mean(repmat(1+ones, 1+0 ))
mean(repmat(2+ones, 1+0 ))
...
\$\endgroup\$
2
\$\begingroup\$

Octave, 17 bytes, 10 numbers, by flawr

From

_od(3_13_13_7_1_)

To the original code:

mod(3113+1387,11) #1

The rest of the numbers:

mod(3113+1388,11) #2
mod(3113+1389,11) #3
mod(3114+1389,11) #4
mod(3115+1389,11) #5
mod(3116+1389,11) #6
mod(3117+1389,11) #7
mod(3118+1389,11) #8
mod(3119+1389,11) #9
mod(3119+1379,11) #10

Try it online! for the first case

Explanation

mod(x, y) computes the modulo of x and y. Here is the docs for mod.

Process

I don't know Octave, I've never used it, but I was interested in this particular sumbission. So I decided to try to crack it. First, I used this website to help me find an Octave command that is three characters long and has an od in the end. I found it to be mod. Then I began experimenting with the numbers in its online interpreter. After some time, I ended up with

mod(3_13+13_7,1_)

after which time I decided to create a python script (on TIOv2!) to brute-force the solution. The script printed the values for the _ whenever first_param%second_param==1. I first ran the python script for 10 (the second paramter to the mod function). I got tons of hits. Then I ran it again for 11. I got only a few hits this time, after which I decided to use 11 as the second parameter and the following values for the first parameter 3113+1387 just out of randomness. Now I got the original code. From there, I began incrementing the last digit of the numbers, so that I did 1387->1388->1389 and then 3113->3114->3115->3116->3117->3118->3119. Now I got the first 9 numbers.

mod(3119+1389,11) #evaluates to 9

Now 10 was the only one remaining. I tried changing the 1389 to 1399 to see if it becomes 10, but instead it resulted to 8. So I changed it to 1379, and it resulted in 10!

\$\endgroup\$
  • 1
    \$\begingroup\$ That almost feels like cheating, but good job! =) \$\endgroup\$ – flawr Nov 13 '16 at 15:34
  • 1
    \$\begingroup\$ @flawr Well, you know how the saying goes, "Fight code with code," or in this case, "Crack code using code." :) \$\endgroup\$ – Cows quack Nov 13 '16 at 15:43
  • \$\begingroup\$ Good luck with this one =) \$\endgroup\$ – flawr Nov 13 '16 at 18:48
2
\$\begingroup\$

C, 216 bytes, 10 numbers, by Joshua

Original code :

#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;}

Cracked code :

#include <stdio.h>

FILE *a, *b;

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

Change the x = 0 to the number you want to print minus 1 : x=0 for 1, x=1 for 2, x=2 for 3 etc, until x=9 for 10.

\$\endgroup\$
  • \$\begingroup\$ This is indeed the form of the solution. I have a few characters different but this does work. \$\endgroup\$ – Joshua Nov 13 '16 at 22:01
  • \$\begingroup\$ @Joshua I think you didn't used volatile since at first you said there were no spaces in the eleven _ before int x, so what did you use instead? (I'm intrigued because I don't think there is any C keyword that is 11 characters long...) \$\endgroup\$ – Dada Nov 13 '16 at 22:06
  • \$\begingroup\$ I used volatile/**/ to throw people off the scent. ;;;;volatile also works the same way. \$\endgroup\$ – Joshua Nov 13 '16 at 22:07
  • \$\begingroup\$ @Joshua volatile/**/ is 12 characters long and there were only 11 underscores... \$\endgroup\$ – Dada Nov 13 '16 at 22:09
  • \$\begingroup\$ my bad. It's a transcription error on masking it. Did you notice also your file was 214 bytes? \$\endgroup\$ – Joshua Nov 13 '16 at 22:11
2
\$\begingroup\$

PowerShell, 7 bytes, 10 numbers, by TimmyD

Original code :

___(__0

Cracked code :

+1#(__0
+2#(__0
+3#(__0
...
+9#(__0
1+9#(__0
\$\endgroup\$
2
\$\begingroup\$

Java, 70 bytes, 10(+) numbers, by masterX244

//Submission v
__________________________ ____(_____________________________)________
//Original code v
class A{public static void main(String[]a){System.out.print(')'-40);}}//1

This makes use of the character codes for numbers. The char ) is 41. So when you subtract 40 from it, it evaluates to 1. By incrementing the char by 1, we effectively increase the output by 1 too.

Try it online in Ideone!. Note: in Ideone, you need to have public before class and the name of the class should be HelloWorld

Other numbers:

class A{public static void main(String[]a){System.out.print('*'-40);}}//2
class A{public static void main(String[]a){System.out.print('+'-40);}}//3
class A{public static void main(String[]a){System.out.print(','-40);}}//4
class A{public static void main(String[]a){System.out.print('-'-40);}}//5
class A{public static void main(String[]a){System.out.print('.'-40);}}//6
class A{public static void main(String[]a){System.out.print('/'-40);}}//7
class A{public static void main(String[]a){System.out.print('0'-40);}}//8
class A{public static void main(String[]a){System.out.print('1'-40);}}//9
class A{public static void main(String[]a){System.out.print('2'-40);}}//10
...
class A{public static void main(String[]a){System.out.print('~'-40);}}//86

Edit: fixed mistake

Edit 2: Yes, this can go upto 86 and maybe even more!

\$\endgroup\$
  • \$\begingroup\$ Grrr. Back to square one... need some dirtier code... \$\endgroup\$ – masterX244 Nov 14 '16 at 11:52
2
\$\begingroup\$

Java, 126 bytes, 10 numbers, masterX244

Yes we have seen Unicode escapes many times here at PPCG.

cl\u0061ss Z\u007bpublic st\u0061tic void main(String[]a){System. out.print(/*_"___42*/0+1/*_00____00____".*/)/*______0)_*/;}}

s/0+1/1+1/ ... 9+1.

\$\endgroup\$
  • \$\begingroup\$ Damn again... btw my intended solution only has one commented out character \$\endgroup\$ – masterX244 Nov 14 '16 at 21:05
  • \$\begingroup\$ got more unicode for you to crack this time.... \$\endgroup\$ – masterX244 Nov 15 '16 at 9:25
2
\$\begingroup\$

Python 2, 26 bytes, 10 numbers, DLosc

print range(11)[1or+ [  ]]
print range(11)[2or+ [  ]]
print range(11)[3or+ [  ]]
print range(11)[4or+ [  ]]
print range(11)[5or+ [  ]]
print range(11)[-5or+ [  ]]
print range(11)[-4or+ [  ]]
print range(11)[-3or+ [  ]]
print range(11)[-2or+ [  ]]
print range(11)[-1or+ [  ]]

I thought I'd try this with comments or newlines or anything. Definitely not the intended solution...

\$\endgroup\$
  • \$\begingroup\$ Nope, not intended. :) Back to the drawing board... \$\endgroup\$ – DLosc Nov 15 '16 at 4:18
2
\$\begingroup\$

JavaScript (ES6), 63 bytes, 10 numbers by Arnauld

Original code:

eval([...(n=0,"l?0?a?(?x?")].sort(_=>[...????+[]][n++]).join``)

Modified:

eval([...(n=0,"le0ta1(rx)")].sort(_=>[...8/73+[]][n++]).join``)
eval([...(n=0,"le0ta2(rx)")].sort(_=>[...8/73+[]][n++]).join``)
...
eval([...(n=0,"le0ta9(rx)")].sort(_=>[...8/73+[]][n++]).join``)
eval([...(n=0,"le0taa(rx)")].sort(_=>[...8/73+[]][n++]).join``)

This was a lot of fun to get to the bottom of, even though my first approach was off!

\$\endgroup\$
  • 1
    \$\begingroup\$ Hey, well done! ;) \$\endgroup\$ – Arnauld Nov 15 '16 at 13:29
2
\$\begingroup\$

Perl, 31 bytes, 10 numbers, by Gabriel Benamy

Original code:

__e_$a__<__$_;1 while_$a_;say$_

Cracked:

  1. the;$a+=<1\$>;1 while!$a ;say$a
  2. the;$a+=<1\$>+1 while!$a ;say$a
  3. the;$a+=<1\$>+2 while!$a ;say$a
  4. the;$a+=<1\$>+3 while!$a ;say$a
  5. the;$a+=<1\$>+4 while!$a ;say$a
  6. the;$a+=<1\$>+5 while!$a ;say$a
  7. the;$a+=<1\$>+6 while!$a ;say$a
  8. the;$a+=<1\$>+7 while!$a ;say$a
  9. the;$a+=<1\$>+8 while!$a ;say$a
  10. the;$a+=<1\$>+9 while!$a ;say$a

The principle using q<> I used last time doesn't seem to quite work here, so I used one of the intended uses of <> brackets (if a fairly obscure one) to create the string 1$ via globbing. Using += rather than = for the assignment to $a converts it to an integer, thus just 1, and then the solution continues the same way as my previous crack.

Fun fact: random sequences of letters in void context (such as the) are no-ops in Perl if they don't happen to spell a keyword.

\$\endgroup\$
  • \$\begingroup\$ You're really gonna make me give up how I did it, aren't you? :P Should I add one more byte to confuse you? \$\endgroup\$ – Gabriel Benamy Nov 15 '16 at 16:59
2
\$\begingroup\$

Perl, 26 bytes, 10 numbers by Gabriel Benamy

Original code:

____;@a=($_..10);say$a[__]

Cracked:

$_=0;@a=($_..10);say$a[+1]
$_=1;@a=($_..10);say$a[+1]
$_=2;@a=($_..10);say$a[+1]
$_=3;@a=($_..10);say$a[+1]
$_=4;@a=($_..10);say$a[+1]
$_=5;@a=($_..10);say$a[+1]
$_=6;@a=($_..10);say$a[+1]
$_=7;@a=($_..10);say$a[+1]
$_=8;@a=($_..10);say$a[+1]
$_=9;@a=($_..10);say$a[+1]

In fact I tested this on my Mac using print instead of say with perl -e... However I do think they should work basically the same.

This is incrementing the "base" of the array and say the second element of the array. Replacing _s by other characters should work too.

\$\endgroup\$
2
\$\begingroup\$

Perl, 26 bytes, 10 numbers, by Gabriel Benamy

Original code:

____;@a=($_..10);say$a[__]

Cracked:

  1. ____;@a=($|..10);say$a[+1]
  2. ____;@a=($|..10);say$a[1+1]
  3. ____;@a=($|..10);say$a[2+1]
  4. ____;@a=($|..10);say$a[3+1]
  5. ____;@a=($|..10);say$a[4+1]
  6. ____;@a=($|..10);say$a[5+1]
  7. ____;@a=($|..10);say$a[6+1]
  8. ____;@a=($|..10);say$a[7+1]
  9. ____;@a=($|..10);say$a[8+1]
  10. ____;@a=($|..10);say$a[9+1]

I didn't even need the blanks at the start (and as ____ is a legal but pointless Perl statement, I left them as is). The only subtlety here is finding a variable that starts at 0, but there are plenty to choose from; I chose $|.

\$\endgroup\$
2
\$\begingroup\$

C++, 10 numbers, 468 bytes, by Joshua

Original program:

#include <unistd.h>
#include <iostream>
#include <fstream>

$$$$$$$$$$$$$ {
    std::ofstream *garbalgase()
    {
        std::ofstream *golgi = new std::ofstream;
        golgi->open("/dev/null");
        return golgi;
    }

    std::ostream * const jawbone = garbalgase();
    $$$$$ int value = $_$$$$$$;
}

int main()
{
    $$$$$ $$$$$$$$/$$int vl = value;
    if (fork() == 0)
    {
        $$$$$$$$$$$<std::ostream $*>($jawbone) = &std::cout;
        vl -= 4;
        _exit(0);
    }
    (*jawbone) << (vl - 9) << std::endl;
}

My crack (prints 1):

#include <unistd.h>
#include <iostream>
#include <fstream>

extern "C++"  {
    std::ofstream *garbalgase()
    {
        std::ofstream *golgi = new std::ofstream;
        golgi->open("/dev/null");
        return golgi;
    }

    std::ostream * const jawbone = garbalgase();
    /*$*/ int value = '_',vl=1;
}

int main()
{
    std:: cout<<+1/1;int vl = value;
    if (fork() == 0)
    {
        //$$$$$$$$$<std::ostream $*>($jawbone) = &std::cout;
        vl -= 4;
        _exit(0);
    }
    (*jawbone) << (vl - 9) << std::endl;
}

To get a crack for 2 up to 10, change the +1/1 to 1+1/1, 2+1/1, 3+1/1, and so on.

I originally tried to comment out much more of the program than this, but it turns out that most of it is naturally harmless and cancels itself out. (Because it happens to use _exit rather than exit, we can put the number to print out into the stdout buffer in both threads; the parent thread won't have time to flush it before it exits.) The hardest part is dealing with the } character just before int main(); you can't make it the closing brace of a function without -fpermissive, but you can make it the closing brace of a calling convention block (in this case I used extern "C++", the default, to basically cancel the braces out).

I also accidentally declared vl twice, but oh well. It doesn't break the crack, just shows how many spare characters there are here.

\$\endgroup\$
  • \$\begingroup\$ Ohhhh, extern "C++"! That was the missing piece of the puzzle for me. \$\endgroup\$ – Lynn Nov 15 '16 at 18:11
  • \$\begingroup\$ The intended solution is quite different. I forgot you could have a space after :: or I would have managed to block this solution. Oh well. \$\endgroup\$ – Joshua Nov 15 '16 at 18:34
2
\$\begingroup\$

COW, 51 bytes, 10 numbers, by Gabriel Benamy

MoO ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ OOM // incomplete
MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM //original code outputs 1

Other numbers:

MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM //2
MoO MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM //3
MoO MoO MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM //4
MoO MoO MoO MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM //5
MoO MoO MoO MoO MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ Mo_ OOM //6
MoO MoO MoO MoO MoO MoO MoO Mo_ Mo_ Mo_ Mo_ Mo_ OOM //7
MoO MoO MoO MoO MoO MoO MoO MoO Mo_ Mo_ Mo_ Mo_ OOM //8
MoO MoO MoO MoO MoO MoO MoO MoO MoO Mo_ Mo_ Mo_ OOM //9
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Mo_ Mo_ OOM //10

Explanation

MoO //increment current memory block value by 1.
OOM //print current memory block as output to STDOUT
Mo_ //gets ignored since the compiler doesn't recognise it

Try it online!

Cows don't moo, Cows quack!

\$\endgroup\$
2
\$\begingroup\$

Hexagony, 15 bytes, 10 numbers, Sunny Pun

\!?\1<<3@_!?_<3
\!?\2<<3@_!?_<3
\!?\3<<3@_!?_<3
\!?\4<<3@_!?_<3
\!?\5<<3@_!?_<3
\!?\6<<3@_!?_<3
\!?\7<<3@_!?_<3
\!?\8<<3@_!?_<3
\!?\9<<3@_!?_<3
\!?\9)<<3@_!?_<3

Try it online!

I'm afraid this wasn't sufficiently well constrained (as this is almost definitely nowhere near the intended solution).

\$\endgroup\$
  • \$\begingroup\$ Will mark as cracked once not on mobile. Overlooked that adding a byte at line 2 will also shift line 3 :P \$\endgroup\$ – Sunny Pun Nov 15 '16 at 20:10
2
\$\begingroup\$

Python 2, 26 bytes, 10 numbers DLosc

Original: print r___e(3_4____+_[___]

print range(304)[ 1+#[
0 ]

Where the 0 character is incremented up through 9.

\$\endgroup\$
  • \$\begingroup\$ Well, Sp3000 warned me about newlines... heh. Have an upvote. \$\endgroup\$ – DLosc Nov 15 '16 at 21:28
  • \$\begingroup\$ alternate: print r'1_e(3_4____+'[0 ] \$\endgroup\$ – Destructible Lemon Nov 15 '16 at 23:16
  • \$\begingroup\$ @DestructibleWatermelon How do you get 10 with that? \$\endgroup\$ – feersum Nov 15 '16 at 23:18
  • \$\begingroup\$ whoops lol. It almost worked \$\endgroup\$ – Destructible Lemon Nov 15 '16 at 23:22
  • \$\begingroup\$ I got it! print r'10e(3642345+'[0+0], print r'10e(3642345+'[0+7], print r'10(3642345+'[0+7], print r'103642345+'[0+7], print r'10642345+'[0+7], print r'10642345+'[0+2], print r'10742345+'[0+2], print r'10842345+'[0+2], print r'10942345+'[0+2], print r'10942345+'[0:2] \$\endgroup\$ – Destructible Lemon Nov 15 '16 at 23:45
2
\$\begingroup\$

JavaScript, 33 Bytes, 10 Numbers, Shaun H

Original:

alert(_to__"_Xc0__0_B6____Zp=="))

First:

alert(atob|"0Xc0"/0xB6||("Zp=="))

Then:

alert(atob|"0X1c0"/0xB6||("Zp=="))
alert(atob|"0X2c0"/0xB6||("Zp=="))
alert(atob|"0X2F0"/0xB6||("Zp=="))
alert(atob|"0X3F0"/0xB6||("Zp=="))
alert(atob|"0X4F0"/0xB6||("Zp=="))
alert(atob|"0X4F0"/0xB0||("Zp=="))
alert(atob|"0X5F0"/0xB0||("Zp=="))
alert(atob|"0X5F0"/0xA0||("Zp=="))
alert(atob|"0X5F0"/0x90||("Zp=="))

// Using console.log instead of alert

console.log(atob|"0Xc0"/0xB6||("Zp=="))
console.log(atob|"0X1c0"/0xB6||("Zp=="))
console.log(atob|"0X2c0"/0xB6||("Zp=="))
console.log(atob|"0X2F0"/0xB6||("Zp=="))
console.log(atob|"0X3F0"/0xB6||("Zp=="))
console.log(atob|"0X4F0"/0xB6||("Zp=="))
console.log(atob|"0X4F0"/0xB0||("Zp=="))
console.log(atob|"0X5F0"/0xB0||("Zp=="))
console.log(atob|"0X5F0"/0xA0||("Zp=="))
console.log(atob|"0X5F0"/0x90||("Zp=="))


The intended version:

alert(_to__"_Xc0__0_Bf____Zp=="))

First:

alert(atob|"0Xc0"/0xBf||("Zp=="))

Then:

alert(atob|"0X1c0"/0xBf||("Zp=="))
alert(atob|"0X2c0"/0xBf||("Zp=="))
alert(atob|"0X2c0"/0xB0||("Zp=="))
alert(atob|"0X3c0"/0xB0||("Zp=="))
alert(atob|"0X4c0"/0xB0||("Zp=="))
alert(atob|"0X4F0"/0xB0||("Zp=="))
alert(atob|"0X5F0"/0xB0||("Zp=="))
alert(atob|"0X5F0"/0xA0||("Zp=="))
alert(atob|"0X5F0"/0x90||("Zp=="))

// Using console.log instead of alert

console.log(atob|"0Xc0"/0xBf||("Zp=="))
console.log(atob|"0X1c0"/0xBf||("Zp=="))
console.log(atob|"0X2c0"/0xBf||("Zp=="))
console.log(atob|"0X2c0"/0xB0||("Zp=="))
console.log(atob|"0X3c0"/0xB0||("Zp=="))
console.log(atob|"0X4c0"/0xB0||("Zp=="))
console.log(atob|"0X4F0"/0xB0||("Zp=="))
console.log(atob|"0X5F0"/0xB0||("Zp=="))
console.log(atob|"0X5F0"/0xA0||("Zp=="))
console.log(atob|"0X5F0"/0x90||("Zp=="))

Intended crack?

alert(atob|"0Xc0"-0xBf||("Zp=="))
alert(atob|"0Xc0"-0xBe||("Zp=="))
alert(atob|"0Xc0"-0xBd||("Zp=="))
alert(atob|"0Xc0"-0xBc||("Zp=="))
alert(atob|"0Xc0"-0xBb||("Zp=="))
alert(atob|"0Xc0"-0xBa||("Zp=="))
alert(atob|"0Xc0"-0xB9||("Zp=="))
alert(atob|"0Xc0"-0xB7||("Zp=="))
alert(atob|"0Xc0"-0xB6||("Zp=="))

// Using console.log instead of alert

console.log(atob|"0Xc0"-0xBf||("Zp=="))
console.log(atob|"0Xc0"-0xBe||("Zp=="))
console.log(atob|"0Xc0"-0xBd||("Zp=="))
console.log(atob|"0Xc0"-0xBc||("Zp=="))
console.log(atob|"0Xc0"-0xBb||("Zp=="))
console.log(atob|"0Xc0"-0xBa||("Zp=="))
console.log(atob|"0Xc0"-0xB9||("Zp=="))
console.log(atob|"0Xc0"-0xB7||("Zp=="))
console.log(atob|"0Xc0"-0xB6||("Zp=="))

\$\endgroup\$
  • \$\begingroup\$ I accidentally posted my version for 10 and you still cracked it, nice \$\endgroup\$ – Shaun H Nov 16 '16 at 21:34
  • \$\begingroup\$ Posted my intended puzzle in the Cops answer, still gave you crack credit but if you want another puzzle feel free to try it. \$\endgroup\$ – Shaun H Nov 16 '16 at 21:43
2
\$\begingroup\$

Python 3, 56 bytes, 6 numbers, by Flp.Tkc

Cop's post:

print(_______(str(ord(x))for x in ________).___________)

Crack:

print(0+1)#__(str(ord(x))for x in ________).___________)
print(1+1)#__(str(ord(x))for x in ________).___________)
print(2+1)#__(str(ord(x))for x in ________).___________)
...
\$\endgroup\$
2
\$\begingroup\$

Ocaml, 51 bytes, 10 numbers, by feersum

Original code:

^^t^r^^^^-^^^^-^^r^^^^=^^^^^^^r^^^^r^^^^^^^(^^^^/0)

Cracks for 1-10:

  1. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/0)
  2. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/1)
  3. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/2)
  4. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/3)
  5. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/4)
  6. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/5)
  7. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/6)
  8. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/7)
  9. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/8)
  10. let(r, (-/)(*- r*)) =0,(+);;r;; print_int(1 -/9)

The hard part is to get rid of the /0, which would normally cause an error. There's just enough room to define a new operator (-/), which I defined to be an alias for addition (+). Then I could construct the answer with 1-/0, 1-/1, 1-/2, and so on. The rest of the solution fits the other required characters into place with comment marks (* *) and statement marks ;;, and mostly just cancels itself out (although I had to define r in order to handle the first r in the program and in order for ;;r;; to correctly be a no-op).

\$\endgroup\$
  • \$\begingroup\$ I failed to consider the let statement with tuple assignment. Trying again with one more revealed. \$\endgroup\$ – feersum Nov 17 '16 at 23:54
2
\$\begingroup\$

OCaml, 51 bytes, 10 numbers, by feersum

Original code:

^^t^r^^^^-^^^^-^^r^^^^=^^^^^^^r^^^^r^^^^^^^(^^^0/0)

Code that produces 1-10:

  1. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/0/0)
  2. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/1/0)
  3. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/2/0)
  4. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/3/0)
  5. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/4/0)
  6. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/5/0)
  7. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/6/0)
  8. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/7/0)
  9. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/8/0)
  10. let r,((*-^^^^-^^r*)/)=0,(+);;r;; print_int( 1/9/0)

The same trick still works; there's rather less room, because now I have to redefine division to mean addition rather than using a new operator, but there's still enough.

\$\endgroup\$
2
\$\begingroup\$

R, 22 bytes, 10 numbers by Gregor

Original code:

_et_______)____is_____

Cracked:

For 1

#et
cat(+1)#___is_____

For 2

#et
cat(1+1)#___is_____

For the rest just increment the 1's

found a short enough print to sneak it in a gap with newline and comment.

\$\endgroup\$
  • 1
    \$\begingroup\$ the cat is after a newline which is placed behind the _et :P @Gregor And newlines are exactly one character \$\endgroup\$ – masterX244 Nov 18 '16 at 17:30
  • \$\begingroup\$ Hmmm, I guess it's legit. \$\endgroup\$ – Gregor Nov 18 '16 at 17:35
  • \$\begingroup\$ yeah, some other submissions got broken in a similar way, always check that gaps don't allow to sneak something in to avoid surprise cracks like this one. @Gregor \$\endgroup\$ – masterX244 Nov 18 '16 at 17:36
2
\$\begingroup\$

Octave, 16 bytes, 10 numbers by Stewe Griffin

Original code:

ev_l('P_NIS'-2_)

Cracked:

eval('PFNIS'-28)
eval('PFNIR'-28)
eval('PFNIQ'-28)
eval('PFNIP'-28)
eval('PFNIO'-28)
eval('PFNIN'-28)
eval('PFNIM'-28)
eval('PFNzM'-28)
eval('PFNGM'-28)
eval('PFNGN'-28)

After finding a way around the 8 without a zero it was easy. Trick was to use the 1 as a exponent which is a no-op and then contineru with +
relevant part unobfuscated here:

4*2-1
eval('PFNIM'-28)
4*2^1
eval('PFNzM'-28)
4*2+1
eval('PFNGM'-28)
\$\endgroup\$
2
\$\begingroup\$

QBasic, 13 bytes by DLosc

?+INT(LOG(3))  'Fixed thanks to feersome
?1+INT(LOG(3))
?2+INT(LOG(3))
?3+INT(LOG(3))
?4+INT(LOG(3))
?5+INT(LOG(3))
?6+INT(LOG(3))
?7+INT(LOG(3))
?8+INT(LOG(3))
?9+INT(LOG(3))

Try QBasic at archive.org.

Seems like the intended solution is:

? INT(LOG(3))    '1
? INT(LOG(13))   '2
? CINT(LOG(13))   '3

but that can't possibly work because the natural log function grows too quickly. There are no sequences of this form that get past 4.

\$\endgroup\$
  • \$\begingroup\$ I don't think this works. You have to change from 9 to 10 via one edit, whereas changing 9 to 1 and inserting 0 is two edits. Unless I'm misunderstanding...? Please post the exact sequence of changes. \$\endgroup\$ – DLosc Nov 15 '16 at 3:30
  • \$\begingroup\$ @DLosc: I believe the rules allow 1 insertion character and resetting all the mask characters. If not so, all of the edit-only solutions don't work for 10. \$\endgroup\$ – Joshua Nov 15 '16 at 3:34
  • 4
    \$\begingroup\$ The wording of the rules is admittedly not the clearest, but I'm quite sure that each iteration must be a modification from the previous iteration, without "resetting." See all the solutions that do 0+1 -> 8+1 -> 9+1 rather than 1 -> 9 -> 10. In any case, I can tell you that my original code does not reset, but makes one edit at each step. \$\endgroup\$ – DLosc Nov 15 '16 at 3:42
  • \$\begingroup\$ The second attempt inserts 3 characters before the I where there are only two blanks, but would it work if you started with ?+INT(LOG(3)) and then continued with the same 2-10? \$\endgroup\$ – feersum Nov 15 '16 at 23:31
  • \$\begingroup\$ @feersum: That would work if I'm allowed to change the inserted character. \$\endgroup\$ – Joshua Nov 16 '16 at 2:30

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.