Robbers
Robbers, your job is to find the slices of the corresponding cop's code.
Scoring
The robber with the most cracks wins.
Example
Take this code:
iimmppoorrtt ssyymmppyy;;pprriinntt((ssyymmppyy..iisspprriimmee((iinnppuutt(())))))
The slice here is [::2], so the robber's post could look like this:
Cracked <somebody>'s answer
```iimmppoorrtt ssyymmppyy;;pprriinntt((ssyymmppyy..iisspprriimmee((iinnppuutt(())))))```
The slice is [::2].
12 Answers 12
Python 3, cracks Sisyphus's answer
input((input()[(-1)::1-1-1]))
Given by the slice c[-2158:-4855:-93]
I was initially surprised to find that there were no characters besides those used for input()[::-1]. The input() is a dead giveaway though and a brute force search reduced the input to a handful of possibilities. I then just looked at them individually until I found the correct code.
Python 3, 181 bytes
if True: print =eval (' exit')# not open u
exit or ( eval)('14')
# NO
open or 15* id( int( int(int (int( id( print( print([111][:123][:55555-11111111111]))))))))#11;
The slice is simply program[::6], giving us:
irp=(input())
print(irp[::-1]);
-
\$\begingroup\$ Yep, intended solution. \$\endgroup\$emanresu A– emanresu A2022年02月10日 05:32:57 +00:00Commented Feb 10, 2022 at 5:32
Python 3, cracks AnttiP's answer
[53:586:4] results in:
def g(o):exec("".join(map(chr,map(sum,zip(map(ord,"ikbgm!bginm!\"T33&*V\""),99*[o])))))
x=0
class f:
def __del__(self):g(x)
y,x=f(),7
g increases each codepoint in "ikbgm!bginm!\"T33&*V\"" by its argument and then executes the resulting string as code. For o=7 this executes print(input()[::-1]).
When the program is done running the garbage collector deletes y, calling g(x) in the process.
-
\$\begingroup\$ Wait, that was the solution? I had found it many times, but I glossed over it every time! \$\endgroup\$ophact– ophact2022年02月14日 17:02:42 +00:00Commented Feb 14, 2022 at 17:02
Vyxal, 3 bytes, cracks Aaroneous Miller's answer
wRh
Obtained from a slice of [13::-5]. Ngl you should have used that one quirk that only you know about because I know quite a few vyxal quirks too.
-
\$\begingroup\$ You only need to get the last char \$\endgroup\$Fmbalbuena– Fmbalbuena2022年02月09日 22:25:17 +00:00Commented Feb 9, 2022 at 22:25
-
\$\begingroup\$ @Fmbalbuena But then the code won't reverse the input string... \$\endgroup\$Aiden Chow– Aiden Chow2022年02月10日 04:27:47 +00:00Commented Feb 10, 2022 at 4:27
brainfuck, Actually cracks l4m2
,[>><,]<[.<]
The slice is c[1::3]. And yes, I literally just bruteforce copy-pasted different slices to TIO, until I found a solution.
-
\$\begingroup\$ Do you brute-force manually? \$\endgroup\$l4m2– l4m22022年02月10日 09:26:58 +00:00Commented Feb 10, 2022 at 9:26
-
\$\begingroup\$ @l4m2 here I thought that since the code is so short, I might as well do it manually, since there were only like 4 slices I had to check, so it was faster than to write a brainfuck interpreter and bruteforce automatically. But for example for Sisyphus's answer I wrote code. \$\endgroup\$AnttiP– AnttiP2022年02月10日 09:37:38 +00:00Commented Feb 10, 2022 at 9:37
Python 3, 72 bytes, cracks ths's answer
i=input();a=len(i);exec("for n in(i*8**9) [1:]:i=(i*a) [::~a]");print(i)
Slice used: code[4981:-201:67]
If you want to see the code finish (削除) within your lifetime (削除ここまで) a bit faster, change the 8**9 to 2 or any other positive even number.
-
\$\begingroup\$ input a 5 letters string, the revert could be done in a few minutes on my laptop as I tested yesterday. So This should finish within your lifetime without changing anything. \$\endgroup\$tsh– tsh2022年02月11日 00:04:17 +00:00Commented Feb 11, 2022 at 0:04
Python 3.8 (pre-release), 45 bytes, Cracks Big Midol's second answer (new revision)
print(str(str(input()[::-1][::-1][::-1][:])))
Slice is code[145::2]
-
\$\begingroup\$ Not intended, and there is a simpler slice. \$\endgroup\$Alan Bagel– Alan Bagel2022年02月14日 11:53:03 +00:00Commented Feb 14, 2022 at 11:53
Python 3, 43 bytes, cracks Bgil Midol's second answer (original version)
print(str(str(input()[::-1][::-1][::-1])))
Slice is s[40:-10:2]
Fastest crack in the west?
Python, cracks Bgil Midol's third cop
[1011::3]
The result of this slice is:
exec("print.__call__(input()[::-1])")
-
\$\begingroup\$ Nice work. There is a simpler version, though. \$\endgroup\$Alan Bagel– Alan Bagel2022年02月14日 17:31:23 +00:00Commented Feb 14, 2022 at 17:31
-
\$\begingroup\$ @BgilMidol It includes a typo, right? \$\endgroup\$ophact– ophact2022年02月14日 17:32:41 +00:00Commented Feb 14, 2022 at 17:32
-
\$\begingroup\$ I hope not...................... \$\endgroup\$Alan Bagel– Alan Bagel2022年02月14日 17:33:28 +00:00Commented Feb 14, 2022 at 17:33
The unsliced program must be valid code, andyour example isn't \$\endgroup\$#iimmppoorrtt ssyymmppyy;;pprriinntt((ssyymmppyy..iisspprriimmee((iinnppuutt(())))))Slice:[1::2]\$\endgroup\$