From e56e5045dd48489a304e2b46d5461361b205b237 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 1 Feb 2015 13:29:27 +0100 Subject: [PATCH] Allow to assign a Move to an ExtMove After defining ExtMove::operator Move(), this is a natural extension. No fnctional change. --- src/movegen.h | 1 + src/movepick.cpp | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/movegen.h b/src/movegen.h index d46b8ddb..6a7f7e3a 100644 --- a/src/movegen.h +++ b/src/movegen.h @@ -38,6 +38,7 @@ struct ExtMove { Value value; operator Move() const { return move; } + void operator=(Move m) { move = m; } }; inline bool operator<(const ExtMove& f, const ExtMove& s) { diff --git a/src/movepick.cpp b/src/movepick.cpp index 69d848d2..27245ec7 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -55,7 +55,7 @@ namespace { inline Move pick_best(ExtMove* begin, ExtMove* end) { std::swap(*begin, *std::max_element(begin, end)); - return begin->move; + return *begin; } } // namespace @@ -202,12 +202,12 @@ void MovePicker::generate_next_stage() { case KILLERS_S1: cur = killers; endMoves = cur + 6; - killers[0].move = ss->killers[0]; - killers[1].move = ss->killers[1]; - killers[2].move = countermoves[0]; - killers[3].move = countermoves[1]; - killers[4].move = followupmoves[0]; - killers[5].move = followupmoves[1]; + killers[0] = ss->killers[0]; + killers[1] = ss->killers[1]; + killers[2] = countermoves[0]; + killers[3] = countermoves[1]; + killers[4] = followupmoves[0]; + killers[5] = followupmoves[1]; break; case QUIETS_1_S1: @@ -282,7 +282,7 @@ Move MovePicker::next_move() { return move; // Losing capture, move it to the tail of the array - (endBadCaptures--)->move = move; + *endBadCaptures-- = move; } break; @@ -293,8 +293,7 @@ Move MovePicker::next_move() { && pos.pseudo_legal(move) && !pos.capture(move)) { - // Check for duplicated entries - for (int i = 0; i < cur - 1 - killers; i++) + for (int i = 0; i < cur - 1 - killers; i++) // Skip duplicated if (move == killers[i]) goto skip; return move; -- 2.39.2