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.
- 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.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.,
importstatements for Java and Python,
usingstatements for C# and C++, and their equivalents in all languages) If the code snippet includes the
imports 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)
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)
filefrom link 1
contentfrom link 2