thenewjavaman avatar

AI Tic Tac Toe, Part 1 (Data Sets) - Monday Post #2

thenewjavaman

Published: 31 Jan 2018 › Updated: 31 Jan 2018AI Tic Tac Toe, Part 1 (Data Sets) - Monday Post #2

AI Tic Tac Toe, Part 1 (Data Sets) - Monday Post #2

logo.png

it's not monday

Yeah... but my computer broke so I just fixed it.

intro

I recently wanted to create a more advanced neural network with a purpose. You can see my last post on a basic neural network in my bio. I finally settled on the game Tic Tac Toe. I have to admit that I was influenced by War Games, one of my favorite movies.

code outline

I know that I want my code to be in Python 3 and JSON, so deciding the structure wasn't too hard. There are a couple different parts that are needed for the program to work:

  • Training data (Games where the following move has been determined to be the best)
  • Neural network data (Required for multiple stages of training and finally using the network)
  • The training program (Uses the training data to "learn" how the game works and what moves to use)
  • The final program (Creates a new network based on the processed data to create an artificial player)

Personally, I think that the hardest part will be creating the training data, so I did that first.

how it's formatted

I used a JSON file and a simple Python 3 script to input an afternoon's worth of boredom into code. It looks like this (although the code will be up on Github soon):

  • Sets of "before" boards
    • Board 1
    • Board 2
    • Board 3
  • Sets of "best move" boards
    • Board 1
    • Board 2
    • Board 3

Each board is made up of a matrix array, where each the board goes:

[0,2][1,2][2,2]
[0,1][1,1][2,1]
[0,0][1,0][2,0]

The final file turned out, when pretty-printed, to be over 800 lines long with just over 50 sets.

Anyway, this is just a start. Comment if you would like to see my current version of the code and don't forget to leave a like if you think what I'm doing is interesting. Follow for more content :)

Leave AI Tic Tac Toe, Part 1 (Data Sets) - Monday Post #2 to:

Written by

Self-taught programmer, sometimes is smart.

Read more #programming posts


Best Posts From thenewjavaman

We have not curated any of thenewjavaman's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From thenewjavaman