13
1
Overview
This challenge was inspired by this StackOverflow Meta post. In it, @hakre says:
I've seen a project really written by Stackoverflow (a noob copies together from SO here and SO there), attribution normally never is done which results in rights termination under CC. (sic)
Your mission is to make the most interesting program you can -- without ever writing a single line of code. You can only use code which is already written for you, both in questions and answers from StackOverflow. All you can do is duct tape it all together the best you can. And of course, it's very important that we provide appropriate attribution so that we don't get our rights terminated.
Rules
- You must include links to the questions/answers you used in your answer.
You may not modify the code you find, with the following exceptions:
a. You may rename variables, functions, and methods. (This doesn't mean you can change a method invocation, by changing, say
scanner.nextInt()
toscanner.nextLine()
and claiming that you're changing a method name. The change must be in the definition or reference to the same entity.)b. You may adjust indentation appropriately.
c. You can assume that the proper modules are loaded for the code snippets to work. (e.g.,
import
statements for Java and Python,using
statements for C# and C++, and their equivalents in all languages) If the code snippet includes theimport
s for you, you can move them to the top of the code.d. If the language requires the code to be in some kind of method body to execute (e.g.,
public static void main(String[] args)
for Java,static int Main(string[] args)
for C#, and so on), you can wrap your code in the appropriate method. But the contents of that main method must remain unmodified.You must supply an explicit list of any variable/method/function/class rename-ings performed.
- You can't take snippets of snippets (meaning if you take a code block from a post, you take the whole thing)
- Provide a brief description of what the code does for people who aren't intimate with the language you're using.
- Popularity contest, so the most upvotes wins!
Boring Five Minute Example (Python 3)
Description: Reads a bunch of log files from the current directory and randomizes the lines in them (exciting, right? This would totally win a popularity contest)
Source
import glob
import random
for file in glob.glob('log-*-*.txt'):
# Etc.
with open(file) as f:
content = f.readlines()
# shuffle the list in place
random.shuffle(content)
# print it
print(content)
Legal Modifications
- Renamed
fname
tofile
from link 1 - Renamed
b
tocontent
from link 2
Attributions
8I really like the idea, but I think this question would immensely benefit from limiting the scope to a particular task. That would a) inspire more creativity because you can't just copy together anything and b) it would leave open the possibility to reuse this (interesting) type of question later on in a different context. If you just leave it as "do whatever you want", all further questions like this will be duplicates. I'm afraid as it stands, I have to close-vote as "too broad" because it torpedoes possibly interesting future questions. – Martin Ender – 2014-05-08T01:33:38.273
Not to mention that someone could just say, "Print "hello world" and be done – TheDoctor – 2014-05-08T01:34:40.493
@m.buettner Hmm... fair enough. I don't have any good ideas for what to limit the scope to, though, I'm afraid. – asteri – 2014-05-08T01:35:00.393
Couldn't I just take a Brainfuck program, and "reuse" the
+-<>,.[]
characters to form a new program? – marinus – 2014-05-08T01:35:04.070@TheDoctor I doubt that that would win a popularity contest. – asteri – 2014-05-08T01:35:48.093
2I should add, no I don't want this to become the next code-trolling, where everyone posts a "Add two numbers", "Split this string", with a "duct-tape-coding" tag. I think we can handle this more creatively than that. I would just like to leave some room for other interpretations of this kind of restricted-source competition. – Martin Ender – 2014-05-08T01:35:56.013
1@m.buettner I'm also not sure that CodeGolf.SE would necessarily benefit from lots of questions like this, for the same reasons you mention: why have "split a string using SO code", "get a random number from 1-100 using SO code", and so forth? But that's just my opinion. I'm far from a CodeGolf.SE pro. :) – asteri – 2014-05-08T01:41:00.177
3I'm going to remove the random custom tag for now because the need for it hasn't been established (and it will very likely be unnecessary and add no value). – asteri – 2014-05-08T02:16:41.783
@marinus You can't reuse characters from a post. You have to use the entire block of code. So I don't think so, no. :) – asteri – 2014-05-08T03:31:10.063
I dunno, the "no snippets of snippets" rule seems like it could be a little too restricting. I know the intention is to stop them from just copying one character from a bunch of places to write anything they want, so why not change "no snippets of snippets", to "you can make snippets of snippets, but only if it consists of complete lines". – Braden Best – 2014-05-08T03:44:56.397
@B1KMusic I think the challenge becomes too easy if you can pull out any lines from any posts. I think it's important that the "piecing together" remain the focal point of the challenge rather than rewarding a person who spends the time to look up 200 SO posts, takes a line from each of them, and makes a comprehensive program from it. The latter makes the challenge both extremely trivial and, more importantly, extremely boring. – asteri – 2014-05-08T03:48:00.883
1I agree that we need to be careful with flooding PPCG with questions like this, just because it's fun and novel. But I think a few genuinely different questions could come of this... like a maths-based, a graphics-based one, one that uses code-golf scoring and a polyglot challenge maybe. Hence, I'd prefer the scope to be limited. In terms of people just copying the challenge without anything substantial, I think it's the duty of the community to be a bit stricter in "closing as duplicate" when it comes to new challenge types. – Martin Ender – 2014-05-08T09:45:02.177