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
include("game.jl")
module Training
using AlphaZero
include("params.jl")
end
end
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 yourGame
type, following the Game Interfacegames/your-game/params.jl
should defineparams
,Network
,netparams
andbenchmark
as explained in the Connect Four Tutorial.
Finally, to register your game, just add "your-game"
to AVAILABLE_GAMES
in scripts/games.jl
. If you've done everything correctly, you should be able to launch a training session for your game by running:
julia --project --color=yes scripts/alphazero.jl --game your-game train