From 686b45e12171dfde16576169814b80ac33b0157d Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 15 Feb 2015 12:20:47 +0100 Subject: [PATCH] Retire one do_move() overload After Lucas patch it is almost useless. No functional change. --- src/position.cpp | 8 +------- src/position.h | 1 - src/search.cpp | 4 ++-- src/uci.cpp | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index efc71db8..9db41b78 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -684,12 +684,6 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const { /// 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) { - - CheckInfo ci(*this); - do_move(m, newSt, gives_check(m, ci)); -} - void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { assert(is_ok(m)); @@ -848,7 +842,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { // Update the key with the final value st->key = k; - // Calculate checkers bitboard (if move is check) + // Calculate checkers bitboard (if move gives check) st->checkersBB = givesCheck ? attackers_to(king_square(them)) & pieces(us) : 0; sideToMove = ~sideToMove; diff --git a/src/position.h b/src/position.h index f8f61b55..ece3f442 100644 --- a/src/position.h +++ b/src/position.h @@ -138,7 +138,6 @@ public: bool opposite_bishops() const; // Doing and undoing moves - void do_move(Move m, StateInfo& st); void do_move(Move m, StateInfo& st, bool givesCheck); void undo_move(Move m); void do_null_move(StateInfo& st); diff --git a/src/search.cpp b/src/search.cpp index 3f9e29da..9d7c1ef6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1474,7 +1474,7 @@ void RootMove::insert_pv_in_tt(Position& pos) { if (!ttHit || tte->move() != m) // Don't overwrite correct entries tte->save(pos.key(), VALUE_NONE, BOUND_NONE, DEPTH_NONE, m, VALUE_NONE, TT.generation()); - pos.do_move(m, *st++); + pos.do_move(m, *st++, pos.gives_check(m, CheckInfo(pos))); } for (size_t i = pv.size(); i > 0; ) @@ -1494,7 +1494,7 @@ bool RootMove::extract_ponder_from_tt(Position& pos) assert(pv.size() == 1); - pos.do_move(pv[0], st); + pos.do_move(pv[0], st, pos.gives_check(pv[0], CheckInfo(pos))); TTEntry* tte = TT.probe(pos.key(), ttHit); pos.undo_move(pv[0]); diff --git a/src/uci.cpp b/src/uci.cpp index ff3a64ec..b7127b75 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -74,7 +74,7 @@ namespace { while (is >> token && (m = UCI::to_move(pos, token)) != MOVE_NONE) { SetupStates->push(StateInfo()); - pos.do_move(m, SetupStates->top()); + pos.do_move(m, SetupStates->top(), pos.gives_check(m, CheckInfo(pos))); } } -- 2.39.2