I have an assignment for school, in which I have to build a neural network that will play tic tac toe, using genetic algorithms for training. The thing is that I am clueless on how to connect the two. I need help in the design. Should use the GA to generate game boards, to serve as input for the neural network. Or, should I generate the NN weights with the GA. In both cases. I'm having a really hard time with this subject, but I find it extremely fascinating. Any help would be much appreciated. Thanks

  • 1
    $\begingroup$ The genetic algorithm is used to update node weights during training in lieu of normal back propagation. $\endgroup$ – Kasey Speakman Nov 11 '15 at 18:16

this is an unusual assignment or exercise for several reasons. tic tac toe is not a complicated game, there is not a large "state space" so an optimal algorithm is possible even by eg a "relatively small" finite state machine. so even a genetic algorithm or neural network alone would be sufficient (in fact, capable of playing a perfect game) and also, from a practitioner pov, overkill. it suffices as a "toy problem" but almost even too simple to fully demonstrate these techniques. breaking down the problem into a machine learning approach aka "decomposition" is part of the art/ science of the field. here are a few relatively basic/ straightforward possibilities.

  1. genetic algorithm alone: let the candidate solutions aka chromosomes be represented as strings with alternating moves. the fitness function evaluates who wins and if the strings represent valid moves between the two players. it will not take long to find/ enumerate all possible game sequences.

  2. neural network alone: input is (an encoding of) the opponents move, output is the computers move. a data generator must pick valid moves by the opponent.

  3. combination (even bigger overkill): a common scenario in NN+GA technology is for the GA to be used to generate NN architectures. the GA string determines the NN architecture. eg size and possibly connectivity of the different layers. the fitness function is the results of training/ evaluating the NN on the particular GA architecture (ie chance of the computer winning).

and of course there are many other ways to combine NNs+GAs and other ways to decompose the problem into NNs or GAs alone.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.