Skip to content

Commit 33d9548

Browse files
protonspringsnicolet
authored andcommitted
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
1 parent 9dc6d27 commit 33d9548

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/movepick.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist
6767
assert(d > DEPTH_ZERO);
6868

6969
stage = pos.checkers() ? EVASION_TT : MAIN_TT;
70-
ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
70+
ttMove = pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
7171
stage += (ttMove == MOVE_NONE);
7272
}
7373

@@ -79,9 +79,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist
7979
assert(d <= DEPTH_ZERO);
8080

8181
stage = pos.checkers() ? EVASION_TT : QSEARCH_TT;
82-
ttMove = ttm
83-
&& pos.pseudo_legal(ttm)
84-
&& (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE;
82+
ttMove = pos.pseudo_legal(ttm)
83+
&& (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE;
8584
stage += (ttMove == MOVE_NONE);
8685
}
8786

@@ -93,8 +92,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Value th, const CapturePiece
9392
assert(!pos.checkers());
9493

9594
stage = PROBCUT_TT;
96-
ttMove = ttm
97-
&& pos.pseudo_legal(ttm)
95+
ttMove = pos.pseudo_legal(ttm)
9896
&& pos.capture(ttm)
9997
&& pos.see_ge(ttm, threshold) ? ttm : MOVE_NONE;
10098
stage += (ttMove == MOVE_NONE);
@@ -194,8 +192,7 @@ Move MovePicker::next_move(bool skipQuiets) {
194192
/* fallthrough */
195193

196194
case REFUTATION:
197-
if (select<Next>([&](){ return move != MOVE_NONE
198-
&& !pos.capture(move)
195+
if (select<Next>([&](){ return !pos.capture(move)
199196
&& pos.pseudo_legal(move); }))
200197
return move;
201198
++stage;

src/position.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ bool Position::legal(Move m) const {
579579
/// Position::pseudo_legal() takes a random move and tests whether the move is
580580
/// pseudo legal. It is used to validate moves from TT that can be corrupted
581581
/// due to SMP concurrent access or hash position key aliasing.
582+
/// MOVE_NONE is represented as SQ_A1 to SQ_A1 which is never pseudo_legal.
582583

583584
bool Position::pseudo_legal(const Move m) const {
584585

0 commit comments

Comments
 (0)