Finds the advantage a particular side possesses given a value scheme.

        :type: input_color: Color
        :type: val_scheme: PieceValues
        :rtype: double
499062
def material_advantage(self, input_color, val_scheme):
        

        if self.get_king(input_color).in_check(self) and self.no_moves(input_color):
            return -100

        if self.get_king(-input_color).in_check(self) and self.no_moves(-input_color):
            return 100

        return sum([val_scheme.val(piece, input_color) for piece in self])
594763
private double doubleValueRightColor( double left, double color ) {
        return rgba( doubleValue( left, red( color ) ), //
                        doubleValue( left, green( color ) ), //
                        doubleValue( left, blue( color ) ), 1 );
    }
806338
def _calc_all_possible_moves(self, input_color):
        
        for piece in self:

            # Tests if square on the board is not empty
            if piece is not None and piece.color == input_color:

                for move in piece.possible_moves(self):

                    test = cp(self)
                    test_move = Move(end_loc=move.end_loc,
                                     piece=test.piece_at_square(move.start_loc),
                                     status=move.status,
                                     start_loc=move.start_loc,
                                     promoted_to_piece=move.promoted_to_piece)
                    test.update(test_move)

                    if self.king_loc_dict is None:
                        yield move
                        continue

                    my_king = test.piece_at_square(self.king_loc_dict[input_color])

                    if my_king is None or \
                            not isinstance(my_king, King) or \
                            my_king.color != input_color:
                        self.king_loc_dict[input_color] = test.find_king(input_color)
                        my_king = test.piece_at_square(self.king_loc_dict[input_color])

                    if not my_king.in_check(test):
                        yield move
1346117
def value_left(self, other):
    
    return other.value if isinstance(other, self.__class__) else other
859575
def getColorForValue(self, value):
        
        rampIndex = 0

        if value >= self.min and value <= self.max:
            rampIndex = self.getIndexForValue(value)

        elif value > self.max:
            rampIndex = -1

        elif value < self.min:
            rampIndex = 0

        return self.getColorForIndex(rampIndex)
1029211
def value(self):
        '''
        
        '''
        (counter_type, value) = win32pdh.GetFormattedCounterValue(
            self.handle, win32pdh.PDH_FMT_DOUBLE)
        self.type = counter_type
        return value
488623
def i2len(self, pkt, val):
        """"""
        fld_len = self._fld.i2len(pkt, val)
        return fld_len + self.padlen(fld_len)
930426
def Plus(self, other):
    
    return Point(self.x + other.x,
                 self.y + other.y,
                 self.z + other.z)
1260996
def Q(self, value):
        
        self._Q = value
        self._Q1_2 = cholesky(self._Q, lower=True)
599037
def inasafe_place_value_coefficient(number, feature, parent):
    
    _ = feature, parent  # NOQA

    if number >= 0:
        rounded_number = round_affected_number(
            number,
            use_rounding=True,
            use_population_rounding=True
        )
        min_number = 1000
        value, unit = denomination(rounded_number, min_number)
        if number < min_number:
            rounded_number = int(round(value, 1))
        else:
            rounded_number = round(value, 1)
        return str(rounded_number)
    else:
        return None
196783
def attackers(self, color: Color, square: Square) -> "SquareSet":
        
        return SquareSet(self.attackers_mask(color, square))
444832
def value(self):
        
        wishart = self._wishart_cdf

        # Prepare variables for integration algorithm
        A = self.A
        p = self._gammainc_a
        g = gamma(wishart.alpha_vec)
        q_ind = np.arange(2 * wishart.n_min - 2)
        q_vec = 2 * wishart.alpha + q_ind + 2
        q = np.float_power(0.5, q_vec) * gamma(q_vec) * gammainc(q_vec, self._chisq_val)

        # Perform integration (i.e. calculate Pfaffian CDF)
        for i in xrange(wishart.n_min):
            # TODO consider index tricks instead of iteration here
            b = 0.5 * p[i] * p[i]
            for j in xrange(i, wishart.n_min - 1):
                b -= q[i + j] / (g[i] * g[j + 1])
                A[j + 1, i] = p[i] * p[j + 1] - 2 * b
                A[i, j + 1] = -A[j + 1, i]

        if np.any(np.isnan(A)):
            return 0
        return np.sqrt(det(A))
637693
def Difference(left: vertex_constructor_param_types, right: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex:
    
    return Double(context.jvm_view().DifferenceVertex, label, cast_to_double_vertex(left), cast_to_double_vertex(right))
230195
def val(self, piece, ref_color):
        
        if piece is None:
            return 0

        if ref_color == piece.color:
            const = 1
        else:
            const = -1

        if isinstance(piece, Pawn):
            return self.PAWN_VALUE * const
        elif isinstance(piece, Queen):
            return self.QUEEN_VALUE * const
        elif isinstance(piece, Bishop):
            return self.BISHOP_VALUE * const
        elif isinstance(piece, Rook):
            return self.ROOK_VALUE * const
        elif isinstance(piece, Knight):
            return self.KNIGHT_VALUE * const
        elif isinstance(piece, King):
            return self.KING_VALUE * const
        return 0
977177
def defValueFuncs(self):
        '''
        
        '''
        MPCnvrs      = self.MPC**(-self.CRRA/(1.0-self.CRRA))
        vFuncNvrs    = LinearInterp(np.array([self.mNrmMin, self.mNrmMin+1.0]),np.array([0.0, MPCnvrs]))
        self.vFunc   = ValueFunc(vFuncNvrs,self.CRRA)
        self.vPfunc  = MargValueFunc(self.cFunc,self.CRRA)
161916
def rev_twos_comp_repr(val, bitwidth):
    
    valbl = val.bit_length()
    if bitwidth < val.bit_length() or val == 2**(bitwidth-1):
        raise pyrtl.PyrtlError("please choose a larger target bitwidth")
    if bitwidth == valbl:  # MSB is a 1, value is negative
        return -((~val & (2**bitwidth-1)) + 1)  # flip the bits, add one, and make negative
    else:
        return val
568505
def gt(self, value):
        
        self.op = '>'
        self.negate_op = '<='
        self.value = self._value(value)
        return self