Home

Awesome

RustyGo, my untrusted bot player project

Development stopped

While I love go and developping an efficient bot, this project also was a pretext to learn a new language, Rust. Unfortunately I spent an unordinate amount of time (3 months) to get anywhere as I was fighting the language more than reinforcement learning which is hard enough. Graphs are especially painful in Rust and Monte-Carlo Tree Search is based on graphs. Furthermore, deep learning based reinforcement learning would be impossible in Rust currently.

I have rebooted a go bot project, Golem Prime in Nim, a young language I'm much more productive in. Nim has a syntax similar to Python, the speed of C and a focus on expressivity. In about 3 days, I made Golem Prime about 200x faster than RustyGo. I'm also writing my own deep learning library Arraymancer with OpenMP, OpenCL and Cuda backends with reinforcement learning as one of the future focus.

Table of Content

<!-- TOC --> <!-- /TOC -->

Why a bot in Rust

I'm an amateur dan player hovering between 1d-3d on KGS and European Go ranking. I've been interested in Computer Go since I started back in 2004 and followed eagerly the breakthroughs in the past 10 years.

Back in October 2015, I had the sudden urge to program a go bot.

What is important for the bot:

So I choose Rust:

Other languague considered:

History of computer go breakthrough

  1. First was the expert systems, with handcoded logic of "good moves" Too bad those expert system, collapsed in fights and against silly moves the programmer didn't expect.
  2. Second was the statistics system, embodied by the Monte-Carlo Tree Search (MCTS) revolution. Before each move the go program simulate thousands of games and choose the one with best win ratio Several evolutions brought them up to dan level on 9x9 on 2008 CPUs : * UCT : which balances the Monte Carlo Tree exploration of known nodes vs new nodes * RAVE / AMAF : if a move is good later, consider it good also as the first move * Integration of heuristics and patterns that influence the Monte-Carlo Tree Search Thanks to the statistical approach, programs were much stronger in fights.
  3. Third was the DCNNs (Deep Convolutional Neural Network) Those are used in combination with MCTS to direct the search to the most promising moves.

State

RustyGo was started back in October and is currently compilable but buggy as hell, it might as well play random moves. Also everything is in one file because I was in "hack away" mode and didn't learn how to split a projects into modules.

Interesting repos

Future

Roadmap:

Huge brain dump alert: optimization to think of in no particular order

Compilation:

Vectorization

AVX-512 board size

Localization / Branch Prediction / Cache

Randomization / MCTS optimization

Data structure research

Need fast delete of Early Nodes, traversal from leaf to start, very fast append, lock-free, parallelizable, cacheable, low memory use, max of O(1) operations Board? Fixed Size Struct? Array by macro? Integer parametrized struct for different board size (not possible yet)

Some interesting things to explore

Optimization that can help

Other stuff

Machine Learning

Algorithms

Consumption (of trees and iterators/vectors)

Parallelism

Hashing

Zobrist

Heuristics

Memory

Unit tests

Size of Intersection enum

Board setup: