Example #1
0
    def getMove(self, board):
        """
        Return best action according to self.evaluationFunction,
        with no lookahead.
        """
        v_best = 0
        a_best = None

        all_moves = board.getAllMoves(self.color)
        for a in all_moves:
            board.doMove(a)
            features = GameParser.getFeaturesForState(board)
            v = self.model.get_output(features)
            v = 1. - v if self.color == Color.BLACK else v
            if v > v_best:
                v_best = v
                a_best = a
            board.undoMove(a)
        return a_best