diff --git a/src/history.h b/src/history.h index 4543fc55..654ee19f 100644 --- a/src/history.h +++ b/src/history.h @@ -54,10 +54,6 @@ inline int pawn_structure_index(const Position& pos) { return pos.pawn_key() & ((T == Normal ? PAWN_HISTORY_SIZE : CORRECTION_HISTORY_SIZE) - 1); } -inline int major_piece_index(const Position& pos) { - return pos.major_piece_key() & (CORRECTION_HISTORY_SIZE - 1); -} - inline int minor_piece_index(const Position& pos) { return pos.minor_piece_key() & (CORRECTION_HISTORY_SIZE - 1); } @@ -136,7 +132,6 @@ using PawnHistory = Statskey = st->materialKey = 0; - st->majorPieceKey = st->minorPieceKey = 0; st->nonPawnKey[WHITE] = st->nonPawnKey[BLACK] = 0; st->pawnKey = Zobrist::noPawns; st->nonPawnMaterial[WHITE] = st->nonPawnMaterial[BLACK] = VALUE_ZERO; @@ -360,16 +359,12 @@ void Position::set_state() const { { st->nonPawnMaterial[color_of(pc)] += PieceValue[pc]; - if (type_of(pc) >= ROOK) - st->majorPieceKey ^= Zobrist::psq[pc][s]; - - else + if (type_of(pc) <= BISHOP) st->minorPieceKey ^= Zobrist::psq[pc][s]; } else { - st->majorPieceKey ^= Zobrist::psq[pc][s]; st->minorPieceKey ^= Zobrist::psq[pc][s]; } } @@ -742,7 +737,6 @@ void Position::do_move(Move m, do_castling(us, from, to, rfrom, rto); k ^= Zobrist::psq[captured][rfrom] ^ Zobrist::psq[captured][rto]; - st->majorPieceKey ^= Zobrist::psq[captured][rfrom] ^ Zobrist::psq[captured][rto]; st->nonPawnKey[us] ^= Zobrist::psq[captured][rfrom] ^ Zobrist::psq[captured][rto]; captured = NO_PIECE; } @@ -773,10 +767,7 @@ void Position::do_move(Move m, st->nonPawnMaterial[them] -= PieceValue[captured]; st->nonPawnKey[them] ^= Zobrist::psq[captured][capsq]; - if (type_of(captured) >= ROOK) - st->majorPieceKey ^= Zobrist::psq[captured][capsq]; - - else + if (type_of(captured) <= BISHOP) st->minorPieceKey ^= Zobrist::psq[captured][capsq]; } @@ -858,10 +849,7 @@ void Position::do_move(Move m, st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion] - 1] ^ Zobrist::psq[pc][pieceCount[pc]]; - if (promotionType >= ROOK) - st->majorPieceKey ^= Zobrist::psq[promotion][to]; - - else + if (promotionType <= BISHOP) st->minorPieceKey ^= Zobrist::psq[promotion][to]; // Update material @@ -881,14 +869,10 @@ void Position::do_move(Move m, if (type_of(pc) == KING) { - st->majorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; st->minorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; } - else if (type_of(pc) >= ROOK) - st->majorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; - - else + else if (type_of(pc) <= BISHOP) st->minorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; } diff --git a/src/position.h b/src/position.h index d955d9f9..53269c19 100644 --- a/src/position.h +++ b/src/position.h @@ -43,7 +43,6 @@ struct StateInfo { // Copied when making a move Key materialKey; Key pawnKey; - Key majorPieceKey; Key minorPieceKey; Key nonPawnKey[COLOR_NB]; Value nonPawnMaterial[COLOR_NB]; @@ -154,7 +153,6 @@ class Position { Key key() const; Key material_key() const; Key pawn_key() const; - Key major_piece_key() const; Key minor_piece_key() const; Key non_pawn_key(Color c) const; @@ -305,8 +303,6 @@ inline Key Position::pawn_key() const { return st->pawnKey; } inline Key Position::material_key() const { return st->materialKey; } -inline Key Position::major_piece_key() const { return st->majorPieceKey; } - inline Key Position::minor_piece_key() const { return st->minorPieceKey; } inline Key Position::non_pawn_key(Color c) const { return st->nonPawnKey[c]; } diff --git a/src/search.cpp b/src/search.cpp index 31620188..e07c719e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -87,7 +87,6 @@ int correction_value(const Worker& w, const Position& pos, const Stack* ss) { const Color us = pos.side_to_move(); const auto m = (ss - 1)->currentMove; const auto pcv = w.pawnCorrectionHistory[us][pawn_structure_index(pos)]; - const auto macv = w.majorPieceCorrectionHistory[us][major_piece_index(pos)]; const auto micv = w.minorPieceCorrectionHistory[us][minor_piece_index(pos)]; const auto wnpcv = w.nonPawnCorrectionHistory[WHITE][non_pawn_index(pos)][us]; const auto bnpcv = w.nonPawnCorrectionHistory[BLACK][non_pawn_index(pos)][us]; @@ -95,7 +94,7 @@ int correction_value(const Worker& w, const Position& pos, const Stack* ss) { m.is_ok() ? (*(ss - 2)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()] : 0; - return (6922 * pcv + 3837 * macv + 6238 * micv + 7490 * (wnpcv + bnpcv) + 6270 * cntcv); + return (7000 * pcv + 6300 * micv + 7550 * (wnpcv + bnpcv) + 6320 * cntcv); } // Add correctionHistory value to raw staticEval and guarantee evaluation @@ -516,7 +515,6 @@ void Search::Worker::clear() { captureHistory.fill(-631); pawnHistory.fill(-1210); pawnCorrectionHistory.fill(0); - majorPieceCorrectionHistory.fill(0); minorPieceCorrectionHistory.fill(0); nonPawnCorrectionHistory[WHITE].fill(0); nonPawnCorrectionHistory[BLACK].fill(0); @@ -1439,7 +1437,6 @@ moves_loop: // When in check, search starts here -CORRECTION_HISTORY_LIMIT / 4, CORRECTION_HISTORY_LIMIT / 4); thisThread->pawnCorrectionHistory[us][pawn_structure_index(pos)] << bonus * 114 / 128; - thisThread->majorPieceCorrectionHistory[us][major_piece_index(pos)] << bonus * 163 / 128; thisThread->minorPieceCorrectionHistory[us][minor_piece_index(pos)] << bonus * 146 / 128; thisThread->nonPawnCorrectionHistory[WHITE][non_pawn_index(pos)][us] << bonus * nonPawnWeight / 128; diff --git a/src/search.h b/src/search.h index 3a1b3a77..326480e4 100644 --- a/src/search.h +++ b/src/search.h @@ -288,7 +288,6 @@ class Worker { PawnHistory pawnHistory; CorrectionHistory pawnCorrectionHistory; - CorrectionHistory majorPieceCorrectionHistory; CorrectionHistory minorPieceCorrectionHistory; CorrectionHistory nonPawnCorrectionHistory[COLOR_NB]; CorrectionHistory continuationCorrectionHistory;