Skip to content

Commit 5c2fbcd

Browse files
committed
Revert "pseudo_legal() and MOVE_NONE"
This reverts commit 33d9548 , which crashed in DEBUG mode because of the following assert in position.h ```` Assertion failed: (is_ok(m)), function capture, file ./position.h, line 369. ```` No functional change
1 parent 7b4f9c3 commit 5c2fbcd

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/movepick.cpp

Lines changed: 8 additions & 5 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 = pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
70+
ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
7171
stage += (ttMove == MOVE_NONE);
7272
}
7373

@@ -79,8 +79,9 @@ 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 = pos.pseudo_legal(ttm)
83-
&& (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE;
82+
ttMove = ttm
83+
&& pos.pseudo_legal(ttm)
84+
&& (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE;
8485
stage += (ttMove == MOVE_NONE);
8586
}
8687

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

9495
stage = PROBCUT_TT;
95-
ttMove = pos.pseudo_legal(ttm)
96+
ttMove = ttm
97+
&& pos.pseudo_legal(ttm)
9698
&& pos.capture(ttm)
9799
&& pos.see_ge(ttm, threshold) ? ttm : MOVE_NONE;
98100
stage += (ttMove == MOVE_NONE);
@@ -192,7 +194,8 @@ Move MovePicker::next_move(bool skipQuiets) {
192194
/* fallthrough */
193195

194196
case REFUTATION:
195-
if (select<Next>([&](){ return !pos.capture(move)
197+
if (select<Next>([&](){ return move != MOVE_NONE
198+
&& !pos.capture(move)
196199
&& pos.pseudo_legal(move); }))
197200
return move;
198201
++stage;

src/position.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ 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.
583582

584583
bool Position::pseudo_legal(const Move m) const {
585584

0 commit comments

Comments
 (0)