]> git.sesse.net Git - stockfish/commitdiff
Update various comments
authorStéphane Nicolet <cassio@free.fr>
Sun, 29 Apr 2018 04:48:18 +0000 (06:48 +0200)
committerStéphane Nicolet <cassio@free.fr>
Sun, 29 Apr 2018 04:48:18 +0000 (06:48 +0200)
Spotted by Alain Savard, Joost VandeVondele, Ronald de Man, Fabian Fichter, Chris Cain, xoto10

No functional change

AUTHORS
src/evaluate.cpp
src/movepick.h
src/pawns.cpp
src/search.cpp
src/thread.cpp

diff --git a/AUTHORS b/AUTHORS
index afd2f2976e979629c71a757e6e151e83d83a933b..66ad6b5f804ce01f119bb7ffa6621335db10e87a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,6 +22,7 @@ Bill Henry (VoyagerOne)
 braich
 Brian Sheppard (SapphireBrand)
 Bryan Cross (crossbr)
 braich
 Brian Sheppard (SapphireBrand)
 Bryan Cross (crossbr)
+Bujun Guo (noobpwnftw)
 Chris Cain (ceebo)
 Dan Schmidt
 Daniel Dugovic (ddugovic)
 Chris Cain (ceebo)
 Dan Schmidt
 Daniel Dugovic (ddugovic)
@@ -88,7 +89,6 @@ Mohammed Li (tthsqe12)
 Nathan Rugg (nmrugg)
 Nicklas Persson (NicklasPersson)
 Niklas Fiekas (niklasf)
 Nathan Rugg (nmrugg)
 Nicklas Persson (NicklasPersson)
 Niklas Fiekas (niklasf)
-noobpwnftw
 Oskar Werkelin Ahlin
 Pablo Vazquez
 Pascal Romaret
 Oskar Werkelin Ahlin
 Pablo Vazquez
 Pascal Romaret
index ad63e21630126499e168dba7fef10a550909e8ec..4c10a199243730db00ab89a471ee4ac393b99e5a 100644 (file)
@@ -698,7 +698,7 @@ namespace {
         } // w != 0
 
         // Scale down bonus for candidate passers which need more than one
         } // w != 0
 
         // Scale down bonus for candidate passers which need more than one
-        // pawn push to become passed or have a pawn in front of them.
+        // pawn push to become passed, or have a pawn in front of them.
         if (   !pos.pawn_passed(Us, s + Up)
             || (pos.pieces(PAWN) & forward_file_bb(Us, s)))
             bonus = bonus / 2;
         if (   !pos.pawn_passed(Us, s + Up)
             || (pos.pieces(PAWN) & forward_file_bb(Us, s)))
             bonus = bonus / 2;
