Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Genetic algorithm to create amoeba game

  1. Sep 11, 2010 #1
    I created an amoeba game where you can play against the computer. The AI searches for patterns such as "xxxxx", "oxxxxo", (as in 5-in-a-row, and 4 in a row with both sides open), and the rest (a total of 28 patterns) I could think of that lead the way to putting 5 marks in a row. Each pattern has a value, and the AI scores each possible square based on the patterns that meet there.
    The problem of course is what should the value of each pattern be?
    I tried to create a genetic algorithm to help me get the best values, but I don't think I quite succeeded... What I am doing is having two versions run against each other 2 times, each starting once; and if one wins both, it's the "main" version that get's mutated. Then I repeat.

    I'm not sure about my mutations process. Right now I'm just adding random numbers up to 100 to certain pattern values. I also tried having random values get multiplied by a random number from 0.5 to 1.5.

    Any suggestions on how to implement the genetic algorithm or how to make this work would be very much appreciated:)


    PS: the program is written in freebasic: http://www.mediafire.com/?mpk4vsxyekby7g6" [Broken]
    "Amoeba" folder contains a playable version, while "genetic amoeba" folder is the one that searches for the best combination of pattern values. In both folder "amoeba.bas" is the main file.
    Last edited by a moderator: May 4, 2017
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted