From 2097cd12217a0e18c59bd88424ca613572e6feb2 Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Sat, 30 Mar 2013 19:49:49 +0000 Subject: [PATCH] Introduce asymmetric SEE. No functional change --- src/position.cpp | 20 ++++++++++++++++++++ src/position.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/position.cpp b/src/position.cpp index ad699cc0..22c17173 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1148,6 +1148,16 @@ int Position::see_sign(Move m) const { } int Position::see(Move m) const { + return do_see(m, 0); +} + +int Position::see_asymm(Move m, int asymmThreshold) const +{ + return do_see(m, asymmThreshold); +} + +template +int Position::do_see(Move m, int asymmThreshold) const { Square from, to; Bitboard occupied, attackers, stmAttackers; @@ -1224,6 +1234,16 @@ int Position::see(Move m) const { } 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) diff --git a/src/position.h b/src/position.h index 8d15f266..2ad9294f 100644 --- a/src/position.h +++ b/src/position.h @@ -160,6 +160,8 @@ public: // Static exchange evaluation int see(Move m) const; int see_sign(Move m) const; + int see_asymm(Move m, int asymmThreshold) const; + template int do_see(Move m, int asymmThreshold) const; //FIXME: private!! // Accessing hash keys Key key() const; -- 2.39.2