Tic-Tac-Toe
It is strongly suggested before running any other experiments that you first do a run or two with XOR to verify that everything is set up and working properly.
Tic-Tac-Toe is a traditional 2-player game in which players take turns placing tokens on a 3x3 grid with the goal of being the first to place 3 tokens in a row horizontally, vertically, or diagonally.
It is a simple and useful domain to use as a jumping off point for board games in general. At the GECCO 2004 conference we presented a paper entitled "A Comparative Analysis of Simplification and Complexification in the Evolution of Neural Network Topologies" which uses Tic-Tac-Toe as an experimental domain. We recommend reading this paper, as it includes a full description of our primary representation, as well as a good overview of NEAT.
Before doing any run, it is a good idea to look at the properties file for any domain in ANJI and become familiar with them. Please see the Parameter Descriptions page first (scroll down for parameters specific to game domains such as Roshambo and Tic-Tac-Toe). In the current ttt.properties file, the follow settings for properties are listed:
tournament.class=com.anji.tournament.DirectTournament
tournament.direct.opponents=bad, best
This means that neural network members of the population will have their fitness assigned each generation based on their performance against hand-coded players, in this case "bad" and "best" (see the paper above for descriptions of how these players play).
tournament.component=match
match.class=com.anji.tournament.IteratedGame
match.players.reset=true
match.log=true
match.component.count=100
match.component=game
game.class=com.anji.ttt.TttGame
game.players.reset=true
game.log=false
These properties indicate the hierarchical structure of tournaments in ANJI. In this example, each neural network each generation will play one match of 100 games against each hand-coded player. The networks will be reset between each game (i.e., values from recurrent activations will be flushed out). Results will be logged at the match level, but the results for every individual game will not be displayed. In games in which players take turns, players alternate going first every other game.
To perform a run with Tic-Tac-Toe using these parameters, follow the steps below.
Step |
Procedure |
|
1 |
Windows:
1) Open a command shell (from the Start menu select Run..., type "cmd", select OK). 2) Navigate to the anji_2_00/ directory. 3) Type "evolve.bat ttt.properties" and press Enter. Unix:
|
|
2 |
ANJI will first display copyright and version, then print all the properties for the run. Then, for each generation, information such as the following will be displayed:
|
|
3 |
At the end of each
generation the following information will be displayed:
The size of the neuron
and connection id maps are displayed to give an idea of how much new topology
is being added. The number of species in the population is displayed,
along with the number of chromosomes to reach max fitness. The fittest
individual is listed, along with its score (which is a percentage of the
maximum possible fitness of 1), and its size, or number of neurons and
connections, is listed. The start and end time and total elapsed time
are all shown for the generation. |
|
4 |
In the above example,
the champion chromosome had ID 163. To evaluate the performance of the chromosome
using the settings in the properties file: Windows: |
|
5 |
After ANJI displays the properties for the evaluation, you should see output similar to the following:
If you wanted to evaluate the chromosomes against other hand-coded players, simply add or change the tournament.direct.opponents property. |