alphagozero_agent.py

Finally, we implement the agent that acts as the interface between the Go games and the algorithms. The main class we will implement is called AlphaGoZeroAgent. Again, this class combines PolicyValueNetwork with our MCTS module, as is done in AlphaGo Zero, to select moves and simulate games. Note that any missing modules (for example, go.py, which implements the game of Go itself) can be found in the main GitHub repository:

import loggingimport osimport randomimport timeimport numpy as npimport goimport utilsfrom config import GLOBAL_PARAMETER_STORE, GOPARAMETERSfrom mcts import MCTreeSearchNodefrom utils import make_sgflogger = logging.getLogger(__name__)class AlphaGoZeroAgent:    def __init__(self, network, player_v_player ...

Get Python Reinforcement Learning Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.