Apologies on the double post, This thread has kinda become my archive where i record the algorithms i write that i've been practicing with.
This week a wrote a genetic algorithm that could play galaga. The algorithm is not very optimal, but it does work none the less, it just takes a while of watching to tell that the computer is getting better. After about 400 generations, the computer was able to make it to stage 6 (yeah i know, 400 deaths and 6 levels, terrible, right?) Anyways, here's how the algorithm works:
It starts by generating random x coordinates, it moves toward the coordinates it generates, every time it reaches a coordinate, it fires 2 shots. Each generation, any coordinates that did not receive points, are regenerated. The coordinates that received points stay for the next generation. If the AI dies, 1000 points are subtracted from its last 15 coordinates, this forces them to be regenerated in the next generation. Over time, you get a list of coordinates where the ship will move, fire, and receive points, but will not die. (This takes a really long time)