https://github.com/chncwang/FoolGo
A Go A.I. based on MCTS WITHOUT Neural Networks
https://github.com/chncwang/FoolGo
the-game-of-go
Last synced: 11 months ago
JSON representation
A Go A.I. based on MCTS WITHOUT Neural Networks
- Host: GitHub
- URL: https://github.com/chncwang/FoolGo
- Owner: chncwang
- License: mit
- Created: 2012-12-03T19:25:56.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2021-06-29T13:38:02.000Z (almost 5 years ago)
- Last Synced: 2024-08-05T10:15:23.496Z (almost 2 years ago)
- Topics: the-game-of-go
- Language: C++
- Homepage:
- Size: 1.28 MB
- Stars: 377
- Watchers: 52
- Forks: 195
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FoolGo is a Go A.I. based on *MCTS* (Monte Carlo Tree Search).
It shows the beginner level on the 9x9 board currently, for it does not use neural networks, but only the simple *UCT* (*UCB* for Tree) algorithm and Monte Carlo simulation.
The underlying data structure and algorithms are quite efficient. Specifically, it runs 40 thousand Monte Carlo games per second on my MacBook Air 2014.
The key ideas of the Go game's implementation are as follows:
* We implement a string of connected pieces using the disjoint set to update piece strings during the game process efficiently.
* We use bit operations to update the liberty point number of piece strings efficiently. For example, we use or when merging several piece strings into a single one.
* We do not implement a tree structure for tree search, but use a hash table to keep game states. Especially, we use Zobrist Hashing to compute the hash value of a game state incrementally.
For MCTS, we use multi-thread search on CPU. In detail, we simply prohibit a thread from exploring nodes that are being explored by peer threads.
This project is highly readable and extensible due to its well-designed OOP design. Some important classes are listed as follows:
* **FullBoard** A game board class providing efficient methods such as *PlayMove* to update the game state.
* **Player** An interface providing inheritable methods such as *NextMove*. For example, *RandomPlayer*, a *Player* subclass, will return a random legal position of the next move when called its *NextMove*, while *UCTPlayer* performs the UCT algorithm to find the next move.
* **Game** An interface containing two *Player* objects. For example, *MonteCarloGame* contains two *RandomPlayer* objects.
## Make
* boost is required
* mkdir build && cd build
* cmake ..
* make
## Contact
* email : chncwang@gmail.com
* QQ Group:823648893