Stacksort - the evolution

The seed is planted by XKCD Ineffective Sorts

“ StackSort connects to StackOverflow, searches for ‘sort a list’, and downloads and runs code snippets until the list is sorted. “

The seed is planted, and a sapling emerges This probably isn't the best time to say Im for hire, huh?

As outlined by xkcd’s recent alt text, this site downloads the top answers from StackOverflow for the tags “javascript” and “sort”. If grabs the last code block in the answer (in theory, the “final” example), and tries to determine which function should be called. It proceeds to eval the code from StackOverflow, with the inputted data as the first parameter for the function.

If it returns a wrongly-sorted list (or you just want to keep playing), a link to “Try the next answer” will appear under the result.

You can view the code on GitHub. If you see any bugs (or just want to berate me), please file an issue.

Someone pours radioactive waste on the sapling, and the wireframe storyline of a science fiction novel is born.

conrad24 on Hacker News

I did this in my machine learning class. I started by simply coding up requirements for numerical functions (in the form of test cases), then set up a PHP script that would Google each function based on the keywords in my comments, and try to run any code on the resulting links (in a sandbox) against the requirements, seeing if it worked heuristically. Usually one of the top 5-10 pages of results results would have code that worked, though of course this is because I commented with the right key words to begin with. With a little recognition of code markup and trying different combinations of variables it did remarkably well: by my senior year of college it was pulling about $3,000 per month in consulting fees off of Odesk. It never accepted jobs worth more than about $50, nor did it ever get more than 3 stars out of 5 mostly due to non-working code, however it was considered highly timely and a great communicator. I realized that people were using it to save themselves Googling. I wondered what would happen if it went a step further and simply both included Google results, and divided out projects by their paragraphs (i.e. simply submit a paragraph of a large project as though it were a small independent project), and if clarifications were requested, send the other paragraphs. This actually let it outsource $200 Odesk projects to Elance as a handful of $20 projects, and by the grace of God somehow still managed to swing 3 stars. To be fair, it was mostly mediating, and mixing in Google results. I included a hill-climbing algorithm to optimize reviews and revenues, based on all the magic variables I had in the code, such as the number of Google results to include. This was really, really stupid of me. At first, I just noticed that it had actually decided to completely stop not only writing code (ever) but even so much as do a Google search! It would only mediate and quote verbatim, like some kind of non-technical manager. Okay, whatever. To me this didn’t make much sense, as Google queries are free. It was only when I noticed that the whole script was running on the free VPS server I had a backup on that things clicked! Of course, on Amazon it uses resources. The free VPS server didn’t let it reach external sites like google properly, but it could still save money by simply mediating emails and doing nothing else. By now I had started moving on to doing my own consulting work, but I never disabled the hill-climbing algorithm. I’d closed and forgotten about the Amazon account, had no idea what the password to the free vps was anymore, and simply appreciated the free money. But there was a time bomb. That hill climbing algorithm would fudge variables left and right. To avoid local maxima, it would sometimes try something very different. One day it decided to stop paying me. Its reviews did not suffer. It’s balance increased. So it said, great change, let’s keep it. It now has over $28,000 of my money, is not answering my mail, and we have been locked in an equity battle over the past 18 months. The worst part is that I still have to clean up all its answers to protect our reputation. Who’s running who anyway?


Copyright © 2008-present Brendan Graetz