1
0
Fork 0

pseudo_legal() and MOVE_NONE

MOVE_NONE is represented as SQ_A1 to SQ_A1 which is never pseudo_legal.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 38807 W: 8363 L: 8275 D: 22169
http://tests.stockfishchess.org/tests/view/5c05f11d0ebc5902bcee4c86

No functional change
pull/1851/head
protonspring 2018-12-06 14:02:11 +01:00 committed by Stéphane Nicolet
parent 9dc6d270fc
commit 33d9548218
2 changed files with 6 additions and 8 deletions

View File

@ -67,7 +67,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist
assert(d > DEPTH_ZERO);
stage = pos.checkers() ? EVASION_TT : MAIN_TT;
ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
ttMove = pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
stage += (ttMove == MOVE_NONE);
}
@ -79,9 +79,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist
assert(d <= DEPTH_ZERO);
stage = pos.checkers() ? EVASION_TT : QSEARCH_TT;
ttMove = ttm
&& pos.pseudo_legal(ttm)
&& (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE;
ttMove = pos.pseudo_legal(ttm)
&& (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE;
stage += (ttMove == MOVE_NONE);
}
@ -93,8 +92,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Value th, const CapturePiece
assert(!pos.checkers());
stage = PROBCUT_TT;
ttMove = ttm
&& pos.pseudo_legal(ttm)
ttMove = pos.pseudo_legal(ttm)
&& pos.capture(ttm)
&& pos.see_ge(ttm, threshold) ? ttm : MOVE_NONE;
stage += (ttMove == MOVE_NONE);
@ -194,8 +192,7 @@ top:
/* fallthrough */
case REFUTATION:
if (select<Next>([&](){ return move != MOVE_NONE
&& !pos.capture(move)
if (select<Next>([&](){ return !pos.capture(move)
&& pos.pseudo_legal(move); }))
return move;
++stage;

View File

@ -579,6 +579,7 @@ bool Position::legal(Move m) const {
/// Position::pseudo_legal() takes a random move and tests whether the move is
/// pseudo legal. It is used to validate moves from TT that can be corrupted
/// due to SMP concurrent access or hash position key aliasing.
/// MOVE_NONE is represented as SQ_A1 to SQ_A1 which is never pseudo_legal.
bool Position::pseudo_legal(const Move m) const {