Monday, 28th September, 2009

Baby’s First Interpreter — Follow-up

So I eventually got the Brainfuck interpreter working. I celebrated. I rejoiced. I was happy. And for a while, all was good. But this was not my goal. What good is an interpreter for a minimalistic program? I’ll tell you what. At only 8 commands, 6 that I was interested in, it was easy to press it into service.

For a while now I’ve been thinking about genetic algorithms. Not the ones where one tries to evolve a solution to a problem, like the common one of trying to evolve a good route, I mean trying to evolve an algorithm.

The genome would be the brainfuck program. And it’s fitness? How good the results it produced were. Mutation is gained through sexual (and occasionally asexual) reproduction by splicing the 2 genomes together at a random point. There’s also a low chance of adding/removing information from the genome.

At the moment, it runs, vaguely, but it doesn’t seem to evolve anything; and it does this very slowly.

For the time being, I’m going to have to consign it to the ’sleep on it’ category. Last night I was completely unable to finish the interpreter. I woke up and within an hour or two I had it completing all of my unit tests, it was very strange.

Code Here

Done! :-D