X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=fb0a32f3acf29c56d7231d59b15baeda3c092031;hb=0363b5435847e66678cd3fa0d8a94e30b9a91663;hp=021113ed7ded96ad2e99c243e356b2ce271cc6ae;hpb=4ce08482c3b0685691162bfc9115ccc7656674b4;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 021113ed..fb0a32f3 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -71,10 +71,16 @@ struct PieceLetters : std::map { } }; + //// -//// Variables +//// Constants and variables //// +/// Bonus for having the side to move (modified by Joona Kiiski) + +static const Score TempoValue = make_score(48, 22); + + Key Position::zobrist[2][8][64]; Key Position::zobEp[64]; Key Position::zobCastle[16]; @@ -889,7 +895,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI st->value += pst(us, promotion, to); // Update material - st->npMaterial[us] += piece_value_midgame(promotion); + st->npMaterial[us] += PieceValueMidgame[promotion]; } } @@ -962,7 +968,7 @@ void Position::do_capture_move(Key& key, PieceType capture, Color them, Square t st->pawnKey ^= zobrist[them][PAWN][capsq]; } else - st->npMaterial[them] -= piece_value_midgame(capture); + st->npMaterial[them] -= PieceValueMidgame[capture]; // Remove captured piece clear_bit(&(byColorBB[them]), capsq); @@ -1658,7 +1664,7 @@ Key Position::compute_material_key() const { /// updated by do_move and undo_move when the program is running in debug mode. Score Position::compute_value() const { - Score result = make_score(0, 0); + Score result = SCORE_ZERO; Bitboard b; Square s; @@ -1686,7 +1692,7 @@ Score Position::compute_value() const { Value Position::compute_non_pawn_material(Color c) const { - Value result = Value(0); + Value result = VALUE_ZERO; for (PieceType pt = KNIGHT; pt <= QUEEN; pt++) { @@ -1694,8 +1700,9 @@ Value Position::compute_non_pawn_material(Color c) const { while (b) { assert(piece_on(first_1(b)) == piece_of_color_and_type(c, pt)); + pop_1st_bit(&b); - result += piece_value_midgame(pt); + result += PieceValueMidgame[pt]; } } return result;