27
2
This is a cops-and-robbers challenge. For the robbers thread, go here.
This challenge involves two OEIS sequences chosen by the cops -- S1, S2 -- and how well those sequences can be golfed and obfuscated.
The Cops' Challenge
Your challenge as a cop is to pick a freely available language, and two OEIS sequences. Then, write code A in that language that takes input n and produces S1(n). When that code is modified by a Levenshtein distance of X characters (with X no more than 0.5 * (length A)
), and turned into code B in the same language, it must then produce S2(n). You must actually write this code B, but don't reveal it until your challenge is safe (see below).
The cops' submissions must include the language name, the full code A, the byte-count of A, the X value of how many changes to get to their secret B code, and the chosen S1 and S2 sequence numbers. You can choose whether each sequence is 0-indexed or 1-indexed, but please specify that in your submission.
To crack a particular submission, robbers must come up with a program C in the same language (and version) that produces S2(n) and is Y character changes away from A (with Y <= X
). Robbers do not necessarily need to find the exact same B code that the cop (secretly) produced.
Winning and Scoring
If your cop answer has not been cracked within 7 days (168 hours), you may reveal your own B solution, at which point your answer is considered safe. As long as you don't reveal your solution, it may still be cracked by robbers, even if the 7 days have already passed. If your answer does get cracked, please indicate this in the header of your answer, along with a link to the corresponding robber's answer.
Cops win by having the uncracked submission with the shortest A. If tied, then the smallest X will be used as tie-breaker. If still tied, the earlier submission will win.
Further Rules
- You must not use any built-ins for hashing, encryption, or random number generation (even if you seed the random number generator to a fixed value).
- Either programs or functions are allowed, but the code must not be a snippet and you must not assume a REPL environment.
- You may take input and give output in any convenient format. The input/output methods must be the same for both sequences.
- The definitive calculator for the Levenshtein distance for this challenge is this one on Planet Calc.
- In addition to being a CnR challenge, this is code-golf so all usual golfing rules apply.
Also, make sure if you change something in this question, that you update the robbers one. – mbomb007 – 2017-02-13T17:36:12.503
What if a cop names a function/variable really big with respect to the actual code generating the sequence? It'll be possible to create any sequence in this case with its lev distance being less that
(0.5*len(A))
– hashcode55 – 2017-02-13T17:38:46.787@hashcode55 Two things -- 1) that's not likely going to be a good candidate for winning the cops' thread. 2) if it's enormous like that, it also gives a good leeway for the robbers to crack it. – AdmBorkBork – 2017-02-13T17:40:46.257
1"this is code-golf so all usual golfing rules apply" Does this mean that code A must be golfed as much as possible, or can it be intentionally written in a too verbose/awkward way to make it more similar to code B? – smls – 2017-02-13T18:05:44.493
@smls Writing goofy code is fine. Obviously, different algorithms will be golfed differently. Just because there's a different algorithm that's shorter isn't an issue. Intentionally padding with spaces or comments is not okay, though. – AdmBorkBork – 2017-02-13T18:14:02.060
My usual question: if the language uses a bizarre encoding, is the Levenshtein distance measured using bytes or characters? – None – 2017-02-13T19:55:46.060
@ais523 I've only ever encountered Levenshtein in terms of characters, so that's what we're using here. I'll edit that in explicitly. – AdmBorkBork – 2017-02-13T20:01:10.897
@AdmBorkBork If the programs need to be golfed, that should be mentioned in the spec. Also, does this apply only for A or for B as well? – Dennis – 2017-02-13T20:44:09.200
7Search un-cracked answers – mbomb007 – 2017-02-13T23:02:41.820