11
\$\begingroup\$

Robbers' Challenge

Read the cops' challenge first.

In this challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it produce the correct (case-sensitive) output (except that there may also be an extra trailing newline at the end).

The number of characters you add in must be less than or equal to the number of characters removed from the original code, and your answer is still valid even if it was not intended.

The characters can be added anywhere in the code, but they must all be consecutive in the same place (i.e. not random characters dotted around the code).

Make sure to link the cop's post that you have cracked in your answer, and once you have posted your answer here, comment under the cop's post linking your answer if you have enough reputation.

Example

Say a cop posted the following submission:

Python, score of 14

Code: print(5*"a")
Number of characters removed: 1
Target output: 5 a (currently outputs aaaaa)

This is the answer a robber would post to crack it:

Cracks ...'s Python answer (link)

Character to add: , before the *
Resulting code: print(5,*"a")
Resulting output: 5 a

Scoring

The following scoring criterion will be used in order (if #1 is a tie, then #2 is used to tiebreak, etc.):

  1. The robber who has cracked the most cops' answers (that were uncracked at the time of posting) after 1 week wins!
  2. Out of the tied robbers, the one whose most-upvoted answer has the most upvotes wins
  3. Out of the tied robbers, the one whose most-upvoted answer was posted first wins

Good luck!

asked Mar 29, 2022 at 13:06
\$\endgroup\$

19 Answers 19

25
+500
\$\begingroup\$

Python 3, cracks Sisyphus' answer

print(divmod(99,15))

Try it online!

Inserts divmod where the iv is U+2173 (Small Roman Numeral Four), a one-character multibyte ligature that normalizes to iv, letting us squeeze the built-in into 5 characters. I learned of this ligature trick for Python 3 in doing this crack.

answered Mar 30, 2022 at 6:16
\$\endgroup\$
2
  • 4
    \$\begingroup\$ holy cow that works??? there really is no limit to the stupid golfing you can do in python \$\endgroup\$ Commented Mar 30, 2022 at 7:01
  • 8
    \$\begingroup\$ @des54321 iv is 3 bytes while iv is 2. It will not help you golfing when answers are scored by bytes (which is default on this site) instead of characters. \$\endgroup\$ Commented Mar 30, 2022 at 8:21
9
\$\begingroup\$

JavaScript (Node.js), cracks l4m2's answer

console.log((99n**77n).toString(34))

Try it online!

Cracking script

let s = "39iw027a2hnuqi2c1os255jmjsidafs3nx6496n8vl8dak0qc3r15xwheq4vxpb136up7rsmbm8v5slowjwf7mvj0s751b03gxif5";
// there's no 'y' and no 'z', so this could be an integer in base 36, 35 or 34
[36, 35, 34].forEach(base => {
 let n = [...s].reduce((p, c) => p * BigInt(base) + BigInt(parseInt(c, base)), 0n);
 console.log(`Base ${base} -> ${n}`);
 // look for divisors of reasonable size
 for(let d = 2n; d < 1000n; d++) {
 let k = 0, N = n;
 while(!(N % d)) { N /= d; k++; }
 k && console.log(`${d}**${k}\t${N == 1n ? "success!" : "failed"}`);
 }
 console.log();
});

Try it online!

answered Mar 29, 2022 at 21:40
\$\endgroup\$
7
\$\begingroup\$

R, cracks pajonk's answer

el(names(swiss),6)

Try it online!

Characters to add = names(swiss),

answered Mar 29, 2022 at 20:05
\$\endgroup\$
6
\$\begingroup\$

Java, cracks David Conrad's answer

Character. is added before the getName(x) within the toString() method.

Try it online.

This took longer than expected..

Explanation:

The Character#getName(int) method returns the Unicode name for the given character codepoint.

The characters names of the given codepoints 130, 14, 8613, 8784, 150, 151 are in order:

BREAK PERMITTED HERE
SHIFT OUT
UPWARDS ARROW FROM BAR
APPROACHES THE LIMIT
START OF GUARDED AREA
END OF GUARDED AREA

Which then gets split by spaces and the correct word is extracted based on the modulo operators used.

answered Mar 30, 2022 at 7:39
\$\endgroup\$
5
\$\begingroup\$

R, cracks Robin Ryder's answer

print("R",,F)

Try it online!

The original answer indicated that 8 characters had been removed; this crack uses only 3 characters: ,,F, so presumably it isn't the intended solution...

answered Mar 30, 2022 at 13:28
\$\endgroup\$
4
\$\begingroup\$

Cracks emanresu A's Vyxal "kay" submission

kaøBy

Try it online!

All we need to do is wrap the alphabetic characters we get from ka in square brackets before we uninterleave with y, and that's a two-byte built-in, øB.


The "bonus" output is achieved with a reversal (Ǔ) instead: kaǓy Try it.

answered Mar 30, 2022 at 16:52
\$\endgroup\$
1
  • \$\begingroup\$ Nice! Exactly what I had. \$\endgroup\$ Commented Mar 31, 2022 at 3:19
4
\$\begingroup\$

PHP, cracks Michel's answer

<?php for($i=7;$i-->2;)print$i<<print$i;

Try it online!

The main observation is that the expected output (612510483624) can be split in such a way that an obvious pattern emerges: 6 12 5 10 4 8 3 6 2 4. It follows a consistent pattern of $i*2 $i ....

The tricky bit is figuring out how to print it, but it turns out to be as simple as inserting a print before the second $i. The rightmost print is evaluated first, printing $i, and then $i<<1 is printed, since the other print returns a 1.

answered Apr 3, 2022 at 10:36
\$\endgroup\$
4
\$\begingroup\$

Python, cracks pxeger's answer

"print("")"
print(__doc__)
""

Attempt This Online!

TIL you can store a string inside __doc__ by adding it on the first line.

answered Apr 4, 2022 at 20:36
\$\endgroup\$
3
\$\begingroup\$

Python 3, Cracks des54321's answer

print(str(quit)[14:18])

OR

print(str(exit)[14:18])

I brute-forced this by running:

import gc
for x in gc.get_objects():
 if str(x)[14:18] == "Ctrl":
 print(x)
answered Mar 30, 2022 at 21:31
\$\endgroup\$
1
  • \$\begingroup\$ good one! I didnt even realize there were two solutions to this \$\endgroup\$ Commented Mar 30, 2022 at 22:44
3
\$\begingroup\$

Python 3, cracks thegreatemu's answer

import random as r
r.seed(258117)
print(r.random())

Try it online!

I just brute-forced six-digit seeds, which took 8 seconds to run on TIO.

answered Mar 30, 2022 at 22:17
\$\endgroup\$
2
  • \$\begingroup\$ I should have added some spaces =P \$\endgroup\$ Commented Mar 30, 2022 at 23:45
  • \$\begingroup\$ While the Cop answer for this has been deleted for violating this loophole, I will be leaving this answer up as it is still a valid answer. \$\endgroup\$ Commented May 30, 2022 at 12:24
3
\$\begingroup\$

MATL, cracks Luis Mendo's answer

'Hey My'YbtvZc

Try it online!

Adds the string YbtvZc to the end.

answered Apr 1, 2022 at 10:09
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Ohhh Yb returns a \1ドル\times 2\$ cell! I had 3etv1e which is incredibly close but not quite right. From the way it displays, 'Hey My'Yb really looks like it's a \2ドル\times 1\$ cell so I abandoned trying it. \$\endgroup\$ Commented Apr 1, 2022 at 11:11
  • \$\begingroup\$ I was also looking into using e based purely on the fact that Luis posted the cops answer :) \$\endgroup\$ Commented Apr 1, 2022 at 11:16
