X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=inline;f=src%2Fendgame.cpp;h=ca38a662a01a588d1fa11cf0eba21d2b2b156582;hb=54253bcce69a0ebc3e6bc4c35dfa76f8ff46521e;hp=55a4caba593a43c77bf3d3d2343f239f8b9a0301;hpb=cf5d683408a2ef8a1c80be9bf7d6790a38b16277;p=stockfish
diff --git a/src/endgame.cpp b/src/endgame.cpp
index 55a4caba..ca38a662 100644
--- a/src/endgame.cpp
+++ b/src/endgame.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "bitboard.h"
@@ -45,14 +44,14 @@ namespace {
// Table used to drive the king towards a corner square of the
// right color in KBN vs K endgames.
constexpr int PushToCorners[SQUARE_NB] = {
- 200, 190, 180, 170, 160, 150, 140, 130,
- 190, 180, 170, 160, 150, 140, 130, 140,
- 180, 170, 155, 140, 140, 125, 140, 150,
- 170, 160, 140, 120, 110, 140, 150, 160,
- 160, 150, 140, 110, 120, 140, 160, 170,
- 150, 140, 125, 140, 140, 155, 170, 180,
- 140, 130, 140, 150, 160, 170, 180, 190,
- 130, 140, 150, 160, 170, 180, 190, 200
+ 6400, 6080, 5760, 5440, 5120, 4800, 4480, 4160,
+ 6080, 5760, 5440, 5120, 4800, 4480, 4160, 4480,
+ 5760, 5440, 4960, 4480, 4480, 4000, 4480, 4800,
+ 5440, 5120, 4480, 3840, 3520, 4480, 4800, 5120,
+ 5120, 4800, 4480, 3520, 3840, 4480, 5120, 5440,
+ 4800, 4480, 4000, 4480, 4480, 4960, 5440, 5760,
+ 4480, 4160, 4480, 4800, 5120, 5440, 5760, 6080,
+ 4160, 4480, 4800, 5120, 5440, 5760, 6080, 6400
};
// Tables used to drive a piece towards or away from another piece
@@ -75,17 +74,42 @@ namespace {
assert(pos.count(strongSide) == 1);
if (file_of(pos.square(strongSide)) >= FILE_E)
- sq = Square(sq ^ 7); // Mirror SQ_H1 -> SQ_A1
+ sq = Square(int(sq) ^ 7); // Mirror SQ_H1 -> SQ_A1
- if (strongSide == BLACK)
- sq = ~sq;
-
- return sq;
+ return strongSide == WHITE ? sq : ~sq;
}
} // namespace
+namespace Endgames {
+
+ std::pair