Skip to content

ianhb/go-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoAI: Beta Go

Ian Blakley

Alpha Go Reimplementation

Tech

Beta Go relies on several components to work correctly:

  • Java 8
  • Python 2.7
  • Gradle 3.1
  • JavaFX
  • GRPC
  • TensorFlow
  • TensorFlow Serving
  • VirtualEnv
  • Bazel

Installation

Make sure the core tech requirements (Java 8, Python 2.7, JavaFX8 and Gradle 3.1) are installed

Clone the repository and download the game records from the lastest release to python/datagen/data

Requirements can be installed automatically using configure.sh or manually as shown below. If using configure.sh, when prompted for input on configure, use the defaults (press enter) and enter password when prompted to install required packages

Setting up the python environment:

$ virtualenv goaivenv
$ source goaivenv/bin/activate
$ cd goai/python
$ pip install -r requirements.txt
$ python -m grpc.tools.protoc -I../proto --python_out=generated --grpc_python_out=generated ../proto/*.proto

Since TensorFlow isn't in PyPi, it has to be installed manually. Instruction to install the lastest version can are here

TensorFlow serving requires a C++ server to allow querying the neural network. In order to setup the server, follow the installation instructions here

Briefly, install Bazel and execute

$ cd ~/Downloads
$ chmod +x bazel-0.3.2-installer-linux-x86_64.sh
$ ./bazel-0.3.2-installer-linux-x86_64.sh --user

and add $HOME/bin to your path. Install the following packages:

$ sudo apt-get update && sudo apt-get install -y \
        build-essential \
        curl \
        libcurl3-dev \
        git \
        libfreetype6-dev \
        libpng12-0 \
        libzmq3-dev \
        pkg-config \
        python-dev \
        python-numpy \
        python-pip \
        software-properties-common \
        swig \
        zip \
        zlib1g-dev

Generating data and training the model:

$ cd goai/python/datagen
$ python create_records.py
$ cd ..
$ python trainer.py --model_type=fast
$ mkdir /tmp/models
$ cp -r models/export /tmp/models

The whole process takes ~1 day to generate the data and train on it

Building the neural network server (when prompted for input use the defaults):

$ git clone --recurse-submodules https://github.com/tensorflow/serving
$ cd serving/tensorflow
$ ./configure
$ cd ..
$ bazel build tensorflow_serving/model_servers:tensorflow_model_server

Running Game Simulations:

Start Game Logger Server:

$ cd goai/python
$ python main.py

Starting the Tensorflow Server:

$ ./serving/bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --model_name=fast --model_base_path=/tmp/models/export/fast_model --port=9000

Run all possible games:

$ cd goai/java
$ gradle :clean :build :run

##GUI A GUI exists for the game. Start the tensorflow server as described above. Then use run gradle :jfxrun to start the GUI

Current Bots

  • Random Bot: Randomly selects a legal move to play
  • Random MCTS Bot: Uses the Monte Carlo Tree Search algorithm with random expansion
  • UCT Bot: Uses the Monte Carlo Tree Search algorithm with Upper Confidence Threshold expansion
  • Neural Network Bot: Uses a trained neural network to select move given the current board state
  • Human Bot: Takes console input to make a move
  • Alpha Go Bot: Uses a combination of neural networks and MCTS to select move
  • Pseudo-Alpha Bot: Uses the Alpha Go Bot tree policy and random default policy

Acknowledgements

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors