]> git.sesse.net Git - stockfish/commitdiff
Introduce asymmetric SEE.
authorJoona Kiiski <joona.kiiski@gmail.com>
Sat, 30 Mar 2013 19:49:49 +0000 (19:49 +0000)
committerJoona Kiiski <joona.kiiski@gmail.com>
Fri, 5 Apr 2013 18:05:32 +0000 (19:05 +0100)
No functional change

src/position.cpp
src/position.h

index ad699cc0e93423ef4112093b442da41c0466cb72..22c17173c5727cd016a0bca109f7c2f62cc9c3a7 100644 (file)
@@ -1148,6 +1148,16 @@ int Position::see_sign(Move m) const {
 }
 
 int Position::see(Move m) const {
 }
 
 int Position::see(Move m) const {
+  return do_see<false>(m, 0);
+}
+
+int Position::see_asymm(Move m, int asymmThreshold) const
+{
+  return do_see<true>(m, asymmThreshold);
+}
+
+template <bool Asymmetric>
+int Position::do_see(Move m, int asymmThreshold) const {
 
   Square from, to;
   Bitboard occupied, attackers, stmAttackers;
 
   Square from, to;
   Bitboard occupied, attackers, stmAttackers;
@@ -1224,6 +1234,16 @@ int Position::see(Move m) const {
 
   } while (stmAttackers);
 
 
   } while (stmAttackers);
 
+  // FIXME: Document
+  if (Asymmetric)
+  {
+      for (int i = 0; i < slIndex ; slIndex += 2)
+      {
+          if (swapList[slIndex] < asymmThreshold)
+               swapList[slIndex] = - QueenValueMg * 16;
+      }
+  }
+
   // Having built the swap list, we negamax through it to find the best
   // achievable score from the point of view of the side to move.
   while (--slIndex)
   // Having built the swap list, we negamax through it to find the best
   // achievable score from the point of view of the side to move.
   while (--slIndex)
index 8d15f266d11f04607cfcb3ce85be26ea8785acd1..2ad9294fc896e0fd2518c9122c846c8fe00a56db 100644 (file)
@@ -160,6 +160,8 @@ public:
   // Static exchange evaluation
   int see(Move m) const;
   int see_sign(Move m) const;
   // Static exchange evaluation
   int see(Move m) const;
   int see_sign(Move m) const;
+  int see_asymm(Move m, int asymmThreshold) const;
+  template <bool Asymmetric> int do_see(Move m, int asymmThreshold) const; //FIXME: private!!
 
   // Accessing hash keys
   Key key() const;
 
   // Accessing hash keys
   Key key() const;