1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 11:39:15 +00:00

Split non capture in two sets when ordering

But keep same ordering. This patch is prerequisite
for future work.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-06-03 22:10:23 +01:00
parent 181cc3f93f
commit 811037c845
2 changed files with 15 additions and 11 deletions

View file

@ -32,7 +32,8 @@ namespace {
PH_GOOD_CAPTURES, // Queen promotions and captures with SEE values >= captureThreshold (captureThreshold <= 0) PH_GOOD_CAPTURES, // Queen promotions and captures with SEE values >= captureThreshold (captureThreshold <= 0)
PH_GOOD_PROBCUT, // Queen promotions and captures with SEE values > captureThreshold (captureThreshold >= 0) PH_GOOD_PROBCUT, // Queen promotions and captures with SEE values > captureThreshold (captureThreshold >= 0)
PH_KILLERS, // Killer moves from the current ply PH_KILLERS, // Killer moves from the current ply
PH_NONCAPTURES, // Non-captures and underpromotions PH_NONCAPTURES_1, // Non-captures and underpromotions with positive score
PH_NONCAPTURES_2, // Non-captures and underpromotions with non-positive score
PH_BAD_CAPTURES, // Queen promotions and captures with SEE values < captureThreshold (captureThreshold <= 0) PH_BAD_CAPTURES, // Queen promotions and captures with SEE values < captureThreshold (captureThreshold <= 0)
PH_EVASIONS, // Check evasions PH_EVASIONS, // Check evasions
PH_QCAPTURES, // Captures in quiescence search PH_QCAPTURES, // Captures in quiescence search
@ -41,7 +42,7 @@ namespace {
}; };
CACHE_LINE_ALIGNMENT CACHE_LINE_ALIGNMENT
const uint8_t MainSearchTable[] = { PH_TT_MOVE, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP }; const uint8_t MainSearchTable[] = { PH_TT_MOVE, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES_1, PH_NONCAPTURES_2, PH_BAD_CAPTURES, PH_STOP };
const uint8_t EvasionTable[] = { PH_TT_MOVE, PH_EVASIONS, PH_STOP }; const uint8_t EvasionTable[] = { PH_TT_MOVE, PH_EVASIONS, PH_STOP };
const uint8_t QsearchWithChecksTable[] = { PH_TT_MOVE, PH_QCAPTURES, PH_QCHECKS, PH_STOP }; const uint8_t QsearchWithChecksTable[] = { PH_TT_MOVE, PH_QCAPTURES, PH_QCHECKS, PH_STOP };
const uint8_t QsearchWithoutChecksTable[] = { PH_TT_MOVE, PH_QCAPTURES, PH_STOP }; const uint8_t QsearchWithoutChecksTable[] = { PH_TT_MOVE, PH_QCAPTURES, PH_STOP };
@ -152,10 +153,16 @@ void MovePicker::go_next_phase() {
lastMove = curMove + 2; lastMove = curMove + 2;
return; return;
case PH_NONCAPTURES: case PH_NONCAPTURES_1:
lastMove = generate<MV_NON_CAPTURE>(pos, moves); lastNonCapture = lastMove = generate<MV_NON_CAPTURE>(pos, moves);
score_noncaptures(); score_noncaptures();
sort_moves(moves, lastMove, &lastGoodNonCapture); sort_moves(moves, lastNonCapture, &lastMove);
return;
case PH_NONCAPTURES_2:
curMove = lastMove;
lastMove = lastNonCapture;
insertion_sort<MoveStack>(curMove, lastMove);
return; return;
case PH_BAD_CAPTURES: case PH_BAD_CAPTURES:
@ -319,11 +326,8 @@ Move MovePicker::get_next_move() {
return move; return move;
break; break;
case PH_NONCAPTURES: case PH_NONCAPTURES_1:
// Sort negative scored moves only when we get there case PH_NONCAPTURES_2:
if (curMove == lastGoodNonCapture)
insertion_sort<MoveStack>(lastGoodNonCapture, lastMove);
move = (curMove++)->move; move = (curMove++)->move;
if ( move != ttMove if ( move != ttMove
&& move != killers[0].move && move != killers[0].move

View file

@ -57,7 +57,7 @@ private:
MoveStack killers[2]; MoveStack killers[2];
int captureThreshold, phase; int captureThreshold, phase;
const uint8_t* phasePtr; const uint8_t* phasePtr;
MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures; MoveStack *curMove, *lastMove, *lastNonCapture, *badCaptures;
MoveStack moves[MAX_MOVES]; MoveStack moves[MAX_MOVES];
}; };