]> git.sesse.net Git - stockfish/blobdiff - src/pawns.h
Retire color.h
[stockfish] / src / pawns.h
index 0e7ca61d49fbc7de10397608bbe944baf2b1a08f..77a09f29acae57eeb95273f3c3dcecd8d28139e2 100644 (file)
 
 #include "bitboard.h"
 #include "position.h"
+#include "tt.h"
 #include "value.h"
 
+
 ////
 //// Types
 ////
@@ -69,26 +71,21 @@ private:
   Score kingShelters[2];
 };
 
-/// The PawnInfoTable class represents a pawn hash table.  It is basically
-/// just an array of PawnInfo objects and a few methods for accessing these
-/// objects.  The most important method is get_pawn_info, which looks up a
-/// position in the table and returns a pointer to a PawnInfo object.
 
-class PawnInfoTable {
+/// The PawnInfoTable class represents a pawn hash table. The most important
+/// method is get_pawn_info, which returns a pointer to a PawnInfo object.
+
+class PawnInfoTable : public SimpleHash<PawnInfo, PawnTableSize> {
 
   enum SideType { KingSide, QueenSide };
 
 public:
-  PawnInfoTable();
-  ~PawnInfoTable();
   PawnInfo* get_pawn_info(const Position& pos) const;
   void prefetch(Key key) const;
 
 private:
   template<Color Us>
   Score evaluate_pawns(const Position& pos, Bitboard ourPawns, Bitboard theirPawns, PawnInfo* pi) const;
-
-  PawnInfo* entries;
 };
 
 
@@ -96,6 +93,10 @@ private:
 //// Inline functions
 ////
 
+inline Square pawn_push(Color c) {
+  return c == WHITE ? DELTA_N : DELTA_S;
+}
+
 inline void PawnInfoTable::prefetch(Key key) const {
 
     unsigned index = unsigned(key & (PawnTableSize - 1));