This environment is part of the classic environments. Please read that page first for general information.
|Observation Shape||(170, 170, 3)|
|Observation Values||[0, 1]|
Go is a board game with 2 players, black and white. The black player starts by placing a black stone at an empty board intersection. The white player follows by placing a stone of their own, aiming to either surround more territory than their opponent or capture the opponent’s stones. The game ends if both players sequentially decide to pass.
Our implementation is a wrapper for MiniGo.
Go takes two optional arguments that define the board size (int) and komi compensation points (float). The default values for the board size and komi are 19 and 7.5, respectively.
g0_v1.env(board_size = 13, komi = 7.5)
g0_v1.env() # with default values
The observation is a dictionary which contains an
'obs' element which is the usual RL observation described below, and an
'action_mask' which holds the legal moves, described in the Legal Actions Mask section.
The main observation shape is a function of the board size N and has a shape of (N, N, 3). The first plane, (:, :, 0), represent the stones on the board for the current player while the second plane, (:, :, 1), encodes the stones of the opponent. The third plane, (:, :, 2), is all 1 if the current player is
black_0 or all 0 if the player is
white_0. The state of the board is represented with the top left corner as (0, 0). For example, a (9, 9) board is
0 1 2 3 4 5 6 7 8 0 . . . . . . . . . 0 1 . . . . . . . . . 1 2 . . . . . . . . . 2 3 . . . . . . . . . 3 4 . . . . . . . . . 4 5 . . . . . . . . . 5 6 . . . . . . . . . 6 7 . . . . . . . . . 7 8 . . . . . . . . . 8 0 1 2 3 4 5 6 7 8
|0||Current Player’s stones
|1||Opponent Player’s stones
While rendering, the board coordinate system is GTP.
The legal moves available to the current agent are found in the
action_mask element of the dictionary observation. The
action_mask is a binary vector where each index of the vector represents whether the action is legal or not. The
action_mask will be all zeros for any agent except the one whos turn it is. Taking an illegal move ends the game with a reward of -1 for the illegally moving agent and a reward of 0 for all other agents.
Similar to the observation space, the action space is dependent on the board size N.
|Place a stone on the 1st row of the board.
|Place a stone on the 2nd row of the board.
|Place a stone on the Nth row of the board.
For example, you would use action
4 to place a stone on the board at the (0,3) location or action
N^2 to pass. You can transform a non-pass action
a back into its 2D (x,y) coordinate by computing
(a//N, a%N) The total action space is .