The TicTacToe prototype uses two artificial intelligence processes that are capable of ‘live evolution’.
The live evolution process handles cycling through topologies and mutation. After initiating the process with the proper configurations, beginning a think cycle is one line of code.
SynchronizeActiveCortex |> player1AI.PostAndReply
The TicTacToe prototype script is only 351 lines. Much of that is styling based on personal preference.
The topologies start with a simple NeuralNetwork structure.
GameBoard Sensor -> Neuron -> Move Actuator
This topology is only capable of responding to the value in the first square on the game board, because it only contains one NeuronConnection. The successful topologies will have mutated more NeuronConnections between the Neuron and the Sensor. This means the AI will be aware of the entire GameBoard after enough generations have passed.
The topology could also mutate additional Neurons, sandwiching the newly developed Neuron in between two layers in the Neural Network. It’s possible for recurrent connections to form with these mutations, giving the artificial intelligences the ability to form reactionary memory circuits in their thinking.
At first the AIs are reactionary, playing with no rhyme or reason. If an AI proposes an invalid move then they are punished. This aggressive scoring is designed to eliminate NeuralNetworks that are not capable of following the rules.
There are sections in this type of competitive development where certain tactics become successful. This can be observed in the video with players winning repeatedly with diagonal moves. Eventually these tactics are defeated by evolution and the scoring shifts in favor of the other player.
Halfway through the video, the players start to evolve defensive capabilities where they counter enemy potential wins. This often results in stalemates which end the game with neither neural networks receiving high fitness scores for winning. Therefore winning neural networks will be highly favored and selected for mutation.
The AIs don’t switch turn orders which creates an interesting dynamic in behavior. Player 1 will always go first so the possible tactics and strategies that can be deployed are only concerned about an empty game board. Player 2 will most likely develop to react to player 1’s moves than be concerned about their own. That is until a mutation occurs favoring aggressive behavior.