#define MOVEPICK_H_INCLUDED
#include <algorithm> // For std::max
-#include <cstring> // For memset
+#include <cstring> // For std::memset
#include "movegen.h"
#include "position.h"
static const Value Max = Value(2000);
- const T* operator[](Piece p) const { return &table[p][0]; }
- void clear() { memset(table, 0, sizeof(table)); }
+ const T* operator[](Piece p) const { return table[p]; }
+ void clear() { std::memset(table, 0, sizeof(table)); }
+
+ void update(Piece p, Square to, Move m) {
+
+ if (m == table[p][to].first)
+ return;
+
+ table[p][to].second = table[p][to].first;
+ table[p][to].first = m;
+ }
- void update(Piece p, Square to, Move m) { table[p][to] = m; }
void update(Piece p, Square to, Value v) {
if (Gain)
typedef Stats< true, Value> GainsStats;
typedef Stats<false, Value> HistoryStats;
-typedef Stats<false, Move> CountermovesStats;
+typedef Stats<false, std::pair<Move, Move> > CountermovesStats;
/// MovePicker class is used to pick one pseudo legal move at a time from the
public:
MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
MovePicker(const Position&, Move, const HistoryStats&, PieceType);
- MovePicker(const Position&, Move, Depth, const HistoryStats&,
- const CountermovesStats&, Search::Stack*, Value);
+ MovePicker(const Position&, Move, Depth, const HistoryStats&, Move*, Search::Stack*, Value);
template<bool SpNode> Move next_move();
const Position& pos;
const HistoryStats& history;
Search::Stack* ss;
+ Move* countermoves;
Depth depth;
Move ttMove;
- MoveStack killers[3];
+ MoveStack killers[4];
Square recaptureSquare;
int captureThreshold, phase;
MoveStack *cur, *end, *endQuiets, *endBadCaptures;