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

in #programming7 years ago (edited)

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 :)

Coin Marketplace

STEEM 0.18
TRX 0.18
JST 0.032
BTC 87512.19
ETH 3031.52
USDT 1.00
SBD 2.72