]> git.sesse.net Git - stockfish/commitdiff
pseudo_legal() and MOVE_NONE
authorprotonspring <mike@whiteley.org>
Thu, 6 Dec 2018 13:02:11 +0000 (14:02 +0100)
committerStéphane Nicolet <cassio@free.fr>
Thu, 6 Dec 2018 13:02:29 +0000 (14:02 +0100)
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

src/movepick.cpp
src/position.cpp

index 883135d491798a292be297af44d66fbd0948d522..3bc56751f94c3710ddc1051362fc1ac87a1f1c56 100644 (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;
index c915a1f9f3cf7e466eb2ed9d754cc75cdd22cbd1..8e7a5aa5d24de004688134b12dbbe75d9c902697 100644 (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 {