The Genetic Game

CS5350 Fall 1999
Kevin Harris
07Dec1999


Purpose

The purpose of 'The Genetic Game' is to explore the possibility of learning weights for a set of features using a genetic algorithm. The basic game is similar to ATTAX, 7-Up spot, and others.
As a sub-goal, I wrote this project to:

Note that when I refer to 'square', it means a space on the gameboard, regardless of actual shape.

Rules for 'The Game'

Goal

The goal of the game is to win, which may be accomplished in one of the following ways:

Movement

There are two types of moves possible (both may result in a 'capture'):

The players take turns making moves (if they are able) until either the board has no empty squares, or all opponent players have no pieces remaining (in which case the sole remaining player would be free to fill the remaining squares by growing).

Capture

A player making a move will be able to capture (take over) any opponent pieces within the grow range of the destination square. Capturing a piece will change the color of the piece to the color of the player making the capture. An example of a capture is shown in figure 4, where 'M' is the destination square of the move, the 'C' squares are squares which the pieces would be captured if they belonged to an opponent, and the 'X' is an opponent piece which would then be captured. The board resulting after the opponent piece was captured is shown in figure 5.

Genetic Portion

Structure

Each individual member of the population contains a floating point number to represent it's current estimated value, and a bitstring to hold the genetic data. This genetic data is a sequence of fixed point numbers (weights of attributes) concatenated together. For my test runs, each fixed point number was divided up as follows:

This representation allows me to use 511 distinct numbers in the range of -15.9375 to 15.9375 (there is a positive and negative 0). An example population member using 5 attributes (5 fixed point numbers) can be seen in figure 8.
The estimated value for each member is updated each generation after the tournament (see below), and whenever a crossover occurs, the offspring are given the average estimated value of the parents. Whenever a population member completes a game, it's estimated value is increased (on win) or decreased (on loss).

Attributes Chosen

The basic attributes that I chose to use include the following (not all were used for all tests):

Combining the above attributes, I ran various versions of the game ranging from one attribute (player piece count) to 16 attributes (player count, opponent count, safe squares, 2 near safe squares, 3 risky holes, 3 opponent near safe, 3 holes, 2 opponent holes).

Competition/Tournament

For each generation, to determine the 'most fit' members of the population, I used a tournament to adjust the estimated values of the population. I tried two different tournament methods:

At the end of each tournament, the estimated values are adjusted based on their tournament performance. Again, I tried two methods for this, both have their problems.

Verification

At the end of each tournament, the player with the highest estimated value would be subjected to some number (I used between 20 and 50) of games for each of three verification players (to generate graph output, and to verify that learning was taking place):

Figures


Figure 1: Jump and Grow ranges


Figure 2: Initial Board positions

Figure 3: Possible Initial Moves


Figure 4: Example of capturing an opponent piece

Figure 5: Board after capture in Figure 4.

Figure 6: Example of a triangular board

Figure 7: Jump and grow ranges for a triangular board

Figure 6: Example of an offset square board

Figure 7: Jump and grow ranges for an offset square board

Figure 8: An example of a population member (5 attributes, 9 bits each)

Counter
1