From 26271586cb2dcac34416033ed63ea0611731be0a Mon Sep 17 00:00:00 2001 From: Hisayori Noda Date: Mon, 24 Jun 2019 23:18:17 +0900 Subject: [PATCH] Added #if to fix compile errors. --- src/position.cpp | 7 ++++--- src/search.cpp | 10 +++++++--- src/tt.cpp | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index b7d5096f..91f3ab8e 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -773,8 +773,10 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { Piece pc = piece_on(from); Piece captured = type_of(m) == ENPASSANT ? make_piece(them, PAWN) : piece_on(to); +#if defined(EVAL_NNUE) PieceNumber piece_no0 = PIECE_NUMBER_NB; PieceNumber piece_no1 = PIECE_NUMBER_NB; +#endif // defined(EVAL_NNUE) assert(color_of(pc) == us); assert(captured == NO_PIECE || color_of(captured) == (type_of(m) != CASTLING ? them : us)); @@ -820,7 +822,9 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { #endif // defined(EVAL_NNUE) board[capsq] = NO_PIECE; // Not done by remove_piece() +#if defined(EVAL_NNUE) evalList.piece_no_list_board[capsq] = PIECE_NUMBER_NB; +#endif // defined(EVAL_NNUE) } else { #if defined(EVAL_NNUE) @@ -1473,9 +1477,6 @@ bool Position::pos_is_ok() const { #if defined(EVAL_NNUE) PieceNumber Position::piece_no_of(Square sq) const { - if (piece_on(sq) == NO_PIECE) { - sync_cout << *this << sync_endl; - } assert(piece_on(sq) != NO_PIECE); PieceNumber n = evalList.piece_no_of_board(sq); assert(is_ok(n)); diff --git a/src/search.cpp b/src/search.cpp index df88564a..b176e0b9 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1372,7 +1372,13 @@ moves_loop: // When in check, search starts from here prefetch(TT.first_entry(pos.key_after(move))); // Check for legality just before making the move - if (!pos.legal(move)) + if ( +#if defined(EVAL_LEARN) + // HACK: pos.piece_on(from_sq(m)) sometimes will be NO_PIECE during machine learning. + !pos.pseudo_legal(move) || +#endif // EVAL_LEARN + !pos.legal(move) + ) { moveCount--; continue; @@ -1382,9 +1388,7 @@ moves_loop: // When in check, search starts from here ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; // Make and search the move - //std::cout << pos << std::endl; pos.do_move(move, st, givesCheck); - //std::cout << pos << std::endl; value = -qsearch(pos, ss+1, -beta, -alpha, depth - ONE_PLY); pos.undo_move(move); diff --git a/src/tt.cpp b/src/tt.cpp index 0b2bf9e9..21309fd6 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -118,7 +118,7 @@ void TranspositionTable::clear() { /// TTEntry t2 if its replace value is greater than that of t2. TTEntry* TranspositionTable::probe(const Key key, bool& found) const { -#if defined(EVAL_LEARN) +#if defined(DISABLE_TT) return found = false, first_entry(0); #else