--I tried to make Othello AI with tensorflow without understanding the theory of machine learning-Introduction- -I tried to make Othello AI with tensorflow without understanding the theory of machine learning-Implementation- -I tried to make Othello AI with tensorflow without understanding the theory of machine learning-Iza battle- -I tried to make Othello AI after trying to understand the theory of machine learning ~ Restart! ~ -I tried to make Othello AI after trying to understand the theory of machine learning-What is this Alpha Zero edition- -I tried to make a neutral network with Excel to understand the theory of machine learning ~ Image recognition mnist edition ~
In this field, as an outsider, I didn't study "theory of machine learning" at all. I would like to make an AI for Othello. Click here for the referenced site ・ Implement DQN (Deep Q Network) with TensorFlow in a super-simple manner ~ Introduction ~
If you explain the concept roughly Two artificial intelligences confront Othello earnestly, Save the AI behind and fight me (human). That's why.
My environment is as follows. OS ・ Ubuntu Development environment ・ Python 3.5
I think it works in this environment Building Ubuntu python development environment on Google Cloud Platform
First, download the source code.
The source is here.
$ git clone https://github.com/sasaco/tf-dqn-reversi.git
When the environment is ready, move to the source code directory and hit train.py to start learning.
python
$ cd tf-dqn-reversi
$ python train.py
If you see the following log, you are learning correctly.
python
player:1 | pos:32 | LOSS: 0.0000 | Q_MAX: 0.0041
player:2 | pos:15 | LOSS: 0.0000 | Q_MAX: 0.0009
…
layer:2 is only pos:56
player:2 | pos:56 | LOSS: 0.0000 | Q_MAX: 0.8607
EPOCH: 999/999 | WIN: player2
winner is player2
It will take several hours to finish the study. Now let's test with the model we learned.
python
$ python FightWithAI.py
------------- GAME START ---------------
***user turn ○***
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 ○ ● 29 30 31
32 33 34 ● ○ 37 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
Please enter the number
[43, 34, 29, 20]
>>>
If the game starts as above, you are successful. Did it work properly? The result of the match will be written in ~ Iza Battle ~.
Next time will deliver the implementation version.
Recommended Posts