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 will run. :D You laugh now, but imagine a bizarre combination of genetic programming and machine learning with Stackoverflow and Github used as corpuses. Great Scott!
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.
Since 4chan threads are thrown away, it lacks the "hereditary" trait of the variation/selection/heredity trio. Unless you include one of the sites that archives popular threads I suppose.
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: 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).
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.
If you actually want to go down this path then you want a language with as little redundancy as possible. Comments may be useful to humans but they needlessly complicate the search space. Abstractly you want to think about the how your language is parsed so you don't for example try different variable names.
[Slash/A](https://github.com/arturadib/slash-a) is specially designed for genetic programming / random generation. No matter how you piece together the instructions, it is still a valid program.
Cool, let me know the best you get (and submit a PR with your parallel patch if you want).
You can tweak the range of the number of generated characters, the length of Markov chains, the minimum main body clauses, etc. With my original config it should give you a valid program every hour~few hours or so.
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.
I'm waiting for 1Password to implement 936. http://xkcd.com/936/ It's not that I don't trust 1Passwords generation algorithm, but when I'm on a borrowed PC (wife's laptop, inlaws desktop or even at work where I can't install 1P) this would help. It's much easier to open 1P on my iPhone, look up a password and type in "correct horse battery staple" than to constantly have to refer back to my phone.
I just wish my password manager would do that automatically. I know there are terminal scripts and apps that will do it. I'd just like it to be integrated.
Comments (198) 66 threads
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 will run. :D
You laugh now, but imagine a bizarre combination of genetic programming and machine learning with Stackoverflow and Github used as corpuses. Great Scott!
http://en.wikipedia.org/wiki/Infinite_monkey_theorem
After running it overnight (it was attempting 40+ programs per second), the very best program looked something like this:
http://en.wikipedia.org/wiki/Genetic_programming
Continue this thread — 8 replies
http://www.primaryobjects.com/CMS/Article149.aspx
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.
Though if you spend enough time your probably going to be reimplementing some type of http://en.wikipedia.org/wiki/Genetic_programming
Modified it a bit to run in parallel. I guess I'll leave it on for couple hours and see if it gets anywhere.
current output:
You can tweak the range of the number of generated characters, the length of Markov chains, the minimum main body clauses, etc. With my original config it should give you a valid program every hour~few hours or so.
It's called Choice Words (https://github.com/fdb/choicewords) It can generate poems but also generative designs (see the README).
http://en.wikipedia.org/wiki/Grammatical_evolution
Continue this thread — 1 reply
Continue this thread — 2 more replies
Continue this thread — 3 more replies
Also of utmost importance: it sorts both [8,6,7,5,3,0,9] and "jennyigotyournumber". Now I'm really gonna make her mine.
It tries to sort a list or JSON by fetching code from StackOverflow until it properly sorts the input.
1) I thought it would defeat the purpose
2) "Sort" is very arbitrary. Do you want to sort by key or value? Is "1000" bigger or smaller than "2"? etc
Continue this thread — 1 reply
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"
GitHub even adds the anchor for you if you click on the line number in the gutter. (shift-click to select a range of lines.)
I'm waiting for 1Password to implement 936. http://xkcd.com/936/
It's not that I don't trust 1Passwords generation algorithm, but when I'm on a borrowed PC (wife's laptop, inlaws desktop or even at work where I can't install 1P) this would help. It's much easier to open 1P on my iPhone, look up a password and type in "correct horse battery staple" than to constantly have to refer back to my phone.
Continue this thread — 1 more reply
Continue this thread — 3 more replies
All comments shown.
Couldn't load more comments. Check your connection and try again.