mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 17:19:36 +00:00
Simplification to use only one counter move.
STC http://tests.stockfishchess.org/tests/view/5518dca30ebc5902160ec5d0 LLR: 2.95 (-2.94,2.94) [-3.50,0.50] Total: 18868 W: 3638 L: 3530 D: 11700 LTC http://tests.stockfishchess.org/tests/view/5518f7ed0ebc5902160ec5d4 LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 69767 W: 11019 L: 10973 D: 47775 Extracted from http://tests.stockfishchess.org/tests/view/5511028a0ebc5902160ec40b Original patch by hxim. All credit goes to him. Bench: 7664249 Resolves #320
This commit is contained in:
parent
6c42575208
commit
6661a31541
3 changed files with 17 additions and 26 deletions
|
@ -68,12 +68,12 @@ namespace {
|
||||||
/// ordering is at the current node.
|
/// ordering is at the current node.
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh,
|
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh,
|
||||||
Move* cm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) {
|
Move cm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) {
|
||||||
|
|
||||||
assert(d > DEPTH_ZERO);
|
assert(d > DEPTH_ZERO);
|
||||||
|
|
||||||
endBadCaptures = moves + MAX_MOVES - 1;
|
endBadCaptures = moves + MAX_MOVES - 1;
|
||||||
countermoves = cm;
|
countermove = cm;
|
||||||
ss = s;
|
ss = s;
|
||||||
|
|
||||||
if (pos.checkers())
|
if (pos.checkers())
|
||||||
|
@ -209,16 +209,12 @@ void MovePicker::generate_next_stage() {
|
||||||
|
|
||||||
killers[0] = ss->killers[0];
|
killers[0] = ss->killers[0];
|
||||||
killers[1] = ss->killers[1];
|
killers[1] = ss->killers[1];
|
||||||
killers[2].move = killers[3].move = MOVE_NONE;
|
killers[2].move = MOVE_NONE;
|
||||||
|
|
||||||
// In SMP case countermoves[] could have duplicated entries
|
// Be sure countermoves are different from killers
|
||||||
// in rare cases (less than 1 out of a million). This is harmless.
|
if ( countermove != killers[0]
|
||||||
|
&& countermove != killers[1])
|
||||||
// Be sure countermoves and followupmoves are different from killers
|
*endMoves++ = countermove;
|
||||||
for (int i = 0; i < 2; ++i)
|
|
||||||
if ( countermoves[i] != killers[0]
|
|
||||||
&& countermoves[i] != killers[1])
|
|
||||||
*endMoves++ = countermoves[i];
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUIETS_1_S1:
|
case QUIETS_1_S1:
|
||||||
|
@ -311,8 +307,7 @@ Move MovePicker::next_move<false>() {
|
||||||
if ( move != ttMove
|
if ( move != ttMove
|
||||||
&& move != killers[0]
|
&& move != killers[0]
|
||||||
&& move != killers[1]
|
&& move != killers[1]
|
||||||
&& move != killers[2]
|
&& move != killers[2])
|
||||||
&& move != killers[3])
|
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,8 @@ struct Stats {
|
||||||
|
|
||||||
void update(Piece pc, Square to, Move m) {
|
void update(Piece pc, Square to, Move m) {
|
||||||
|
|
||||||
if (m == table[pc][to].first)
|
if (m != table[pc][to])
|
||||||
return;
|
table[pc][to] = m;
|
||||||
|
|
||||||
table[pc][to].second = table[pc][to].first;
|
|
||||||
table[pc][to].first = m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(Piece pc, Square to, Value v) {
|
void update(Piece pc, Square to, Value v) {
|
||||||
|
@ -70,7 +67,7 @@ private:
|
||||||
|
|
||||||
typedef Stats< true, Value> GainsStats;
|
typedef Stats< true, Value> GainsStats;
|
||||||
typedef Stats<false, Value> HistoryStats;
|
typedef Stats<false, Value> HistoryStats;
|
||||||
typedef Stats<false, std::pair<Move, Move> > MovesStats;
|
typedef Stats<false, Move> MovesStats;
|
||||||
typedef Stats<false, HistoryStats> CounterMovesHistoryStats;
|
typedef Stats<false, HistoryStats> CounterMovesHistoryStats;
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +85,7 @@ public:
|
||||||
|
|
||||||
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Square);
|
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Square);
|
||||||
MovePicker(const Position&, Move, const HistoryStats&, const CounterMovesHistoryStats&, PieceType);
|
MovePicker(const Position&, Move, const HistoryStats&, const CounterMovesHistoryStats&, PieceType);
|
||||||
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Move*, Search::Stack*);
|
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Move, Search::Stack*);
|
||||||
|
|
||||||
template<bool SpNode> Move next_move();
|
template<bool SpNode> Move next_move();
|
||||||
|
|
||||||
|
@ -102,10 +99,10 @@ private:
|
||||||
const HistoryStats& history;
|
const HistoryStats& history;
|
||||||
const CounterMovesHistoryStats& counterMovesHistory;
|
const CounterMovesHistoryStats& counterMovesHistory;
|
||||||
Search::Stack* ss;
|
Search::Stack* ss;
|
||||||
Move* countermoves;
|
Move countermove;
|
||||||
Depth depth;
|
Depth depth;
|
||||||
Move ttMove;
|
Move ttMove;
|
||||||
ExtMove killers[4];
|
ExtMove killers[3];
|
||||||
Square recaptureSquare;
|
Square recaptureSquare;
|
||||||
Value captureThreshold;
|
Value captureThreshold;
|
||||||
int stage;
|
int stage;
|
||||||
|
|
|
@ -783,10 +783,9 @@ namespace {
|
||||||
moves_loop: // When in check and at SpNode search starts from here
|
moves_loop: // When in check and at SpNode search starts from here
|
||||||
|
|
||||||
Square prevMoveSq = to_sq((ss-1)->currentMove);
|
Square prevMoveSq = to_sq((ss-1)->currentMove);
|
||||||
Move countermoves[] = { Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].first,
|
Move countermove = Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq];
|
||||||
Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].second };
|
|
||||||
|
|
||||||
MovePicker mp(pos, ttMove, depth, History, CounterMovesHistory, countermoves, ss);
|
MovePicker mp(pos, ttMove, depth, History, CounterMovesHistory, countermove, ss);
|
||||||
CheckInfo ci(pos);
|
CheckInfo ci(pos);
|
||||||
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
|
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
|
||||||
improving = ss->staticEval >= (ss-2)->staticEval
|
improving = ss->staticEval >= (ss-2)->staticEval
|
||||||
|
@ -965,7 +964,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO))
|
[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO))
|
||||||
ss->reduction += ONE_PLY;
|
ss->reduction += ONE_PLY;
|
||||||
|
|
||||||
if (move == countermoves[0] || move == countermoves[1])
|
if (move == countermove)
|
||||||
ss->reduction = std::max(DEPTH_ZERO, ss->reduction - ONE_PLY);
|
ss->reduction = std::max(DEPTH_ZERO, ss->reduction - ONE_PLY);
|
||||||
|
|
||||||
// Decrease reduction for moves that escape a capture
|
// Decrease reduction for moves that escape a capture
|
||||||
|
|
Loading…
Add table
Reference in a new issue