Adding New Games

When adding support for a new game, we recommend that you follow a few conventions that will enable it to work with the game-agnostic utilities in the scripts folder (such as scripts/alphazero.jl).

First, create a your-game directory in games. The name of this directory will be used as a string identifier for your game by various scripts. In this directory, create a main.jl file that defines a module YourGame according to the following template:

module YourGame
  export Game, Board
  module Training
    using AlphaZero

By convention, the name of your module should be the transposition of the game directory's name in upper snake case. Also:

  • games/your-game/game.jl should define your Game type, following the Game Interface
  • games/your-game/params.jl should define params, Network, netparams and benchmark as explained in the Connect Four Tutorial.

To register your game, just add "your-game" to AVAILABLE_GAMES in scripts/games.jl. Then, we recommend that you run the test suite in test/test_game.jl to check that your game correctly implements the game interface and that every expected invariant is met. To do so, just run:

julia --project --color=yes scripts/alphazero.jl --game your-game check-game

Finally, you can launch a training session by running:

julia --project --color=yes scripts/alphazero.jl --game your-game train