X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=9f9069cdf67c318264353bb73e5f9d0d317c6627;hb=bb7713c8e92c9373f0294a4317101cccda0e17e5;hp=3f6400a80daeda5ae7f8af243726f138ff322a4b;hpb=c9d7e99de682516c560009b550c41da9ae2008b8;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 3f6400a8..9f9069cd 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -29,6 +29,7 @@ #include "position.h" #include "psqtab.h" #include "rkiss.h" +#include "thread.h" #include "tt.h" #include "ucioption.h" @@ -852,9 +853,8 @@ bool Position::move_is_check(Move m, const CheckInfo& ci) const { } -/// Position::do_setup_move() makes a permanent move on the board. -/// It should be used when setting up a position on board. -/// You can't undo the move. +/// Position::do_setup_move() makes a permanent move on the board. It should +/// be used when setting up a position on board. You can't undo the move. void Position::do_setup_move(Move m) { @@ -871,13 +871,14 @@ void Position::do_setup_move(Move m) { startPosPlyCounter++; // Our StateInfo newSt is about going out of scope so copy - // its content inside pos before it disappears. + // its content before it disappears. detach(); } + /// Position::do_move() makes a move, and saves all information necessary -/// to a StateInfo object. The move is assumed to be legal. -/// Pseudo-legal moves should be filtered out before this function is called. +/// to a StateInfo object. The move is assumed to be legal. Pseudo-legal +/// moves should be filtered out before this function is called. void Position::do_move(Move m, StateInfo& newSt) { @@ -1047,7 +1048,8 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI } // Prefetch pawn and material hash tables - prefetchTables(st->pawnKey, st->materialKey, threadID); + Threads[threadID].pawnTable.prefetch(st->pawnKey); + Threads[threadID].materialTable.prefetch(st->materialKey); // Update incremental scores st->value += pst_delta(piece, from, to); @@ -1840,13 +1842,15 @@ void Position::init_piece_square_tables() { } -/// Position::flipped_copy() makes a copy of the input position, but with -/// the white and black sides reversed. This is only useful for debugging, -/// especially for finding evaluation symmetry bugs. +/// Position::flip() flips position with the white and black sides reversed. This +/// is only useful for debugging especially for finding evaluation symmetry bugs. + +void Position::flip() { -void Position::flipped_copy(const Position& pos) { + assert(is_ok()); - assert(pos.is_ok()); + // Make a copy of current position before to start changing + const Position pos(*this, threadID); clear(); threadID = pos.thread();