From b20c1d3ff5e9751980d61b1ea40249868a8ff7dd Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 15 Oct 2021 18:42:27 +0200 Subject: [PATCH] Disable NNUE in case of virtual pieces --- src/position.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/position.h b/src/position.h index a8a523d..699d06c 100644 --- a/src/position.h +++ b/src/position.h @@ -345,6 +345,7 @@ private: bool tsumeMode; bool chess960; int pieceCountInHand[COLOR_NB][PIECE_TYPE_NB]; + int virtualPieces; Bitboard promotedPieces; void add_to_hand(Piece pc); void remove_from_hand(Piece pc); @@ -540,7 +541,7 @@ inline bool Position::nnue_use_pockets() const { inline bool Position::nnue_applicable() const { // Do not use NNUE during setup phases (placement, sittuyin) - return !count_in_hand(ALL_PIECES) || nnue_use_pockets(); + return (!count_in_hand(ALL_PIECES) || nnue_use_pockets()) && !virtualPieces; } inline bool Position::checking_permitted() const { @@ -1351,9 +1352,11 @@ inline void Position::drop_piece(Piece pc_hand, Piece pc_drop, Square s) { assert(pieceCountInHand[color_of(pc_hand)][type_of(pc_hand)] > 0 || var->twoBoards); put_piece(pc_drop, s, pc_drop != pc_hand, pc_drop != pc_hand ? pc_hand : NO_PIECE); remove_from_hand(pc_hand); + virtualPieces += (pieceCountInHand[color_of(pc_hand)][type_of(pc_hand)] < 0); } inline void Position::undrop_piece(Piece pc_hand, Square s) { + virtualPieces -= (pieceCountInHand[color_of(pc_hand)][type_of(pc_hand)] < 0); remove_piece(s); board[s] = NO_PIECE; add_to_hand(pc_hand); -- 1.7.0.4