Unfortunately Leela Zero is one of the more difficult AI’s to install. You will need some developer tools to compile the source code. I can give you step by step instruction for how I installed LZ on a Mac operating system, perhaps some other good Samaritan can do the same for Windows.
Step 1: Get Xcode (this takes up about 10GB of space, but it’s free and afterwards you can uninstall it again)
Xcode comes with the gcc compiler that you need to install LZ.
Step 2: Get homebrew. The easiest way to install this, is by opening Terminal (located in Applications > Utilities) and paste the following code and press enter:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew is a command line tool, so that you can install LZ easily with a command in terminal. It will ask for a confirmation (press enter) and the password to your account, after which it will start installing (might take a while).
Step 3: Go back to terminal and paste the following code in there:
git clone https://github.com/gcp/leela-zero Documents/Go/leela-zero
brew install boost
curl -O http://zero.sjeng.org/best-network
To explain what all of this is: the first line line downloads the leela-zero source code from github to a folder called leela-zero, inside a folder Go inside your Documents folder, the second line moves terminal inside the leela-zero folder for the installation, the third line installs boost which will make your leela-zero, then the fourth line simply makes your executable and the fifth and last line downloads the latest good network from the sjeng website into the src folder of leela-zero.
Step 4: Test if everything works by typing the following in terminal:
./leelaz --weights best-network
After pressing enter, Leela Zero should start up, which takes a few seconds, and then should display a text version of a goban. If this happens, you know it installed correctly! You can now quit terminal, if you like.
Step 5: Go to the folder Documents/Go/leela-zero/src (you can use finder for this). There should be a file called “best-network” and a file called “leelaz”. I would recommend moving these files to where you want them to live (in my case I put them in the Documents/Go folder directly). Make sure you put both of them in the same folder, though. After you moved them out of the leela-zero folder you can delete the rest of the leela-zero folder: you don’t need it anymore.
Step 6: Now open Sabaki, and open the Manage Engines menu (under Engines in the menubar). Add a new engine with the button, give it the name Leela Zero (or another name of your choosing). Then click on the folder icon and find & open the “leelaz” you just moved in step 5. Finally in the line which should say “No arguments” paste the following code:
-g --weights best-network
You could choose to add more arguments as well (just write them at the end). Some of my favourites are
which stops Leela from heating up your cpu when it’s your turn (it also weakens Leela, since she now only thinks during her own turn),
which limits Leela to search only 150 playouts deep and thus makes it a little more speedy, and at my level still plenty strong enough to beat me to pulp.
which stops Leela from resigning when she’s losing too much (probably not necessary, but useful if you want to force Leela to keep playing a game she considers hopelessly lost)
Now you can close the Manage Engines window in Sabaki. Then you go to “Attach…” (also under the Engines menu) and attach Leela to one of the players by clicking on one of the triangles next to the Black / White player names. It should now start playing for that player. If you want to follow what Leela thinks, you can toggle the GTP console (also under the Engines menu), and there should be a console that shows things like which moves Leela considers, and winning percentage. If you want Leela to stop playing (for example to play something out yourself), you can select “Detach” from the Engines menu.
Step 7: You can uninstall Xcode again. Probably the easiest way to do this, is by pasting the following in terminal:
sudo /Developer/Library/uninstall-devtools --mode=all
It will ask you for your password, which you can type and press enter again to uninstall.