mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 17:19:36 +00:00
Simple always overwrite Refutation table
This commit is contained in:
parent
818a3537a7
commit
c7e31d5aa8
3 changed files with 27 additions and 6 deletions
|
@ -71,7 +71,7 @@ namespace {
|
||||||
/// move ordering is at the current node.
|
/// move ordering is at the current node.
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
||||||
Search::Stack* s, Value beta) : pos(p), Hist(h), depth(d) {
|
Search::Stack* s, Move refutationMove, Value beta) : pos(p), Hist(h), depth(d) {
|
||||||
|
|
||||||
assert(d > DEPTH_ZERO);
|
assert(d > DEPTH_ZERO);
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
||||||
|
|
||||||
killers[0].move = ss->killers[0];
|
killers[0].move = ss->killers[0];
|
||||||
killers[1].move = ss->killers[1];
|
killers[1].move = ss->killers[1];
|
||||||
|
killers[2].move = refutationMove;
|
||||||
|
|
||||||
// Consider sligtly negative captures as good if at low depth and far from beta
|
// Consider sligtly negative captures as good if at low depth and far from beta
|
||||||
if (ss && ss->staticEval < beta - PawnValueMg && d < 3 * ONE_PLY)
|
if (ss && ss->staticEval < beta - PawnValueMg && d < 3 * ONE_PLY)
|
||||||
|
@ -237,7 +238,7 @@ void MovePicker::generate_next() {
|
||||||
|
|
||||||
case KILLERS_S1:
|
case KILLERS_S1:
|
||||||
cur = killers;
|
cur = killers;
|
||||||
end = cur + 2;
|
end = cur + 3;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case QUIETS_1_S1:
|
case QUIETS_1_S1:
|
||||||
|
@ -329,7 +330,8 @@ Move MovePicker::next_move<false>() {
|
||||||
move = (cur++)->move;
|
move = (cur++)->move;
|
||||||
if ( move != ttMove
|
if ( move != ttMove
|
||||||
&& move != killers[0].move
|
&& move != killers[0].move
|
||||||
&& move != killers[1].move)
|
&& move != killers[1].move
|
||||||
|
&& move != killers[2].move)
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,17 @@ private:
|
||||||
typedef Stats<false> History;
|
typedef Stats<false> History;
|
||||||
typedef Stats<true> Gains;
|
typedef Stats<true> Gains;
|
||||||
|
|
||||||
|
// FIXME: Document me
|
||||||
|
struct RefutationTable {
|
||||||
|
|
||||||
|
void clear() { memset(table, 0, sizeof(table)); }
|
||||||
|
void update(Piece p, Square to, Move m) { table[p][to] = m; }
|
||||||
|
Move get(Piece p, Square to) const { return table[p][to]; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Move table[PIECE_NB][SQUARE_NB]; // Mapping: "move A" -> "move B which refutes move A"
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/// MovePicker class is used to pick one pseudo legal move at a time from the
|
/// MovePicker class is used to pick one pseudo legal move at a time from the
|
||||||
/// current position. The most important method is next_move(), which returns a
|
/// current position. The most important method is next_move(), which returns a
|
||||||
|
@ -74,7 +85,7 @@ class MovePicker {
|
||||||
MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
|
MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MovePicker(const Position&, Move, Depth, const History&, Search::Stack*, Value);
|
MovePicker(const Position&, Move, Depth, const History&, Search::Stack*, Move, Value);
|
||||||
MovePicker(const Position&, Move, Depth, const History&, Square);
|
MovePicker(const Position&, Move, Depth, const History&, Square);
|
||||||
MovePicker(const Position&, Move, const History&, PieceType);
|
MovePicker(const Position&, Move, const History&, PieceType);
|
||||||
template<bool SpNode> Move next_move();
|
template<bool SpNode> Move next_move();
|
||||||
|
@ -88,7 +99,7 @@ private:
|
||||||
Search::Stack* ss;
|
Search::Stack* ss;
|
||||||
Depth depth;
|
Depth depth;
|
||||||
Move ttMove;
|
Move ttMove;
|
||||||
MoveStack killers[2];
|
MoveStack killers[3];
|
||||||
Square recaptureSquare;
|
Square recaptureSquare;
|
||||||
int captureThreshold, phase;
|
int captureThreshold, phase;
|
||||||
MoveStack *cur, *end, *endQuiets, *endBadCaptures;
|
MoveStack *cur, *end, *endQuiets, *endBadCaptures;
|
||||||
|
|
|
@ -88,6 +88,7 @@ namespace {
|
||||||
Value DrawValue[COLOR_NB];
|
Value DrawValue[COLOR_NB];
|
||||||
History Hist;
|
History Hist;
|
||||||
Gains Gain;
|
Gains Gain;
|
||||||
|
RefutationTable Refutation;
|
||||||
|
|
||||||
template <NodeType NT>
|
template <NodeType NT>
|
||||||
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
|
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
|
||||||
|
@ -305,6 +306,7 @@ namespace {
|
||||||
TT.new_search();
|
TT.new_search();
|
||||||
Hist.clear();
|
Hist.clear();
|
||||||
Gain.clear();
|
Gain.clear();
|
||||||
|
Refutation.clear();
|
||||||
|
|
||||||
PVSize = Options["MultiPV"];
|
PVSize = Options["MultiPV"];
|
||||||
Skill skill(Options["Skill Level"]);
|
Skill skill(Options["Skill Level"]);
|
||||||
|
@ -764,7 +766,12 @@ namespace {
|
||||||
|
|
||||||
split_point_start: // At split points actual search starts from here
|
split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
MovePicker mp(pos, ttMove, depth, Hist, ss, PvNode ? -VALUE_INFINITE : beta);
|
Move prevMove = (ss-1)->currentMove;
|
||||||
|
Square prevSq = to_sq(prevMove);
|
||||||
|
Piece prevP = pos.piece_on(prevSq);
|
||||||
|
Move refutationMove = Refutation.get(prevP, prevSq);
|
||||||
|
|
||||||
|
MovePicker mp(pos, ttMove, depth, Hist, ss, refutationMove, PvNode ? -VALUE_INFINITE : beta);
|
||||||
CheckInfo ci(pos);
|
CheckInfo ci(pos);
|
||||||
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
|
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
|
||||||
singularExtensionNode = !RootNode
|
singularExtensionNode = !RootNode
|
||||||
|
@ -1090,6 +1097,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
// Increase history value of the cut-off move
|
// Increase history value of the cut-off move
|
||||||
Value bonus = Value(int(depth) * int(depth));
|
Value bonus = Value(int(depth) * int(depth));
|
||||||
Hist.update(pos.piece_moved(bestMove), to_sq(bestMove), bonus);
|
Hist.update(pos.piece_moved(bestMove), to_sq(bestMove), bonus);
|
||||||
|
//Refutation.update(prevP, prevSq, bestMove);
|
||||||
|
|
||||||
// Decrease history of all the other played non-capture moves
|
// Decrease history of all the other played non-capture moves
|
||||||
for (int i = 0; i < playedMoveCount - 1; i++)
|
for (int i = 0; i < playedMoveCount - 1; i++)
|
||||||
|
|
Loading…
Add table
Reference in a new issue