]> git.sesse.net Git - stockfish/commitdiff
Allow to assign a Move to an ExtMove
authorMarco Costalba <mcostalba@gmail.com>
Sun, 1 Feb 2015 12:29:27 +0000 (13:29 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 1 Feb 2015 12:31:49 +0000 (13:31 +0100)
After defining ExtMove::operator Move(), this is a
natural extension.

No fnctional change.

src/movegen.h
src/movepick.cpp

index d46b8ddb7c9b4d5021fdbbcd13ff5dd59d2872ca..6a7f7e3ac51b4115f99e7bcef8a3296a7f69c39c 100644 (file)
@@ -38,6 +38,7 @@ struct ExtMove {
   Value value;
 
   operator Move() const { return move; }
   Value value;
 
   operator Move() const { return move; }
+  void operator=(Move m) { move = m; }
 };
 
 inline bool operator<(const ExtMove& f, const ExtMove& s) {
 };
 
 inline bool operator<(const ExtMove& f, const ExtMove& s) {
index 69d848d27564a0680e2c97d7baf97f02ef401dda..27245ec7c73904dd5c32a7cced6b7b4d461561d3 100644 (file)
@@ -55,7 +55,7 @@ namespace {
   inline Move pick_best(ExtMove* begin, ExtMove* end)
   {
       std::swap(*begin, *std::max_element(begin, end));
   inline Move pick_best(ExtMove* begin, ExtMove* end)
   {
       std::swap(*begin, *std::max_element(begin, end));
-      return begin->move;
+      return *begin;
   }
 
 } // namespace
   }
 
 } // namespace
@@ -202,12 +202,12 @@ void MovePicker::generate_next_stage() {
   case KILLERS_S1:
       cur = killers;
       endMoves = cur + 6;
   case KILLERS_S1:
       cur = killers;
       endMoves = cur + 6;
-      killers[0].move = ss->killers[0];
-      killers[1].move = ss->killers[1];
-      killers[2].move = countermoves[0];
-      killers[3].move = countermoves[1];
-      killers[4].move = followupmoves[0];
-      killers[5].move = followupmoves[1];
+      killers[0] = ss->killers[0];
+      killers[1] = ss->killers[1];
+      killers[2] = countermoves[0];
+      killers[3] = countermoves[1];
+      killers[4] = followupmoves[0];
+      killers[5] = followupmoves[1];
       break;
 
   case QUIETS_1_S1:
       break;
 
   case QUIETS_1_S1:
@@ -282,7 +282,7 @@ Move MovePicker::next_move<false>() {
                   return move;
 
               // Losing capture, move it to the tail of the array
                   return move;
 
               // Losing capture, move it to the tail of the array
-              (endBadCaptures--)->move = move;
+              *endBadCaptures-- = move;
           }
           break;
 
           }
           break;
 
@@ -293,8 +293,7 @@ Move MovePicker::next_move<false>() {
               &&  pos.pseudo_legal(move)
               && !pos.capture(move))
           {
               &&  pos.pseudo_legal(move)
               && !pos.capture(move))
           {
-              // Check for duplicated entries
-              for (int i = 0; i < cur - 1 - killers; i++)
+              for (int i = 0; i < cur - 1 - killers; i++) // Skip duplicated
                   if (move == killers[i])
                       goto skip;
               return move;
                   if (move == killers[i])
                       goto skip;
               return move;