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.
Show HN: XKCD-inspired StackSort
31–40 of 210 posts
Re: Show HN: XKCD-inspired StackSort
#32If 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…
Re: Show HN: XKCD-inspired StackSort
#33Re: Show HN: XKCD-inspired StackSort
#34Re: Show HN: XKCD-inspired StackSort
#35Re: Show HN: XKCD-inspired StackSort
#36Has 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.
Re: Show HN: XKCD-inspired StackSort
#37Wow.. beautiful! I know this is only for fun, but it can start something bigger. Basically, given an input and output we could search for an algorithm that works. It reminds me a talk that PG gave in which he states people making bots to optimize code and then an intelligent compiler could be done. It sounded very futuristic, but maybe it is not that futuristic after all...
Re: Show HN: XKCD-inspired StackSort
#38Wow.. beautiful! I know this is only for fun, but it can start something bigger. Basically, given an input and output we could search for an algorithm that works. It reminds me a talk that PG gave in which he states people making bots to optimize code and then an intelligent compiler could be done. It sounded very futuristic, but maybe it is not that futuristic after all...
Re: Show HN: XKCD-inspired StackSort
#39If 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…
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: Here's the code. https://gist.github.com/shurcooL/df2c8339ada1997606b3 It should run out of the box if your Go is installed in /usr/local/go. I just changed it to generate a temp dir in the working dir (prefixed with "Gen-"), so you can delete it afterwards (previously it relied on a "Gen" folder to already exist). Right now it's configured to have quite difficult verification conditions, so it generates valid programs quite infrequently (despite trying 5000+ programs per second on my machine).
Re: Show HN: XKCD-inspired StackSort
#40Earlier quoted context omitted.
Dammit, just as I was about to write a function sortArray(a) { alert('Hello StackSort!') } Question/Answer. =( Good foresight!
I also don't allow alerts :)
It would be a shame though if someone edited / republished / whatever an old script and used it to steal people's github cookies (your code wouldn't be able to filter someone calling a remote script which then ran its own code for instance or a script that evaled a new script based on a string / unicode etc.)
It might be best to just run the code in a frame that's not hosted on Github then you're safe.