# Which character to change (Cops)

Cops, your task is to chose a program that prints a string (you can choose). Although, if you change 1 character in your code, it should print another string.

But there's a twist: You should make your code hard to read, so that the robbers can't find your "changeable" character.

The winner cop is the user, with the shortest answer that wasn't cracked for a week.

Cops, please include the output that should be printed if that specific character is changed in your code.

I will declare the winner cop and robber a week after this challenge is posted.

### Example submission (very easy to understand)

# [Vyxal](https://github.com/Vyxal/Vyxal), 8 bytes, prints a and b

1[a|b


• @Shaggy It should output the string that the cop must have referenced in their post. Editing it. Jul 15, 2021 at 10:32
• But all answers can be trivially brute forced, using the exact same algorithm... how much time did you spend thinking before posting this? Did you post this to the sandbox? Jul 15, 2021 at 11:28
• @thedefault. in a Turing-complete language, this provably cannot be brute-forced in the general case. Just write a program that does some complicated looping and you'll never brute-force it Jul 15, 2021 at 14:11
• This seems like a very boring CnR, any answer will either be trivially brute forceable or take advantage of some weird unicode + halting problem thing that makes it very tedious and not really easily doable by a human anyway. Jul 15, 2021 at 21:51
• @pxeger Actually, if you use dovetailing you can always find the solution in finite time provided that one exists. Just run all the programs concurrently. The correct solution will eventually halt, and when it does you can stop execution. Jul 17, 2021 at 13:42

# Python 3, 51 bytes, cracked by xnor

r=(1,)*8**9
r=r,len,
r=r,str,sum
print(len(str(r)))


Try it online!

The code outputs 402653253. The changed code should instead output 134217728.

I hope my 8**9 will make it difficult for any brute-force methods to work. Good luck!

• Cracked, that was very nice!
– xnor
Jul 21, 2021 at 6:22

# Python 2, 23 bytes (cracked by dingledooper)

print min(0,0)>min(0,0)


Try it online!

Should print True. Please don't brute force, I think it's a nice puzzle to solve.

Bonus puzzle!

Python 2, 23 bytes

print min(0,0)<min(0,0)


Try it online!

Should print True. Unfortunately this has an unintended solution of print~min(0,0)<min(0,0), let's just pretend that doesn't exist.

• Cracked (no brute force) Jul 16, 2021 at 20:38
• @dingledooper You got it!
– xnor
Jul 16, 2021 at 20:39
• I found this for your bonus :) Jul 16, 2021 at 20:48
• @dingledooper Yes, it's so evil I just had to include it!
– xnor
Jul 16, 2021 at 20:51

# R, 54 bytes, cracked by Dominic van Essen

a=b=c=2
for(a in 0:b)pi=pi+exists("c")/4
intToUtf8(pi)


Try it online!

The string to output is "R".

The solution is to replace the first line with a=b=co2: Try it online! The built-in dataset co2 is then assigned to a and b. When calling 0:b, only the first element of co2 is kept (with a warning); it is worth 315.42, which leads after the for loop to pi=82.246. This is rounded down to 82 by intToUtf8.

• Cracked! Jul 15, 2021 at 21:10

# Vyxal, 5 bytes, Cracked by pxeger

lyoal


Try it Online!

Take two.

Should output name 'this_function' is not defined and nothing else.

May not work in future versions of Vyxal as this is a bug that must be destroyed.

My intended solution was lyxal, which rickrolls you but first outputs the intended text, as you can see in this version, which adds a NOP.

I then realised lyoax works as well.

So yeah, interesting puzzle.

• (rot13 to avoid spoilers) Guvf jnfa'g rira fhccbfrq gb or n cebcre punyyratr, vg jnf whfg na rynobengr evpxebyy, jnfa'g vg? Jul 15, 2021 at 10:55
• Cracked! Jul 15, 2021 at 11:00
• Cracked EDIT: Damnit, @pxeger! Jul 15, 2021 at 11:01

# Pip, 6 bytes, Cracked by Daniel H.

