Live data from Hacker News

Show HN: XKCD-inspired StackSort

gkoberger.github.com

61–70 of 210 posts

Re: Show HN: XKCD-inspired StackSort

#61
post #5

If you give it about 30 seconds it works eventually, this is beautiful. I had a good laugh. Edit: It makes me want to do something crazy like setup a tool chain that cobbles whole programs together with trial and error like this. Throw enough resources at it maybe it will be faster and cheaper than your avg. developer. It will be an unmaintainable mess as if you used Brainfuck or Perl. But it will run, by god, it wil…

I tried a basic version of that 1.5 weeks ago. At first it was generating random characters, then I tried some Markov chains trained on valid code. After running it overnight (it was attempting 40+ programs per second), the very best program looked something like this: package main; func main() { i := 0 // wae64309i Next step I wanna try is to use tokens of the language instead of series of random characters. Edit: H…

Check out this article. Same concept, using genetic programming

http://www.primaryobjects.com/CMS/Article149.aspx

Re: Show HN: XKCD-inspired StackSort

#63

This was inspired by the alt-text from last week's "Ineffective Sorts" xkcd ( http://xkcd.com/1185/ ). It tries to sort a list or JSON by fetching code from StackOverflow until it properly sorts the input.

Nicely done. I enjoyed looking at the code.

For those of you who want to jump straight to the meat of it, go here: https://github.com/gkoberger/stacksort/blob/master/js/script...

Search down for "run_snippet_go"

Re: Show HN: XKCD-inspired StackSort

#64

For the numbers it eventually ends up here : http://stackoverflow.com/questions/14761032/infinite-recursi... but by and large this is a great hack. I worry however if someone meta-exploits this by creating a javascript XSS in a stack exchange answer waiting patiently ...

"The site will only fetch accepted answers, and it only uses answers that were posted before the xkcd was released (meaning that if someone posted malicious code now, it wouldn't matter)."

Re: Show HN: XKCD-inspired StackSort

#65
I'm sure that TempleTypeDef (http://stackoverflow.com/users/501557/templatetypedef) is loving this. As their answer (http://stackoverflow.com/questions/14761032/infinite-recursi...) went from 5 upvotes when this was originally submitted to 29 at the time of this comment. Presumably all due to the HN effect.

Does the script run through the same order each time, because I keep getting that answer first, and by the upvotes, as are a bunch of others.

Re: Show HN: XKCD-inspired StackSort

#66

Noticed that there was a lot of "Potentially bad code" answers. I read you are avoiding scripts with "cookie" or written after the comic was written, but are there other restrictions? For example, this was banned: http://stackoverflow.com/questions/14800987/javascript-sorti... Just curious about it.

I attempt to block anything that does DOM manipulation, uses Backbone or underscore, uses "Date()" (since it's probably a benchmark and those are slow), and a few others.

Can you also write code to detect whether a program will run forever for a given input? ducks

Re: Show HN: XKCD-inspired StackSort

#67
post #5

If you give it about 30 seconds it works eventually, this is beautiful. I had a good laugh. Edit: It makes me want to do something crazy like setup a tool chain that cobbles whole programs together with trial and error like this. Throw enough resources at it maybe it will be faster and cheaper than your avg. developer. It will be an unmaintainable mess as if you used Brainfuck or Perl. But it will run, by god, it wil…

Ah, applying the Infinite monkey theorem to programming :) http://en.wikipedia.org/wiki/Infinite_monkey_theorem

Yeah, but there are a few well trained monkeys hanging out [mining for karma points] at StackOverflow. The really adventurous would direct it at 4chan.

Re: Show HN: XKCD-inspired StackSort

#68

For the numbers it eventually ends up here : http://stackoverflow.com/questions/14761032/infinite-recursi... but by and large this is a great hack. I worry however if someone meta-exploits this by creating a javascript XSS in a stack exchange answer waiting patiently ...

"The site will only fetch accepted answers, and it only uses answers that were posted before the xkcd was released (meaning that if someone posted malicious code now, it wouldn't matter)."

That was right neighborly of him.

Re: Show HN: XKCD-inspired StackSort

#69

Earlier quoted context omitted.

I tried a basic version of that 1.5 weeks ago. At first it was generating random characters, then I tried some Markov chains trained on valid code. After running it overnight (it was attempting 40+ programs per second), the very best program looked something like this: package main; func main() { i := 0 // wae64309i Next step I wanna try is to use tokens of the language instead of series of random characters. Edit: H…

Check out this article. Same concept, using genetic programming http://www.primaryobjects.com/CMS/Article149.aspx

That's pretty sweet, thanks.

Yeah, I can see why using Brainfuck is a good idea. You're basically restricting yourself to generating only the programs that compile rather than wasting time on gibberish.

Re: Show HN: XKCD-inspired StackSort

#70
post #33

Has anybody made a gallery of real implementations of Randall Munroe's hilarious ideas yet? I recall at least three exhibitions: this, M-x butterfly, and Hell Tetris; there are probably many others.

Never forget the "import antigravity". I can't think of another comic idea that was implemented in a mainstream language. :-)
Post reply on HN