8
\$\begingroup\$

This is a challenge, the cops' thread is here

You can change the word code into golf by changing a letter at a time in four steps:

CODE
COLE
COLD
GOLD
GOLF

Today, we’ll be doing the same thing with programs.

Your challenge is to crack an answer on the cops' thread. Cops will create a series of programs in which the first prints code, the last prints golf and the rest print distinct English words such that each program can be derived from the previous by changing a single character of its code.

For example, if the program abcde outputs code in a certain language, and the program abcdf outputs potato, then changing that e to an f is a valid step.

And if the program aqcdf outputs golf, then abcde -> abcdf -> aqcdf is a valid chain in which you change a character twice.

The cops will only share the code program and the number of changes, your challenge is to figure out the rest. Once you discover their whole program chain, their answer is cracked.

Cops may output in any casing - coDe, Code, CODe etc.

The dictionary used is /dict/words, which I've put in a gist for convenience.

Scoring

The user with the most cracks wins the cops challenge.

\$\endgroup\$

8 Answers 8

3
\$\begingroup\$

Vyxal, cracks emanresu A’s answer

«ƛ↔ƒ
`ƛ↔ƒ
`ƛ₅ƒ
`»₅ƒ

Try it Online!

Note: The final two characters in each line in the linked program is just so that each one can be ran alongside one another; they aren’t required for the individual programs.

The first change is changing the first character, which changes the compressed string into a dictionary compressed string. From this point on, because of the way that dictionary compression works in Vyxal, the final character in the string is ignored.

The next two changes are simply changing to the dictionary entry for golf. What’s convenient about using the dictionary is that most of it is made up of English words, so I didn’t have to worry much about how I changed those two characters, as long as I changed them to the correct characters.

I’m guessing the intended solution was probably more clever than just switching to dictionary compression, but I saw that the option was available and decided to take advantage of it.

\$\endgroup\$
1
  • \$\begingroup\$ Nice! I forgot the short dictionary has empty entries. \$\endgroup\$
    – emanresu A
    Jan 21, 2022 at 6:01
3
\$\begingroup\$

Python 2, cracks Fmbalbuena's cop in two steps, not including start and end

[Start for reference]

golf="code"
goof="cold"
print golf

Step 1

golf="code"
golf="cold"
print golf

Step 2

golf="code"
golf="gold"
print golf

[End]

golf="code"
golf="golf"
print golf
\$\endgroup\$
2
\$\begingroup\$

Pari/GP, cracks alephalpha's answer

Well someone has to do it...

One step:remove the comma.

go="co";lf="de";print(go,lf)

go="co";lf="de";print(go lf)

Try it online!

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

Pari/GP, 2 steps, cracks alephalpha's second answer

first spacify the first comma to output gode

g=c;f=e;l=d;print(g o,l,f) 

then the last for golf

g=c;f=e;l=d;print(g o,l f)

Try it online!

\$\endgroup\$
6
  • \$\begingroup\$ I really didn't expect this result \$\endgroup\$
    – M Virts
    Jan 21, 2022 at 4:06
  • \$\begingroup\$ Wow! I didn't see this obvious answer! \$\endgroup\$
    – alephalpha
    Jan 21, 2022 at 4:10
  • 2
    \$\begingroup\$ Is gode an English word? I'm not finding it in online dictionaries... \$\endgroup\$
    – Jonah
    Jan 21, 2022 at 4:12
  • \$\begingroup\$ @Jonah Not an answer to your question but it is a word in French... (NSFW) \$\endgroup\$
    – Dingus
    Jan 21, 2022 at 4:52
  • \$\begingroup\$ @emanresuA It's included in the gist linked in the cops' thread. \$\endgroup\$
    – Dingus
    Jan 21, 2022 at 6:47
2
\$\begingroup\$

!@#$%^&*()_+, 3 steps, cracks @Fmbalbuena's answer

Using the list provided in the question:

  • 3130<202(^+@): code
  • 3138<202(^+@): cole
  • 2138<202(^+@): cold
  • 2138<242(^+@): gold
  • 2338<242(^+@): golf
\$\endgroup\$
5
  • 1
    \$\begingroup\$ this is 4 steps, why 3? \$\endgroup\$
    – Fmbalbuena
    Jan 23, 2022 at 14:13
  • \$\begingroup\$ Possibly I'm misinterpreting the rules! 😅 I read "Your score is the number of programs not counting the code or golf ones" and assumed it only counts the ones that aren't code or golf! Happy to amend if I've got it wrong! \$\endgroup\$ Jan 23, 2022 at 14:31
  • \$\begingroup\$ I changed the number of steps \$\endgroup\$
    – Fmbalbuena
    Jan 23, 2022 at 14:34
  • 1
    \$\begingroup\$ +1 good crack, This is good. \$\endgroup\$
    – Fmbalbuena
    Jan 23, 2022 at 14:35
  • \$\begingroup\$ Thanks! Apologies for throwing you off with the steps! Was that what you had in mind? \$\endgroup\$ Jan 23, 2022 at 15:06
2
\$\begingroup\$

JavaScript (Node.js), cracks @Arnauld's answer

Didn't include ~ in my search originally which meant I got it in 7 programs...

_=>(0x63044+185882).toString(36), // coda
_=>(0xd3044+185882).toString(36), // mice
_=>(0xd3044+~85882).toString(36), // gond
_=>(0xd3004+~85882).toString(36), // golf

Try it online!

Used this program combined with greping the dictionary to refine the results and then guesswork on which paths felt more likely to head towards golf!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Nice! code > coda > mice > mick > mias > golf also works. \$\endgroup\$
    – Arnauld
    Jan 21, 2022 at 20:28
  • \$\begingroup\$ @Arnauld Ah, many solutions! Still needed that pesky ~ though! Thanks, this was fun! \$\endgroup\$ Jan 21, 2022 at 20:36
1
\$\begingroup\$

Charcoal, Cracks @Neil's answer

\$\endgroup\$
3
  • \$\begingroup\$ As I mentioned, I was able to use less uncommon words on the code side: coed, cava, cast and call. \$\endgroup\$
    – Neil
    Jan 24, 2022 at 0:23
  • \$\begingroup\$ Although now I see that you were actually able to save a step, so never mind. \$\endgroup\$
    – Neil
    Jan 24, 2022 at 0:24
  • \$\begingroup\$ Thanks! Yeah I did play around with a bunch of paths, but the # was the matching one for me! I got super obsessed with words that changed massively, like getting beryl but doing two searches simultaneously and looking for common chars was the most interesting to me. I've really enjoyed these! \$\endgroup\$ Jan 24, 2022 at 7:35
1
\$\begingroup\$

Python 3, cracks Fmbalbuena's answer

golf="code"
try:exec("print( golf )")
except:print("a")
golf="code"
try:exec("print( golf')")
except:print("a")
golf="code"
try:exec("print('golf')")
except:print("a")

Adding the first ' causes the exec to error, which goes to the except and prints a. After that, you can add the second ', which changes the contents of the exec to print('golf'), which outputs the target.

\$\endgroup\$

Your Answer

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

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