Tag-Archive for » hack «

Friday, November 14th, 2008 | Author: ranok

While cleaning up my hard drive, I’ve come across many old projects that are pretty interesting, and I thought I’d start a mini-series of these little pearls (perls?) I come across as I find them. Without further ado, lets start with our first Lulz of the Day (LOTD)!

Cesspool

As many of you know, I’m in the systems biology class this semester, and recently we spent a week or so looking at the genetic algorithm and its applications. I immediately began hacking on a genetic algorithm to ‘breed’ a Corewars warrior. The code for this is pretty simple, and still needs much revision, but it’s bred some programs that are pretty good. I’m going to run it a few times and try to put together some statistics in the next few days, but for now, you can download the source and play around with it as you wish. Basically what it does is:

  1. Generates some initial warriors with random commands and arguments
  2. Pits the warriors against themselves in battle using the corewars-cmd command
  3. Ranks them by their scores
  4. Cross breeds the best 20% of the population, and mutate the rest (with 5% chance of mutation)
  5. Repeat from step 2 for the number of generations.

Todo:

  • Modify the cross-breeding algorithm so it doesn’t just append one program to the other, but mixes up the commands of both
  • Small bug fixes with the scraper for the corewars-cmd results
  • Run a number of times, and then pit the best generated warriors against some made by humans

Peace and lulz,

Ranok

Category: For Fun, Projects, Random, Technical  | Tags: , ,  | 2 Comments