]> git.sesse.net Git - stockfish/commitdiff
Remove KNPKB endgame.
authorprotonspring <mike@whiteley.org>
Mon, 23 Mar 2020 04:21:49 +0000 (22:21 -0600)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 25 Mar 2020 20:42:33 +0000 (21:42 +0100)
This is a functional simplification that removes the KNPKB endgame.

Testing on only KNPKB positions suggests that this removal actually gains Elo:

Score of patch vs master: 3380 - 3035 - 33585  [0.504] 40000
Elo difference: 3.0 +/- 1.4, LOS: 100.0 %, DrawRatio: 84.0 %

Score of patch vs master: 290 - 36 - 39674  [0.503] 40000
Elo difference: 2.2 +/- 0.3, LOS: 100.0 %, DrawRatio: 99.2 %

removal also doesn't cause a regression with the standard book:

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 71376 W: 13794 L: 13719 D: 43863
Ptnml(0-2): 1066, 8092, 17290, 8181, 1059
https://tests.stockfishchess.org/tests/view/5e76c3d5e42a5c3b3ca2e8be

LTC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 28394 W: 3731 L: 3662 D: 21001
Ptnml(0-2): 167, 2339, 9116, 2408, 167
https://tests.stockfishchess.org/tests/view/5e76e5eae42a5c3b3ca2e8d3

closes https://github.com/official-stockfish/Stockfish/pull/2594

Bench 5480811

src/endgame.cpp
src/endgame.h

index 56583c58890ffb6f7aac25979987719388407477..1a5959e5fea8e4120844d5ac8c868c16c4626a5f 100644 (file)
@@ -80,7 +80,6 @@ namespace Endgames {
     add<KNNKP>("KNNKP");
 
     add<KNPK>("KNPK");
-    add<KNPKB>("KNPKB");
     add<KRPKR>("KRPKR");
     add<KRPKB>("KRPKB");
     add<KBPKB>("KBPKB");
@@ -733,27 +732,6 @@ ScaleFactor Endgame<KNPK>::operator()(const Position& pos) const {
 }
 
 
-/// KNP vs KB. If knight can block bishop from taking pawn, it's a win.
-/// Otherwise the position is drawn.
-template<>
-ScaleFactor Endgame<KNPKB>::operator()(const Position& pos) const {
-
-  assert(verify_material(pos, strongSide, KnightValueMg, 1));
-  assert(verify_material(pos, weakSide, BishopValueMg, 0));
-
-  Square pawnSq = pos.square<PAWN>(strongSide);
-  Square bishopSq = pos.square<BISHOP>(weakSide);
-  Square weakKingSq = pos.square<KING>(weakSide);
-
-  // King needs to get close to promoting pawn to prevent knight from blocking.
-  // Rules for this are very tricky, so just approximate.
-  if (forward_file_bb(strongSide, pawnSq) & pos.attacks_from<BISHOP>(bishopSq))
-      return ScaleFactor(distance(weakKingSq, pawnSq));
-
-  return SCALE_FACTOR_NONE;
-}
-
-
 /// KP vs KP. This is done by removing the weakest side's pawn and probing the
 /// KP vs K bitbase: If the weakest side has a draw without the pawn, it probably
 /// has at least a draw with the pawn as well. The exception is when the stronger
index f61353542aa13f62ac78d41079f2f1ca5e66cdf9..49ebb603a1fa157762e1ac36218a7988ec5ea75d 100644 (file)
@@ -58,7 +58,6 @@ enum EndgameCode {
   KBPPKB,  // KBPP vs KB
   KBPKN,   // KBP vs KN
   KNPK,    // KNP vs K
-  KNPKB,   // KNP vs KB
   KPKP     // KP vs KP
 };