2
\$\begingroup\$

Cracks des54321's Python answer

Adding ^63 after chr(i results in:

print("".join(chr(i^63)for i in b'wZSSP\x1fhPMS[\x1e'))

...which outputs Hello World!

Try it online!

answered Mar 29, 2022 at 17:09
\$\endgroup\$
5
  • \$\begingroup\$ damn that was fast, I knew this was fairly simple but I thought it would take a bit longer, well deserved +1 \$\endgroup\$ Commented Mar 29, 2022 at 17:12
  • 1
    \$\begingroup\$ @des54321 Well, I spent a lot of time today and yesterday coming up with a Python Cop challenge, but you beat me to it, so I though I'd put lots of effort into solving yours ;-). What made it easier what the fact that I'd thought of doing something almost identical, so I still had the ^ chr() for i in mindset. \$\endgroup\$ Commented Mar 29, 2022 at 17:14
  • 1
    \$\begingroup\$ great minds think alike I guess :P the fact I was only removing 3 characters also definitely limits the range of what could have gone in there. I did toy around with something more like this so that each character was transformed differently, but if I removed the two byte-strings there would be too many ways to crack it, and I couldn't think of anything short that wouldn't make it easily crackable \$\endgroup\$ Commented Mar 29, 2022 at 17:19
  • 1
    \$\begingroup\$ @des54321 Yeah, I saw this challenge in the Sandbox, and started writing a potential Cop answer in Python, thinking it would be easy to do. However, I still hadn't settled on something I liked even after two days. It was fun to crack, though! After I discovered that multiplying i by something didn't work, I actually brute-forced it by running a loop exactly like this. \$\endgroup\$ Commented Mar 29, 2022 at 17:24
  • 1
    \$\begingroup\$ My fault for making it too easy to bruteforce I guess :P I did consider throwing some more bitwise operators in there, but I confess I never even thought of multiplying i. I guess cause anything I tried that sent the encrypted string out of ASCII space wouldn't work, cause bytestrings can only be ascii (Although I suppose I couldve used the bytes() constructor and specified non-ascii encoding 🤔) \$\endgroup\$ Commented Mar 29, 2022 at 17:30
2
\$\begingroup\$

Crack for bigyihsuan's Lexurgy SC answer

a:
*=>w
b:
w=>zwq

Obviously not the intended solution, but seems to work fine.

answered Mar 29, 2022 at 17:25
\$\endgroup\$
2
  • 1
    \$\begingroup\$ And this is why removing lots of characters from your cop answer isn't good :P it opens the gates for someone to do something cheeky like this \$\endgroup\$ Commented Mar 29, 2022 at 17:26
  • 1
    \$\begingroup\$ Not the intended solution, but a crack nonetheless, hehe. gj \$\endgroup\$ Commented Mar 29, 2022 at 19:20
2
\$\begingroup\$

Python 3, cracks EphraimRuttenberg's answer:

print(str(...)[1:3]*50)

Try it online!

Added code: ... inside the str().

answered Mar 30, 2022 at 1:42
\$\endgroup\$
2
\$\begingroup\$

R, cracks Robin Ryder's second answer

`?`=noquote#print
?"R"

Try it online!

The 8 characters to add are noquote#. This exchanges the asssignment of ? to the print function into an assignment to the noquote function, and comments-out the now-useless print.

answered Mar 31, 2022 at 18:53
\$\endgroup\$
2
\$\begingroup\$

R, cracks Robin Ryder's third answer

{assign("?",print.noquote)}
?"R"

Try it online!

The 8 characters to add are .noquote, changing the print function into the rather-obscure print.noquote function.
This series of challenges was an uphill battle for poor Robin Ryder; I think neither of us was fully aware of the variety of noquote-like options and functions that lurk in base-R, and Robin patiently added more-and-more convoluted re-assignments and curly-braces to counteract each new noquote variant as it popped up in unintended cracks...

answered Apr 1, 2022 at 11:58
\$\endgroup\$
2
\$\begingroup\$

Behavior, cracks Lince Assassino's answer

@(type:type)-0-3

Try it online! (you will have to input the program yourself)

Adds -3 to the end. Removing the -0 originally gives a result of cfunc, so I assumed -0 meant "remove the character at index 0." Using the same logic, we add -3 to remove the character at index 3 in func to get fun.

answered Apr 1, 2022 at 16:02
\$\endgroup\$
1
\$\begingroup\$

Python, 124 bytes, cracks jezza_99's answer

import sys
S=sys.stdout
sys.stdout=type('',(),{'write':lambda x,y:'','flush':lambda z:1})()
import this
S.write(this.s[:98])

All of the re-added characters are at the end of the program.

Attempt This Online!

answered Mar 30, 2022 at 2:41
\$\endgroup\$
1
\$\begingroup\$

PHP, cracks Michel's answer

<?php echo hexdec(M_E),'';

Try it online!

My first thought was, "maybe the number is large enough that printing it as a hex literal is shorter somehow...". When converting it to hex, I immediately notice that the hex digits are the first few digits of \$ e \$ (0x2718281828459). The rest is trivial.

answered Apr 3, 2022 at 10:02
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.