]> git.sesse.net Git - stockfish/blobdiff - src/pawns.h
Avoid spamming the GUI in multipv search
[stockfish] / src / pawns.h
index 6a8c4d7a4f5f543aa83e37bd0862170313ff2060..e1583fc04928f14a34895188133fcf0e3e3d6824 100644 (file)
@@ -20,8 +20,8 @@
 #if !defined(PAWNS_H_INCLUDED)
 #define PAWNS_H_INCLUDED
 
+#include "misc.h"
 #include "position.h"
-#include "tt.h"
 #include "types.h"
 
 const int PawnTableSize = 16384;
@@ -35,7 +35,7 @@ const int PawnTableSize = 16384;
 
 class PawnEntry {
 
-  friend class PawnTable;
+  friend struct PawnTable;
 
 public:
   Score pawns_value() const;
@@ -56,26 +56,29 @@ private:
   Value shelter_storm(const Position& pos, Square ksq);
 
   Key key;
-  Bitboard passedPawns[2];
-  Bitboard pawnAttacks[2];
-  Square kingSquares[2];
+  Bitboard passedPawns[COLOR_NB];
+  Bitboard pawnAttacks[COLOR_NB];
+  Square kingSquares[COLOR_NB];
+  int minKPdistance[COLOR_NB];
+  int castleRights[COLOR_NB];
   Score value;
-  int halfOpenFiles[2];
-  Score kingSafety[2];
+  int halfOpenFiles[COLOR_NB];
+  Score kingSafety[COLOR_NB];
 };
 
 
 /// The PawnTable class represents a pawn hash table. The most important
 /// method is probe, which returns a pointer to a PawnEntry object.
 
-class PawnTable : public HashTable<PawnEntry, PawnTableSize> {
-public:
-  PawnEntry* probe(const Position& pos) const;
+struct PawnTable {
+
+  PawnEntry* probe(const Position& pos);
 
-private:
   template<Color Us>
   static Score evaluate_pawns(const Position& pos, Bitboard ourPawns,
-                              Bitboard theirPawns, PawnEntry* pi);
+                              Bitboard theirPawns, PawnEntry* e);
+
+  HashTable<PawnEntry, PawnTableSize> entries;
 };
 
 
@@ -105,7 +108,8 @@ inline int PawnEntry::has_open_file_to_right(Color c, File f) const {
 
 template<Color Us>
 inline Score PawnEntry::king_safety(const Position& pos, Square ksq) {
-  return kingSquares[Us] == ksq ? kingSafety[Us] : update_safety<Us>(pos, ksq);
+  return kingSquares[Us] == ksq && castleRights[Us] == pos.can_castle(Us)
+       ? kingSafety[Us] : update_safety<Us>(pos, ksq);
 }
 
 #endif // !defined(PAWNS_H_INCLUDED)