Example #1
0
def rollout_node():
    model = mock_model.MockModel()
    # testing: model responds with all ones
    when(model).inference(...).thenReturn((np.ones(MOVE_TENSOR_SHAPE), 1))
    statemachine = state_machine.StateMachine()
    node = azts_node.AztsNode(statemachine, model)
    for i in range(10):
        node.rollout()
    return node
Example #2
0
 def _init_tree(self):
     '''
     keep this as separate function
     because it needs to be called
     after every move if tree is
     not reused
     '''
     self.root = azts_node.AztsNode(\
             statemachine=self.statemachine, \
             model=self.model, \
             color=self.color, \
             exploration=self.exploration, \
             payoffs=self.payoffs)
Example #3
0
def lose_node():
    model = mock_model.MockModel()
    statemachine = state_machine.StateMachine()
    statemachine.set_to_fen_state(WIN_STATE)
    node = azts_node.AztsNode(statemachine, model, WHITE)
    return node
Example #4
0
def stale_node():
    model = mock_model.MockModel()
    statemachine = state_machine.StateMachine()
    statemachine.set_to_fen_state(STALE_MATE)
    node = azts_node.AztsNode(statemachine, model, BLACK)
    return node
Example #5
0
def initial_node():
    model = mock_model.MockModel()
    statemachine = state_machine.StateMachine()
    node = azts_node.AztsNode(statemachine, model)
    return node