-PI-PI


Try it online!

Outputs -6.283185307179586. The cracked version should output 3.141592653589794.

PI is 3.141592653589793
-PI is -3.141592653589793
PZ-PI is -3.14159265358979397985356295141.3- (palindromize)
-PZ-PI is 3.141592653589794 (casts to float, rounds ...939 to ...94)

• Yes, yes pi wow! Jul 15, 2021 at 17:22
• Is this your intended solution? Jul 15, 2021 at 17:35
• @math That's not quite the right output, I'm afraid. ;) Jul 15, 2021 at 17:37
• oh what no the intended output is not pi? even not approximated? nice challenge Jul 15, 2021 at 17:39
• cracked! Jul 15, 2021 at 17:45

# R, 44 bytes, cracked by Dominic van Essen

a=b=2
for(a in 0:b)pi=a+a-pi
el(LETTERS[pi])


Try it online!

The string to output is "R".

This is (deliberately) similar to my previous answer, but the solution uses a different trick.

The solution is to replace 0:b with 0xb in the for loop: Try it online!. The number Oxb is 11 in hexadecimal. The loop is then just a single call for a=11, leading to pi = 11+11-pi = 18.858..., which gets rounded down to 18. The 18th letter is R.

• Cracked!. Thanks, by the way: I'm loving these (although really spending too much time on them...)! Jul 16, 2021 at 11:16
• @DominicvanEssen Well done! They are also fun to come up with. I have one more idea, but haven't managed to wrap it up nicely yet. Jul 16, 2021 at 11:43

# VyxalvKOJdaBoVWT, 17 bytes (safe)

₀hf⋏⋏½\zd+∑⇧¨U²


Try it Online!

Solution should output FFIZZBUZZIFIZZBUZZZFIZZBUZZZFIZZBUZZBFIZZBUZZUFIZZBUZZZFIZZBUZZZFIZZBUZZ.

Intended Solution:

₀hf⋏⋏½\zd+∑⇧/U²

All of the flags are valid flags, but the only one that actually did anything important was the d flag, which does a deep sum of the top of the stack before printing.

The main obfuscated part of the program, ₀hf⋏⋏½\zd+∑⇧, simply makes the string FIZZBUZZ.

When executed online, ¨U does nothing, and then ² splits the string, which is put back together by the flag.

In the solution, / causes the string to be wrapped. As a result, w would have also worked. U uniquifies the list, which does nothing since there's only one element. Now, ² is acting on a list instead of a string, so it multiplies the string by itself, which creates a list that is summed by the flag and printed.

• If it jelps, the flags that actually are / may be used are doV. And o only has effects when there's another output, which is unlikely, and V only does stuff when there's a variable, which also seems unlikely. Jul 24, 2021 at 22:08
• Close... Jul 25, 2021 at 9:40

# Rattle, 5 bytes, Cracked by Shaggy

d\|!p


Try it Online!

This program outputs the string d. With one character changed, it should output the exact string ['d', '']

Cracked version:

d&|!p

Explanation:

In the original code, d\ is the value of a variable and !p is the code. !p is a program which prints the value at the top of the stack after parsing any input and variables. In this code, d\ gets parsed to d (in this case, \ is null).

In the cracked code, the program stays the same but the variable is d&. The & operator in the variable acts as a separator, so the variable gets parsed to a list containing 'd' and '' (the second value is a null string). Then, the program converts this list to a string and outputs it.

• Is that a string that the cracked version ouputs? 'Cause the challenge fors specifically ask for strings. Jul 15, 2021 at 18:39
• @Shaggy yes, ['d', ''] is outputted as a string, although it definitely looks like a list (hint, hint) Jul 15, 2021 at 18:41
• Cracked Jul 15, 2021 at 20:08

# Vyxal, 7 bytes, Cracked by Shaggy

