]> git.sesse.net Git - stockfish/commitdiff
Introduce PawnsQtyTable[] to refine pawn's drawish calculation
authorMarco Costalba <mcostalba@gmail.com>
Mon, 19 Apr 2010 07:06:34 +0000 (09:06 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 19 Apr 2010 11:24:26 +0000 (12:24 +0100)
Also fix dimension of UnpairedPawnsTable[] to accomodate the
case in which we have 8 unpaired pawns, i.e. only one side has
pawns, the other side has no pawns.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/pawns.cpp

index c6d390b32efb0ea9e9a22276605a0c688485a0ae..65bb3dbaa38d1dcc9224639f6d0c5bf4ae860313 100644 (file)
@@ -72,7 +72,10 @@ namespace {
 
   // UnpairedPawnsTable[] gives a score according to the number
   // of panws that do not have an enemy pawn in front of them.
 
   // UnpairedPawnsTable[] gives a score according to the number
   // of panws that do not have an enemy pawn in front of them.
-  const int UnpairedPawnsTable[8] = { 32, 48, 64, 80, 96, 112, 128, 128 };
+  const int UnpairedPawnsTable[16] = { 32, 48, 64, 80, 96, 112, 128, 128, 128 };
+
+  // PawnsQtyTable[] gives a score according to the number of panws
+  const int PawnsQtyTable[16] = { 16, 16, 16, 16, 16, 16, 16, 16, 16 };
 
   // Pawn storm tables for positions with opposite castling
   const int QStormTable[64] = {
 
   // Pawn storm tables for positions with opposite castling
   const int QStormTable[64] = {
@@ -347,7 +350,7 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
   }
 
   // Calculate a scale factor to be used to evaluate if position is drawish
   }
 
   // Calculate a scale factor to be used to evaluate if position is drawish
-  pi->factor[Us] = UnpairedPawnsTable[unpairedPawnsNum];
+  pi->factor[Us] = UnpairedPawnsTable[unpairedPawnsNum] * PawnsQtyTable[pos.piece_count(Us, PAWN)] / 16;
 
   return value;
 }
 
   return value;
 }