Go
is an abstract stategy board game for two players in which the aim is to surround more terriority than the oponents.- The game was invented in China more than 2,500 years ago and is believed to the oldest board game continuosly played to the present day.
- The playing pieces are called
stones
, one player uses the white stones and the other black. - Interesting point in the history of
Go
is the day whenDeep Mind with the power of AI/ML built a model that defeated the legendary player Lee Sedol(9 Dan)
with a model called AlphGo Documentary Alak
is a 1D version of Go with similar game play.
- There are two sides: the “x” side and the “o” side.
- Starting board configuration: there are 5 pieces lined up on either side and 14 spaces total, i.e., 4 empty spaces between the two groups.
- You can move one piece at a time.
- You cannot add any new pieces to the board.
- The “x” side always makes the first move.
- Kill: if and only if one or more contiguous pieces on one side is “sandwiched” between two opposing pieces, then the “sandwiched” piece(s) will be removed from the board.
- Randomly generate the next legal move.
- Decide if any pieces need to be removed from the board.
- The opposite side makes its move.
- Show the positions of the pieces in each round of simulation (0 to 13), by using 0-9 and lower case ‘abcd’. Here’s the opening round of a simulated game:
Functionality | Tools |
---|---|
Programming Language | Python3 |
Scientific Modules | numpy, matplotlib/seaborn |
ML Modules | sklearn, Tensorflow |
Deployment | Jupyter Notebook/Docker |
- It consists of board positions gathered over 10,000 random winning games for both sides 'x' and 'o'.
- There are a total of
~25,000 games
with 90% training data and 10% testing data. - Data Sample:
- Generate data using 10,000 random games(random games avoid suicide moves to learn strong moves).
- Encode the data from 'x','o' -> '1' and '-1'.
- Train the model using these games with 90%-10% split.
- Make predictions using the trained model.
- Get indexes of the move with maximum winning probability i.e. 0-5 kills.
- Iterate from 5 kills to 0 kills and the return the first move over threshold of default value 0.8, hence the name
G2G Algorithm
- If none of the moves are over threshold, return the move with maximum probability.
Folder | data | Usage |
---|---|---|
src | Alak2.py | root script for playing and generating the data |
notebooks | alak_simul.ipynb | refer notebook for generating data, training and playing the game |