kaka[|←


Try it Online!

Uses a quite obscure hack. Should print z if changed correctly.

Shaggy found exactly my intended solution - kaka(|←.

The 'obscure hack' I mentioned is Vyxal's 'ghost variable'. Vyxal's variables are referenced by →name and ←name, but you can give one no name.

(...) is Vyxal's loop construct, but you can add a variable name with (name|...) and that variable will contain the current iteration. This also works with no name, so (|...) sets the ghost variable to whichever iteration, then ← gets the current iteration number. Vyxal's structures autocomplete, so (|... without a closing paren is fine.

You're iterating over ka, which is the lowercase alphabet, so at the end the stack looks like a , b, c... z. Finally, Vyxal's implicit output takes care of the rest, returning the z.

• Cracked Jul 15, 2021 at 10:33
• Wow really nice idea Jul 15, 2021 at 10:33

# Vyxalo, 13 bytes, cracked by A username

₴ḟ ₴BuzzF


Try it Online!

Solution should print FizzBuzz.

Intended solution:

₴ḟ kBuzzF

I discovered a parsing bug where you could put a string between the two parts of a diagraph, and the diagraph would still work. In this case, the program is being parsed as ₴ḟ BuzzkF. The first two strings, which are Fizz  and Buzz, don't matter at all, and instead, the final diagraph simply pushes FizzBuzz.

• This is probably the most Vyxal answers I have seen in a question... In 1 year Vyxal will be the best CG language. Jul 15, 2021 at 18:04
• Heh, nice one. I'll leave this to someone else to solve because it's too easy based on our discussion but good one :) Jul 15, 2021 at 18:08
• Cracked Jul 15, 2021 at 20:43

# R, 51 bytes, cracked by Dominic van Essen

x=z=6
yy=0
while(x+yy-1>yy){x=x-1;z=z+1}
LETTERS[z]


Try it online!

The string to output is "R". The previous version allowed for a crack I hadn't intended, found by pxeger. I hope this version is immune to that.

The crack is to replace the while condition x+yy-1>yy by x+yy->>yy. This uses global leftwards assignment ->>, replacing the value of yy at each iteration. That way, we go through the loop 12 times in total, leading to the intended value z=18. In real life, no one ever uses global leftwards assignment, nor should they!
This challenge was inspired by a bug I often see in students' code, in which they expect if(x<-1)... to compare x to -1, but instead it assigns 1 to x. The way to avoid this bug is to type if(x < -1)... of course. IMO, this regular bug is the main argument against using <- instead of = for assignment (there are a few other arguments in the other direction).

• Cracked! Jul 17, 2021 at 6:30
• @DominicvanEssen Well done! That's what I intended. I'm out of ideas for now! Jul 17, 2021 at 6:49
• I like the anecdote about the student code bug. I personally find the <- R operator too esoteric, and prefer the more-common-in-programming-languages = operator, but this is the fist time I've heard a (very good) argument favouring it for a proper reason! Jul 17, 2021 at 9:05

# JavaScript (SpiderMonkey), 28 bytes, cracked by m90

a=9
if(a>0)a=0
a>9&&print(a)


Try it online!

Output 9 is expected.

A very easy trick. Maybe can be cracked soon (as it is quite short).

Line Feed is a character.

• – m90
Jul 19, 2021 at 4:06
• @m90 That is the same as intended crack.
– tsh
Jul 19, 2021 at 5:27

# Vyxal, 34 bytes (safe)

u₁7₌I"
∑C$3Ǎ⇧ *C₍⇧⇩+ Ė_"v⇩÷ CĖ›½½∑  Try it Online! Solution should output 29. Solution: u₁7₌I" ∑C$3Ǎ⇧
*C₍⇧⇩+
Ė_"v⇩÷øCĖ›½½∑

Explanation:

Replaces the last newline with ø, which causes the string to be wrapped in », which is the delimiter for compressed numbers. The string is then decompressed by executing it as Vyxal code with the Ė command, then it is incremented, halved twice, and the digits are added together, equaling 29.

• You can reveal this now. Jul 24, 2021 at 22:19

# ><>, 227 bytes, Cracked by m90

 \   ÇÇÇÇÇÇÇÇ
/!\; ÇÇÇÇÇÇÇÇ
\n/!<ÇÇÇÇÇÇÇÇ
!   ÇÇÇÇÇÇÇÇ
>  ^ÇÇÇÇÇÇÇÇ
\\2   \! \/! ~! \
ÇÇÇ\ v! ~      /
ÇÇÇÇÇ\'"a"\ÇÇÇÇÇ
ÇÇÇÇÇÇÇÇ\ /ÇÇÇÇÇ


Try it online!

The output must be 199

I'm not sure if some robbers can crack... Cracked in 6 Days, Same Solution.

• Cracked.
– m90
Nov 10, 2021 at 18:47
• @m90 almost late but not its 6 days Nov 10, 2021 at 18:49

# brainfuck (cell-size 32, no change on EOF), 2,970,327,283 bytes

(...)[->(...)<]>.


It's a start.

This seems like a very boring CnR, any answer will either be trivially brute forceable or take advantage of some weird unicode + halting problem thing that makes it very tedious and not really easily doable by a human anyway. -Dotcomma Programs

Happy new year! The first (...) contains 2950107175 +s, and the second (...) contains 20220101 +s. It prints ☃ right now - make it print ❄.

This is the only brainfuck answer I could write.

# Jelly, 11 bytes, cracked by Aaron Miller

“Y$Ḥß»“¿<ȧ»  Try it online! The output should be hyper-neutrino cause I'm lazy “Y$Ḥß““¿<ȧ» is a list of compressed strings [“Y$Ḥß», “», “¿<ȧ»]. • “Y$Ḥß» decompresses to hyper- (and is a suboptimal compression, specifically to confuse hyper and get him overthinking about the compression engine :P)
• “» decompresses the the empty string, which doesn't then affect the output
• “¿<ȧ» decompresses to neutrino

Then, Jelly smash-prints the string ["hyper-", "", "neutrino"] into hyper-neutrino

• cracked Jul 15, 2021 at 21:48
• @AaronMiller Very nice, that was my intended solution! Jul 15, 2021 at 21:49

# Vyxal, 20 bytes, cracked by Aaron Miller

Ẇ₁¹kḢ:∧λf⇧\#¯ḣ⌐ƒż1


Try it Online!

Alright. My turn.

You need to make this epic lambda output who is joe joe mama.

If you thought that the lambda actually did anything, then you were wrong. The first string in the program is to act as a distraction, as the answer is that everything after the : is the compressed version of the output string.

• who's joe? biden? Jul 15, 2021 at 11:10
• The original doesn't seem to output anything? Jul 15, 2021 at 11:11
• @shaggy that would be due to an interpreter bug. But consider the original to output an empty string Jul 15, 2021 at 11:13
• clearingkelimination? Uh... Jul 15, 2021 at 11:26
• Cracked Jul 15, 2021 at 13:47

# Python 2, 72 bytes, cracked by the default.

print pow(2,2**1337133713371337,195889276175237072760362930940173700767)


Expected output:

188867410716634269084427012487211003700

• Cracked Jul 16, 2021 at 3:57

# Japt, 24 bytes

Hoping this one might be slightly more challenging than my first attempt but I somehow doubt it. The original outputs 1, the cracked version should output 11 (both as strings).

@TwXµY *!ZøX ªX+YÑ}gB Ìs


Try it online!

• "slightly more challenging" is quite an understatement :P
– user
Jul 17, 2021 at 18:27
• @user, maybe C&R is a way to increase awareness and usage of Japt 'cause this one is actually pretty easy when you know how. Jul 17, 2021 at 19:38
• Cracked. This was a really nice brain teaser, I liked it a lot. Working from back to front helped quite a bit here. Jul 18, 2021 at 18:57

# R, 45 bytes, cracked by pajonk

a=b=c=2
for(a in 1:b)c=c*pi
el(LETTERS[-c:0])


Try it online!

The string to output is "R".

This is an homage to Robin Ryder's series of challenges, although I think his ones were cleverer...

• Cracked Jul 17, 2021 at 17:34
• Well done. Indeed Robin's ones took longer to be cracked... Jul 17, 2021 at 19:42

# Japt, 5 bytes, cracked by user

My turn! Coming up with C&R entries in Japt is always tricky because ... of reasons that would help you solve this! :p (and 'cause I suck at it!) Also, the longer a programme is, the more chance there is for an unintended crack or 2 but, the shorter it is, the easier it is to crack. So this will probably be easily cracked.

Original outputs 0 (as a string), cracked version should output s.

¤ùÅÔÌ


Try it online!

• Cracked!
– user
Jul 17, 2021 at 13:45
• Not my intended crack but nicely done, nonetheless :) I realised this was a possibility after posting and meant to change the intended output to prevent it but I must've forgotten. I'll give you the "W", of course, but you're welcome to try for the intended crack too. Jul 17, 2021 at 19:37
• Interesting, I'll try to find the intended crack too.
– user
Jul 17, 2021 at 19:38
• @user, if you don't get it by the time I get back to my computer on Monday, I'll repost it with the alternative expected output. Jul 17, 2021 at 19:40
• @user, it was indeed - very nicely (and quickly) done. The alternative output was p but the principle was identical. Jul 17, 2021 at 19:45

# R, 59 bytes, cracked by Dominic

a=as.numeric
bb=strrep(11,1)
"if"(a(bb),LETTERS[a(bb)],"R")


Try it online!

The string to output is "R".

Definitely no match for @Robin's challenges here, but when already this thread is full of R submissions, why not another one?

Intended crack: Try it online!

• Cracked! Jul 17, 2021 at 19:38
• And cracked again... Jul 17, 2021 at 19:44
• @Dominic, well done. However, none was intended (and second one was easily preventable and wasn't present in last development version). There is another one hidden here. Jul 17, 2021 at 20:31
• Hm... cracked again, again... is that the hidden one? Jul 17, 2021 at 21:19
• Ups, that is so embarrassing, that it has so many unintended cracks :-\ Jul 18, 2021 at 4:54

# Python 3, 226 bytes - cracked by Zachary Cotton

import operator as o
import inspect as i
a,d = 37,lambda n:n if len(str(n))==1else d(sum(map(int,str(n))))
for k, v in{d(sum(map(ord, n))): f for n, f in i.getmembers(o,i.isbuiltin)[::11]}.items():
a = int(v(a,k**2))
print(a)


Try it online!

It currently prints 520, but it should print 5521. I hope you will enjoy this. I think once you find out the parts of the puzzle, you should be able to see what to change.

# APL (Dyalog Unicode), 19 bytes; cracked by Bubbler

{(⍵ ⍵)(⍵ ⍵)(⍵ ⍵)},8


Prints  8 8 8 8 8 8 : Try it online!

Change one character and make it print 1 instead!

• Cracked Jul 21, 2021 at 10:14

# APL (Dyalog Extended), 8 bytes; cracked by Bubbler

≢∊⎕A⍨¨⎕A


Prints 676: Try it online!

Change one character and make it print 286 instead!

• Cracked Jul 21, 2021 at 10:14

# Yggdrasil, 3 bytes, cracked by A username

;.:


Try it online!

Solution should print ..:.

• Cracked Jul 24, 2021 at 22:02

# VyxalO, 28 bytes (safe)

⁺⟇C‛bf½+ṅĖp⇩D∇⇧$⇧∇∇⇧WṄ3ẇḢht₴  Try it Online! Solution: ⁺⟇C‛bf½+ṅĖpøD∇⇧$⇧∇∇⇧WṄ3ẇḢht₴

Explanation:

Changes the lowercasing and triplicating to dictionary compression. The dictionary compressed string is ₴ḟ₴ḣ, which contains the target string. From there, the rest of the program just does a bunch of random junk to it and winds up with ₴ which is the target string. The ₴ at the end of the program is just a red herring. :)

• You can reveal this now. Jul 24, 2021 at 22:20

# brainfuck, 29 bytes, Cracked by ovs

.+[.[->+>+<<]+[>--<+++++]>+<]


Try it online!

Should output

�:sIX=1
×}ð :kAH%  ÊoÕàQÍº#y8M!
§My¥ºûQèÕYÊ¿%A]:3 Ø}ñ
=pIU:+ÈeÉÊ/ºã9¸á
-Pº[±¨õ9Ê@á½:iÑ
g
¹eº»hÊå


SE swallowed some unprintables, so here's a hexdump:

00000000: 0001 c29d 3a73 4958 3d31 0ac3 977d c3b0  ....:sIX=1...}..
00000010: 09c2 953a 6b41 4825 09c3 8a6f c395 c3a0  ...:kAH%...o....
00000020: 51c3 8dc2 ba23 7938 4d21 0ac3 876d c390  Q....#y8M!...m..
00000030: c399 45c2 bac2 9bc3 b128 c2b5 79c3 8ac3  ..E......(..y...
00000040: 9f45 c380 c2a1 c3bd 3ac3 93c2 a918 5d11  .E......:.....].
00000050: 0ac2 b75d c2b0 c2a9 c3b5 3ac3 8bc2 a108  ...]......:.....
00000060: 45c3 a9c3 8a4f c2b5 20c3 b12d c2ba c283  E....O.. ..-....
00000070: c399 c3b8 6d01 0ac2 a74d c290 79c2 a5c2  ....m....M..y...
00000080: bac3 bb51 c3a8 c395 59c3 8ac2 bf25 c280  ...Q....Y....%..
00000090: 415d 3a33 09c3 987d c3b1 0ac2 973d 7049  A]:3...}.....=pI
000000a0: 553a 2b01 c388 65c3 89c3 8a2f c295 60c2  U:+...e..../...
000000b0: 91c2 8dc2 bac3 a339 c2b8 c28d c3a1 0ac2  .......9........
000000c0: 872d 5019 05c2 ba5b c2b1 c2a8 c3b5 39c3  .-P....[......9.
000000d0: 8ac2 9f05 40c3 a1c2 bd3a c293 69c2 98c2  ....@....:..i...
000000e0: 9dc3 910a 771d 30c3 a9c2 b53a c28b 61c2  ....w.0....:..a.
000000f0: 88c2 85c2 a9c3 8a0f 7520 31c3 adc2 ba43  ........u 1....C
00000100: c299 78c2 adc3 810a 670a 10c2 b965 c2ba  ..x.....g....e..
00000110: c2bb 1168 1519 c38a 7fc3 a5              ...h.......


And no, I don't know how I got this result.

• Are you sure your hexdump is correct? This seems to produce the same output, but is missing a few bytes
– ovs
Aug 15, 2021 at 10:20
• @ovs Yes, that is correct. I copied-and-pasted the output, so some bytes must've got lost in the process. Aug 15, 2021 at 10:32
• posted it
– ovs
Aug 15, 2021 at 10:57

# Pip, 5 bytes, cracked by Daniel H.

****t


Outputs 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216. (DON'T Try it online! This code requires the current version of Pip. You can run it here.)

The cracked version should output 42.

The intended solution was

**E*t

which is basically the same as Daniel's crack.

In hindsight,

using an operator that's synonymous with **

may not have been the best idea, but the 42 output was too good to pass up.

• cracked! Jul 15, 2021 at 19:43
• ^was that your intended solution? Jul 15, 2021 at 19:51
• Pretty close, yeah--see update. Jul 15, 2021 at 21:29

# Vyxal, 24 bytes, Cracked by Aaron Miller.

kH:stringD‟‟Ẋf∑vd∑qĖ₁Ẏ


Try it Online!

Output should be

HH\\HHmorningHHoccupationalHH\\ee\\eemorningeeoccupationalee\\ll\\llmorninglloccupationall
`

A mess.

• Cracked Jul 15, 2021 at 21:32