]> git.sesse.net Git - stockfish/blobdiff - src/bitbase.cpp
Rename move.cpp to notation.cpp
[stockfish] / src / bitbase.cpp
index b01a03d4bc8815ea3c20794057dfc1b3cde159c5..9322e537f2837cd2bf2ba6588bda42baa0e3b524 100644 (file)
@@ -117,7 +117,7 @@ namespace {
     stm  = Color(idx & 1);
     bksq = Square((idx >> 1) & 63);
     wksq = Square((idx >> 7) & 63);
-    psq  = make_square(File((idx >> 13) & 3), Rank((idx >> 15) + 1));
+    psq  = File((idx >> 13) & 3) | Rank((idx >> 15) + 1);
   }
 
   Result KPKPosition::classify_leaf(int idx) {
@@ -156,7 +156,7 @@ namespace {
         && rank_of(psq) < RANK_7)
         return DRAW;
 
-    //  Case 4: White king in front of pawn and black has opposition
+    // Case 4: White king in front of pawn and black has opposition
     if (   stm == WHITE
         && wksq == psq + DELTA_N
         && bksq == wksq + DELTA_N + DELTA_N
@@ -168,6 +168,13 @@ namespace {
         && file_of(psq) == FILE_A)
         return DRAW;
 
+    // Case 6: White king trapped on the rook file
+    if (   file_of(wksq) == FILE_A
+        && file_of(psq) == FILE_A
+        && rank_of(wksq) > rank_of(psq)
+        && bksq == wksq + 2)
+        return DRAW;
+
     return UNKNOWN;
   }