def heuristic(state):
    # type: (State) -> float
    """
    Estimate the value of this state: -1.0 is a certain win for player 2, 1.0 is a certain win for player 1

    :param state:
    :return: A heuristic evaluation for the given state (between -1.0 and 1.0)
    """
    return util.ratio_points(state, 1) * 2.0 - 1.0, None
Ejemplo n.º 2
0
def heuristic(state, leadcount):
    # type: (State, int) -> float
    """
    Estimate the value of this state: -1.0 is a certain win for player 2, 1.0 is a certain win for player 1
    :param state:
    :return: A heuristic evaluation for the given state (between -1.0 and 1.0)
    """

    leadcount_heuristic = leadcount / 10
    ratio_heuristic = util.ratio_points(state, 1) * 2.0 - 1.0

    if

    evaluation = leadcount_heuristic + ratio_heuristic

    return evaluation, None
Ejemplo n.º 3
0
 def heuristic(self, state, player):
     return util.ratio_points(state, player)
Ejemplo n.º 4
0
def heuristic(state):  # Returns value between 1.0 and -1.0 of given state according to heuristic evaluating whether player 1 or 2 is better off.
    return util.ratio_points(state, 1) * 2.0 - 1.0, None
Ejemplo n.º 5
0
    def Update(self, terminalState):
        """ Update this node - increment the visit count by one, and increase the win count by the result of terminalState for self.playerJustMoved.
		"""
        self.visits += 1
        if self.playerJustMoved is not None:
            self.wins += util.ratio_points(terminalState, self.playerJustMoved)
Ejemplo n.º 6
0
 def evaluation(self, state):
     return util.ratio_points(state, self.player)