X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.h;h=e6bc2c315a344b5987fe3ba2b1a1c100fafcc144;hp=6a8c4d7a4f5f543aa83e37bd0862170313ff2060;hb=5f5d056c8fb9996748b742c9d5102c9202b0bd2c;hpb=304deb5e833baf47c147e93377f5c7ef582ab822 diff --git a/src/pawns.h b/src/pawns.h index 6a8c4d7a..e6bc2c31 100644 --- a/src/pawns.h +++ b/src/pawns.h @@ -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; @@ -59,6 +59,8 @@ private: Bitboard passedPawns[2]; Bitboard pawnAttacks[2]; Square kingSquares[2]; + int minKPdistance[2]; + int castleRights[2]; Score value; int halfOpenFiles[2]; Score kingSafety[2]; @@ -68,14 +70,15 @@ private: /// 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 { -public: - PawnEntry* probe(const Position& pos) const; +struct PawnTable { + + PawnEntry* probe(const Position& pos); -private: template static Score evaluate_pawns(const Position& pos, Bitboard ourPawns, - Bitboard theirPawns, PawnEntry* pi); + Bitboard theirPawns, PawnEntry* e); + + HashTable entries; }; @@ -105,7 +108,8 @@ inline int PawnEntry::has_open_file_to_right(Color c, File f) const { template inline Score PawnEntry::king_safety(const Position& pos, Square ksq) { - return kingSquares[Us] == ksq ? kingSafety[Us] : update_safety(pos, ksq); + return kingSquares[Us] == ksq && castleRights[Us] == pos.can_castle(Us) + ? kingSafety[Us] : update_safety(pos, ksq); } #endif // !defined(PAWNS_H_INCLUDED)