1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 01:03:09 +00:00

Allow to assign a Move to an ExtMove

After defining ExtMove::operator Move(), this is a
natural extension.

No fnctional change.
This commit is contained in:
Marco Costalba 2015-02-01 13:29:27 +01:00
parent 20d6a8e57f
commit e56e5045dd
2 changed files with 10 additions and 10 deletions

View file

@ -38,6 +38,7 @@ struct ExtMove {
Value value; Value value;
operator Move() const { return move; } operator Move() const { return move; }
void operator=(Move m) { move = m; }
}; };
inline bool operator<(const ExtMove& f, const ExtMove& s) { inline bool operator<(const ExtMove& f, const ExtMove& s) {

View file

@ -55,7 +55,7 @@ namespace {
inline Move pick_best(ExtMove* begin, ExtMove* end) inline Move pick_best(ExtMove* begin, ExtMove* end)
{ {
std::swap(*begin, *std::max_element(begin, end)); std::swap(*begin, *std::max_element(begin, end));
return begin->move; return *begin;
} }
} // namespace } // namespace
@ -202,12 +202,12 @@ void MovePicker::generate_next_stage() {
case KILLERS_S1: case KILLERS_S1:
cur = killers; cur = killers;
endMoves = cur + 6; endMoves = cur + 6;
killers[0].move = ss->killers[0]; killers[0] = ss->killers[0];
killers[1].move = ss->killers[1]; killers[1] = ss->killers[1];
killers[2].move = countermoves[0]; killers[2] = countermoves[0];
killers[3].move = countermoves[1]; killers[3] = countermoves[1];
killers[4].move = followupmoves[0]; killers[4] = followupmoves[0];
killers[5].move = followupmoves[1]; killers[5] = followupmoves[1];
break; break;
case QUIETS_1_S1: case QUIETS_1_S1:
@ -282,7 +282,7 @@ Move MovePicker::next_move<false>() {
return move; return move;
// Losing capture, move it to the tail of the array // Losing capture, move it to the tail of the array
(endBadCaptures--)->move = move; *endBadCaptures-- = move;
} }
break; break;
@ -293,8 +293,7 @@ Move MovePicker::next_move<false>() {
&& pos.pseudo_legal(move) && pos.pseudo_legal(move)
&& !pos.capture(move)) && !pos.capture(move))
{ {
// Check for duplicated entries for (int i = 0; i < cur - 1 - killers; i++) // Skip duplicated
for (int i = 0; i < cur - 1 - killers; i++)
if (move == killers[i]) if (move == killers[i])
goto skip; goto skip;
return move; return move;