2008-08-31 23:59:13 -06:00
|
|
|
/*
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
|
|
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
|
2016-01-02 02:43:25 -07:00
|
|
|
Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
|
2017-01-11 00:46:29 -07:00
|
|
|
Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish is free software: you can redistribute it and/or modify
|
2008-08-31 23:59:13 -06:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2008-10-25 08:28:24 -06:00
|
|
|
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish is distributed in the hope that it will be useful,
|
2008-08-31 23:59:13 -06:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2008-10-25 08:28:24 -06:00
|
|
|
|
2008-08-31 23:59:13 -06:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
#include "movepick.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2013-07-21 01:54:56 -06:00
|
|
|
enum Stages {
|
2016-09-15 00:38:20 -06:00
|
|
|
MAIN_SEARCH, CAPTURES_INIT, GOOD_CAPTURES, KILLERS, COUNTERMOVE, QUIET_INIT, QUIET, BAD_CAPTURES,
|
|
|
|
EVASION, EVASIONS_INIT, ALL_EVASIONS,
|
|
|
|
PROBCUT, PROBCUT_INIT, PROBCUT_CAPTURES,
|
|
|
|
QSEARCH_WITH_CHECKS, QCAPTURES_1_INIT, QCAPTURES_1, QCHECKS,
|
|
|
|
QSEARCH_NO_CHECKS, QCAPTURES_2_INIT, QCAPTURES_2,
|
|
|
|
QSEARCH_RECAPTURES, QRECAPTURES
|
2009-08-31 06:28:11 -06:00
|
|
|
};
|
|
|
|
|
2017-04-22 01:03:17 -06:00
|
|
|
// partial_insertion_sort() sorts moves in descending order up to and including
|
|
|
|
// a given limit. The order of moves smaller than the limit is left unspecified.
|
|
|
|
void partial_insertion_sort(ExtMove* begin, ExtMove* end, int limit) {
|
|
|
|
|
2017-05-07 21:14:23 -06:00
|
|
|
for (ExtMove *sortedEnd = begin, *p = begin + 1; p < end; ++p)
|
2017-04-20 12:15:48 -06:00
|
|
|
if (p->value >= limit)
|
|
|
|
{
|
|
|
|
ExtMove tmp = *p, *q;
|
2017-05-07 21:14:23 -06:00
|
|
|
*p = *++sortedEnd;
|
|
|
|
for (q = sortedEnd; q != begin && *(q - 1) < tmp; --q)
|
|
|
|
*q = *(q - 1);
|
2017-04-20 12:15:48 -06:00
|
|
|
*q = tmp;
|
|
|
|
}
|
2013-02-10 11:10:01 -07:00
|
|
|
}
|
|
|
|
|
2015-02-01 02:59:01 -07:00
|
|
|
// pick_best() finds the best move in the range (begin, end) and moves it to
|
|
|
|
// the front. It's faster than sorting all the moves in advance when there
|
2016-01-16 14:34:29 -07:00
|
|
|
// are few moves, e.g., the possible captures.
|
2017-04-22 01:03:17 -06:00
|
|
|
Move pick_best(ExtMove* begin, ExtMove* end) {
|
|
|
|
|
|
|
|
std::swap(*begin, *std::max_element(begin, end));
|
|
|
|
return *begin;
|
2011-07-14 05:12:49 -06:00
|
|
|
}
|
2015-02-01 02:59:01 -07:00
|
|
|
|
2014-11-01 14:35:10 -06:00
|
|
|
} // namespace
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2012-01-21 15:32:48 -07:00
|
|
|
|
|
|
|
/// Constructors of the MovePicker class. As arguments we pass information
|
2013-12-04 23:18:12 -07:00
|
|
|
/// to help it to return the (presumably) good moves first, to decide which
|
2008-08-31 23:59:13 -06:00
|
|
|
/// moves to return (in the quiescence search, for instance, we only want to
|
2016-01-16 14:34:29 -07:00
|
|
|
/// search captures, promotions, and some checks) and how important good move
|
2013-12-04 23:18:12 -07:00
|
|
|
/// ordering is at the current node.
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2017-08-21 10:59:24 -06:00
|
|
|
/// MovePicker constructor for the main search
|
2017-06-30 09:20:00 -06:00
|
|
|
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh,
|
|
|
|
const PieceToHistory** ch, Move cm, Move* killers_p)
|
|
|
|
: pos(p), mainHistory(mh), contHistory(ch), countermove(cm),
|
|
|
|
killers{killers_p[0], killers_p[1]}, depth(d){
|
2009-08-31 06:28:11 -06:00
|
|
|
|
2011-01-23 14:59:05 -07:00
|
|
|
assert(d > DEPTH_ZERO);
|
|
|
|
|
2015-07-19 03:25:14 -06:00
|
|
|
stage = pos.checkers() ? EVASION : MAIN_SEARCH;
|
|
|
|
ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
|
2016-09-10 13:37:36 -06:00
|
|
|
stage += (ttMove == MOVE_NONE);
|
2011-01-23 14:59:05 -07:00
|
|
|
}
|
|
|
|
|
2017-08-21 10:59:24 -06:00
|
|
|
/// MovePicker constructor for quiescence search
|
|
|
|
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh, Square s)
|
|
|
|
: pos(p), mainHistory(mh) {
|
2011-01-23 14:59:05 -07:00
|
|
|
|
|
|
|
assert(d <= DEPTH_ZERO);
|
|
|
|
|
2014-04-06 02:50:27 -06:00
|
|
|
if (pos.checkers())
|
2013-07-21 01:54:56 -06:00
|
|
|
stage = EVASION;
|
2012-01-21 05:43:24 -07:00
|
|
|
|
2012-01-22 03:57:42 -07:00
|
|
|
else if (d > DEPTH_QS_NO_CHECKS)
|
2015-06-04 04:25:49 -06:00
|
|
|
stage = QSEARCH_WITH_CHECKS;
|
2012-01-21 05:43:24 -07:00
|
|
|
|
2012-01-22 03:57:42 -07:00
|
|
|
else if (d > DEPTH_QS_RECAPTURES)
|
2016-09-15 00:38:20 -06:00
|
|
|
stage = QSEARCH_NO_CHECKS;
|
2008-11-15 05:00:56 -07:00
|
|
|
|
2011-06-12 00:25:51 -06:00
|
|
|
else
|
|
|
|
{
|
2016-09-15 00:38:20 -06:00
|
|
|
stage = QSEARCH_RECAPTURES;
|
2014-04-06 02:50:27 -06:00
|
|
|
recaptureSquare = s;
|
2016-09-10 13:37:36 -06:00
|
|
|
return;
|
2011-06-12 00:25:51 -06:00
|
|
|
}
|
2010-01-29 08:47:04 -07:00
|
|
|
|
2015-07-19 03:25:14 -06:00
|
|
|
ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
|
2016-09-10 13:37:36 -06:00
|
|
|
stage += (ttMove == MOVE_NONE);
|
2008-08-31 23:59:13 -06:00
|
|
|
}
|
|
|
|
|
2017-08-21 10:59:24 -06:00
|
|
|
/// MovePicker constructor for ProbCut: we generate captures with SEE higher
|
|
|
|
/// than or equal to the given threshold.
|
2016-04-17 08:14:07 -06:00
|
|
|
MovePicker::MovePicker(const Position& p, Move ttm, Value th)
|
|
|
|
: pos(p), threshold(th) {
|
2011-05-21 10:17:11 -06:00
|
|
|
|
2012-12-25 09:59:35 -07:00
|
|
|
assert(!pos.checkers());
|
2011-05-21 10:17:11 -06:00
|
|
|
|
2014-02-15 14:17:58 -07:00
|
|
|
stage = PROBCUT;
|
2015-07-19 03:25:14 -06:00
|
|
|
ttMove = ttm
|
|
|
|
&& pos.pseudo_legal(ttm)
|
|
|
|
&& pos.capture(ttm)
|
2017-04-22 01:03:17 -06:00
|
|
|
&& pos.see_ge(ttm, threshold) ? ttm : MOVE_NONE;
|
2011-05-21 10:17:11 -06:00
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
stage += (ttMove == MOVE_NONE);
|
2008-08-31 23:59:13 -06:00
|
|
|
}
|
|
|
|
|
2017-08-09 06:04:59 -06:00
|
|
|
/// score() assigns a numerical value to each move in a list, used for sorting.
|
|
|
|
/// Captures are ordered by Most Valuable Victim (MVV), preferring captures
|
|
|
|
/// near our home rank. Quiets are ordered using the histories.
|
2017-08-21 10:59:24 -06:00
|
|
|
template<GenType Type>
|
2017-08-09 06:04:59 -06:00
|
|
|
void MovePicker::score() {
|
2008-10-25 08:28:24 -06:00
|
|
|
|
2017-08-21 10:59:24 -06:00
|
|
|
static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");
|
|
|
|
|
2015-05-01 18:36:39 -06:00
|
|
|
for (auto& m : *this)
|
2017-08-21 10:59:24 -06:00
|
|
|
if (Type == CAPTURES)
|
|
|
|
m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
|
|
|
|
- Value(200 * relative_rank(pos.side_to_move(), to_sq(m)));
|
|
|
|
|
|
|
|
else if (Type == QUIETS)
|
2017-08-09 06:04:59 -06:00
|
|
|
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
|
|
|
|
+ (*contHistory[0])[pos.moved_piece(m)][to_sq(m)]
|
|
|
|
+ (*contHistory[1])[pos.moved_piece(m)][to_sq(m)]
|
|
|
|
+ (*contHistory[3])[pos.moved_piece(m)][to_sq(m)];
|
|
|
|
|
2017-08-21 10:59:24 -06:00
|
|
|
else // Type == EVASIONS
|
|
|
|
{
|
|
|
|
if (pos.capture(m))
|
|
|
|
m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
|
|
|
|
- Value(type_of(pos.moved_piece(m)));
|
|
|
|
else
|
|
|
|
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] - (1 << 28);
|
|
|
|
}
|
2008-08-31 23:59:13 -06:00
|
|
|
}
|
|
|
|
|
2013-02-03 01:52:39 -07:00
|
|
|
/// next_move() is the most important method of the MovePicker class. It returns
|
2013-12-02 15:47:38 -07:00
|
|
|
/// a new pseudo legal move every time it is called, until there are no more moves
|
2014-03-23 01:52:42 -06:00
|
|
|
/// left. It picks the move with the biggest value from a list of generated moves
|
2014-01-26 15:09:22 -07:00
|
|
|
/// taking care not to return the ttMove if it has already been searched.
|
Lazy SMP
Start all threads searching on root position and
use only the shared TT table as synching scheme.
It seems this scheme scales better than YBWC for
high number of threads.
Verified for nor regression at STC 3 threads
LLR: -2.95 (-2.94,2.94) [-3.00,1.00]
Total: 40232 W: 6908 L: 7130 D: 26194
Verified for nor regression at LTC 3 threads
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 28186 W: 3908 L: 3798 D: 20480
Verified for nor regression at STC 7 threads
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 3607 W: 674 L: 526 D: 2407
Verified for nor regression at LTC 7 threads
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 4235 W: 671 L: 528 D: 3036
Tested with fixed games at LTC with 20 threads
ELO: 44.75 +-7.6 (95%) LOS: 100.0%
Total: 2069 W: 407 L: 142 D: 1520
Tested with fixed games at XLTC (120secs) with 20 threads
ELO: 28.01 +-6.7 (95%) LOS: 100.0%
Total: 2275 W: 349 L: 166 D: 1760
Original patch of mbootsector, with additional work
from Ivan Ivec (log formula), Joerg Oster (id loop
simplification) and Marco Costalba (assorted formatting
and rework).
Bench: 8116244
2015-10-06 00:15:17 -06:00
|
|
|
|
2017-03-18 16:41:55 -06:00
|
|
|
Move MovePicker::next_move(bool skipQuiets) {
|
2008-10-16 06:25:56 -06:00
|
|
|
|
2009-08-30 02:42:55 -06:00
|
|
|
Move move;
|
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
switch (stage) {
|
2010-02-05 10:17:52 -07:00
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
case MAIN_SEARCH: case EVASION: case QSEARCH_WITH_CHECKS:
|
2016-09-15 00:38:20 -06:00
|
|
|
case QSEARCH_NO_CHECKS: case PROBCUT:
|
2016-09-10 13:37:36 -06:00
|
|
|
++stage;
|
|
|
|
return ttMove;
|
2010-02-05 10:17:52 -07:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case CAPTURES_INIT:
|
2016-09-10 13:37:36 -06:00
|
|
|
endBadCaptures = cur = moves;
|
|
|
|
endMoves = generate<CAPTURES>(pos, cur);
|
|
|
|
score<CAPTURES>();
|
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2011-04-16 04:24:30 -06:00
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
case GOOD_CAPTURES:
|
|
|
|
while (cur < endMoves)
|
|
|
|
{
|
2015-02-01 02:59:01 -07:00
|
|
|
move = pick_best(cur++, endMoves);
|
2011-05-25 14:36:16 -06:00
|
|
|
if (move != ttMove)
|
2011-04-16 04:24:30 -06:00
|
|
|
{
|
2017-05-09 05:50:05 -06:00
|
|
|
if (pos.see_ge(move))
|
2009-08-27 01:12:51 -06:00
|
|
|
return move;
|
2009-08-30 02:42:55 -06:00
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
// Losing capture, move it to the beginning of the array
|
|
|
|
*endBadCaptures++ = move;
|
2011-04-16 04:24:30 -06:00
|
|
|
}
|
2016-09-10 13:37:36 -06:00
|
|
|
}
|
2011-04-16 04:24:30 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
++stage;
|
2017-04-28 21:27:39 -06:00
|
|
|
move = killers[0]; // First killer move
|
2016-09-10 13:37:36 -06:00
|
|
|
if ( move != MOVE_NONE
|
|
|
|
&& move != ttMove
|
|
|
|
&& pos.pseudo_legal(move)
|
|
|
|
&& !pos.capture(move))
|
|
|
|
return move;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2016-09-10 13:37:36 -06:00
|
|
|
|
|
|
|
case KILLERS:
|
|
|
|
++stage;
|
2017-04-28 21:27:39 -06:00
|
|
|
move = killers[1]; // Second killer move
|
2016-09-10 13:37:36 -06:00
|
|
|
if ( move != MOVE_NONE
|
|
|
|
&& move != ttMove
|
|
|
|
&& pos.pseudo_legal(move)
|
|
|
|
&& !pos.capture(move))
|
|
|
|
return move;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2016-09-10 13:37:36 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case COUNTERMOVE:
|
2016-09-10 13:37:36 -06:00
|
|
|
++stage;
|
|
|
|
move = countermove;
|
|
|
|
if ( move != MOVE_NONE
|
|
|
|
&& move != ttMove
|
2017-04-28 21:27:39 -06:00
|
|
|
&& move != killers[0]
|
|
|
|
&& move != killers[1]
|
2016-09-10 13:37:36 -06:00
|
|
|
&& pos.pseudo_legal(move)
|
|
|
|
&& !pos.capture(move))
|
|
|
|
return move;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2016-09-10 13:37:36 -06:00
|
|
|
|
|
|
|
case QUIET_INIT:
|
|
|
|
cur = endBadCaptures;
|
|
|
|
endMoves = generate<QUIETS>(pos, cur);
|
|
|
|
score<QUIETS>();
|
2017-04-23 09:37:55 -06:00
|
|
|
partial_insertion_sort(cur, endMoves, -4000 * depth / ONE_PLY);
|
2016-09-10 13:37:36 -06:00
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2011-04-16 04:24:30 -06:00
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
case QUIET:
|
2017-03-18 16:41:55 -06:00
|
|
|
while ( cur < endMoves
|
|
|
|
&& (!skipQuiets || cur->value >= VALUE_ZERO))
|
2016-09-10 13:37:36 -06:00
|
|
|
{
|
2015-02-01 02:59:01 -07:00
|
|
|
move = *cur++;
|
2017-03-18 16:41:55 -06:00
|
|
|
|
2011-05-25 14:36:16 -06:00
|
|
|
if ( move != ttMove
|
2017-04-28 21:27:39 -06:00
|
|
|
&& move != killers[0]
|
|
|
|
&& move != killers[1]
|
2016-09-10 13:37:36 -06:00
|
|
|
&& move != countermove)
|
2009-08-30 02:42:55 -06:00
|
|
|
return move;
|
2016-09-10 13:37:36 -06:00
|
|
|
}
|
|
|
|
++stage;
|
|
|
|
cur = moves; // Point to beginning of bad captures
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2009-08-30 02:42:55 -06:00
|
|
|
|
2016-09-10 13:37:36 -06:00
|
|
|
case BAD_CAPTURES:
|
|
|
|
if (cur < endBadCaptures)
|
|
|
|
return *cur++;
|
|
|
|
break;
|
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case EVASIONS_INIT:
|
2016-09-10 13:37:36 -06:00
|
|
|
cur = moves;
|
|
|
|
endMoves = generate<EVASIONS>(pos, cur);
|
2016-10-16 07:20:05 -06:00
|
|
|
score<EVASIONS>();
|
2016-09-10 13:37:36 -06:00
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2009-10-20 04:38:20 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case ALL_EVASIONS:
|
2016-09-10 13:37:36 -06:00
|
|
|
while (cur < endMoves)
|
|
|
|
{
|
2015-02-01 02:59:01 -07:00
|
|
|
move = pick_best(cur++, endMoves);
|
2011-05-25 14:36:16 -06:00
|
|
|
if (move != ttMove)
|
2011-04-16 04:24:30 -06:00
|
|
|
return move;
|
2016-09-10 13:37:36 -06:00
|
|
|
}
|
2016-09-15 00:38:20 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PROBCUT_INIT:
|
2016-09-10 13:37:36 -06:00
|
|
|
cur = moves;
|
2016-09-15 00:38:20 -06:00
|
|
|
endMoves = generate<CAPTURES>(pos, cur);
|
|
|
|
score<CAPTURES>();
|
2016-09-10 13:37:36 -06:00
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2009-08-26 07:33:17 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case PROBCUT_CAPTURES:
|
2016-09-10 13:37:36 -06:00
|
|
|
while (cur < endMoves)
|
|
|
|
{
|
2016-09-15 00:38:20 -06:00
|
|
|
move = pick_best(cur++, endMoves);
|
|
|
|
if ( move != ttMove
|
2016-12-22 08:02:32 -07:00
|
|
|
&& pos.see_ge(move, threshold))
|
2016-09-10 13:37:36 -06:00
|
|
|
return move;
|
|
|
|
}
|
|
|
|
break;
|
2012-01-21 15:32:48 -07:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case QCAPTURES_1_INIT: case QCAPTURES_2_INIT:
|
2016-09-10 13:37:36 -06:00
|
|
|
cur = moves;
|
|
|
|
endMoves = generate<CAPTURES>(pos, cur);
|
|
|
|
score<CAPTURES>();
|
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2016-09-10 13:37:36 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case QCAPTURES_1: case QCAPTURES_2:
|
2016-09-10 13:37:36 -06:00
|
|
|
while (cur < endMoves)
|
|
|
|
{
|
2015-02-01 02:59:01 -07:00
|
|
|
move = pick_best(cur++, endMoves);
|
2016-09-15 00:38:20 -06:00
|
|
|
if (move != ttMove)
|
|
|
|
return move;
|
|
|
|
}
|
|
|
|
if (stage == QCAPTURES_2)
|
|
|
|
break;
|
|
|
|
cur = moves;
|
|
|
|
endMoves = generate<QUIET_CHECKS>(pos, cur);
|
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2016-09-15 00:38:20 -06:00
|
|
|
|
|
|
|
case QCHECKS:
|
|
|
|
while (cur < endMoves)
|
|
|
|
{
|
|
|
|
move = cur++->move;
|
|
|
|
if (move != ttMove)
|
2011-06-12 00:25:51 -06:00
|
|
|
return move;
|
2016-09-10 13:37:36 -06:00
|
|
|
}
|
|
|
|
break;
|
2009-08-26 07:33:17 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case QSEARCH_RECAPTURES:
|
2016-09-10 13:37:36 -06:00
|
|
|
cur = moves;
|
|
|
|
endMoves = generate<CAPTURES>(pos, cur);
|
|
|
|
score<CAPTURES>();
|
|
|
|
++stage;
|
2017-04-28 09:30:14 -06:00
|
|
|
/* fallthrough */
|
2011-04-16 04:24:30 -06:00
|
|
|
|
2016-09-15 00:38:20 -06:00
|
|
|
case QRECAPTURES:
|
2016-09-10 13:37:36 -06:00
|
|
|
while (cur < endMoves)
|
|
|
|
{
|
|
|
|
move = pick_best(cur++, endMoves);
|
2016-09-15 00:38:20 -06:00
|
|
|
if (to_sq(move) == recaptureSquare)
|
2016-09-10 13:37:36 -06:00
|
|
|
return move;
|
2008-10-25 08:28:24 -06:00
|
|
|
}
|
2016-09-10 13:37:36 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(false);
|
2009-08-27 01:12:51 -06:00
|
|
|
}
|
2016-09-10 13:37:36 -06:00
|
|
|
|
|
|
|
return MOVE_NONE;
|
2009-08-27 01:12:51 -06:00
|
|
|
}
|