@@ -731,9 +731,7 @@ namespace {
     if (pos.non_pawn_material() < SpaceThreshold)
         return SCORE_ZERO;
 
     if (pos.non_pawn_material() < SpaceThreshold)
         return SCORE_ZERO;
 
-    // Find the safe squares for our pieces inside the area defined by
-    // SpaceMask. A square is unsafe if it is attacked by an enemy
-    // pawn, or if it is undefended and attacked by an enemy piece.
+    // Find the available squares for our pieces inside the area defined by SpaceMask
     Bitboard safe =   SpaceMask
                    & ~pos.pieces(Us, PAWN)
                    & ~attackedBy[Them][PAWN];
     Bitboard safe =   SpaceMask
                    & ~pos.pieces(Us, PAWN)
                    & ~attackedBy[Them][PAWN];
index ae61be7f61549067395b84c91565856cc462082a..666cca362ed277493279dcefb265a2146eb952ad 100644 (file)
@@ -47,8 +47,8 @@ public:
   operator TT() const { return entry; }
 
   void operator<<(int bonus) {
   operator TT() const { return entry; }
 
   void operator<<(int bonus) {
-    assert(abs(bonus) <= D);                   // Ensure range is [-D, D]
-    assert(D < std::numeric_limits<T>::max()); // Ensure we don't overflow
+    assert(abs(bonus) <= D);   // Ensure range is [-D, D]
+    static_assert(D <= std::numeric_limits<T>::max(), "D overflows T");
 
     entry += bonus - entry * abs(bonus) / D;
 
 
     entry += bonus - entry * abs(bonus) / D;
 
index 72556172cb51cef20e3815ed5a4c1271b9b202bb..5e56a1c215bfb86e4fbfbc9a3810acd587be10ed 100644 (file)
@@ -45,7 +45,7 @@ namespace {
 
   // Strength of pawn shelter for our king by [distance from edge][rank].
   // RANK_1 = 0 is used for files where we have no pawn, or pawn is behind our king.
 
   // Strength of pawn shelter for our king by [distance from edge][rank].
   // RANK_1 = 0 is used for files where we have no pawn, or pawn is behind our king.
-  Value ShelterStrength[int(FILE_NB) / 2][RANK_NB] = {
+  constexpr Value ShelterStrength[int(FILE_NB) / 2][RANK_NB] = {
     { V( -9), V(64), V(77), V( 44), V( 4), V( -1), V(-11) },
     { V(-15), V(83), V(51), V(-10), V( 1), V(-10), V(-28) },
     { V(-18), V(84), V(27), V(-12), V(21), V( -7), V(-36) },
     { V( -9), V(64), V(77), V( 44), V( 4), V( -1), V(-11) },
     { V(-15), V(83), V(51), V(-10), V( 1), V(-10), V(-28) },
     { V(-18), V(84), V(27), V(-12), V(21), V( -7), V(-36) },
index d7980bd7ab1d2ef23b7770e1344a7398a46d4c00..b661d4817aa6c731174b15ff50460f5f6b6f87c9 100644 (file)
@@ -835,7 +835,11 @@ moves_loop: // When in check, search starts from here
     const PieceToHistory* contHist[] = { (ss-1)->contHistory, (ss-2)->contHistory, nullptr, (ss-4)->contHistory };
     Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq];
 
     const PieceToHistory* contHist[] = { (ss-1)->contHistory, (ss-2)->contHistory, nullptr, (ss-4)->contHistory };
     Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq];
 
-    MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory, contHist, countermove, ss->killers);
+    MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
+                                      &thisThread->captureHistory,
+                                      contHist,
+                                      countermove,
+                                      ss->killers);
     value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
 
     skipQuiets = false;
     value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
 
     skipQuiets = false;
@@ -1275,7 +1279,9 @@ moves_loop: // When in check, search starts from here
     // to search the moves. Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
     // be generated.
     // to search the moves. Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
     // be generated.
-    MovePicker mp(pos, ttMove, depth, &pos.this_thread()->mainHistory, &pos.this_thread()->captureHistory, to_sq((ss-1)->currentMove));
+    MovePicker mp(pos, ttMove, depth, &pos.this_thread()->mainHistory,
+                                      &pos.this_thread()->captureHistory,
+                                      to_sq((ss-1)->currentMove));
 
     // Loop through the moves until no moves remain or a beta cutoff occurs
     while ((move = mp.next_move()) != MOVE_NONE)
 
     // Loop through the moves until no moves remain or a beta cutoff occurs
     while ((move = mp.next_move()) != MOVE_NONE)
index 948b71c8def9e740c644c5653ef66b6206cfa348..7fec4724dc10d6d4d9063ab60eda41c4cca75a3a 100644 (file)
@@ -117,7 +117,7 @@ void Thread::idle_loop() {
 }
 
 /// ThreadPool::set() creates/destroys threads to match the requested number.
 }
 
 /// ThreadPool::set() creates/destroys threads to match the requested number.
-/// Created and launced threads wil go immediately to sleep in idle_loop.
+/// Created and launched threads wil go immediately to sleep in idle_loop.
 /// Upon resizing, threads are recreated to allow for binding if necessary.
 
 void ThreadPool::set(size_t requested) {
 /// Upon resizing, threads are recreated to allow for binding if necessary.
 
 void ThreadPool::set(size_t requested) {