12
\$\begingroup\$

Are there any guidelines on using code written by others for other challenges as a part of an answer to a completely different challenge? It's a bit of a special case, but I'll explain.

I'm currently writing an answer that will end up being quite long, and I realized that it may benefit by compressing the code and including a decompression function that can output the original code to be evaled. The language is JavaScript, and since there's no built in compression algorithms, I decided to look through the "Text compression and decompression — “Nevermore.”" challenge for options and came across this submission.

I made some improvements to their code, as well an converting it to ES6 for the benefit of arrow functions. When included as a part of my answer it does indeed save a few bytes. Before I submit though, I wanted to know how this sort of reuse might be viewed. Being that it is unrelated to challenge I'm submitting to (which involves image generation), would it be considered acceptable to submit to this challenge, and give to credit to the author for the part their code played in getting the final size down?

\$\endgroup\$
12
\$\begingroup\$

As far as I know, there's nothing wrong with that sort of reuse. It happens often enough, and I've done it on occasion. For example, while drawing a forest:

It's basically a fractal random walk with slowly shrinking, twisty vines. I draw 75 of them, gradually changing from white in the back to black up front. Then I dither the whole thing, shamelessly adapting Averroes' code here for that.

Even if the challenge is related, I don't think there's a problem, given attribution.

\$\endgroup\$
  • 5
    \$\begingroup\$ It's probably worth noting that if you can copy code from another answer and repost with minimal changes, the challenges are probably duplicates. \$\endgroup\$ – Doorknob Feb 1 '16 at 20:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .