mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
In qsearch store the cut move in TT
And upon reentering the same position try it as first. Normally qsearch moves order is already very good, first move is the cut off in almost 90% of cases. With this patch, we get a cut off on TT move of 98%. Another good side effect is that we don't generate captures and/or checks when we already have a TT move. Unfortunatly we found a TT move only in 1% of cases. So real impact of this patch is relatively low. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -50,7 +50,6 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
|
||||
////
|
||||
//// Functions
|
||||
////
|
||||
@@ -445,9 +444,9 @@ Move MovePicker::pick_move_from_list() {
|
||||
bestIndex = (movesPicked < 4 ? find_best_index() : movesPicked);
|
||||
move = moves[bestIndex].move;
|
||||
moves[bestIndex] = moves[movesPicked++];
|
||||
// Remember to change the line below if we decide to hash the qsearch!
|
||||
// Maybe also postpone the legality check until after futility pruning?
|
||||
if (/* move != ttMove && */ pos.pl_move_is_legal(move, pinned))
|
||||
// Maybe postpone the legality check until after futility pruning?
|
||||
if ( move != ttMove
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
@@ -460,8 +459,8 @@ Move MovePicker::pick_move_from_list() {
|
||||
while (movesPicked < numOfMoves)
|
||||
{
|
||||
move = moves[movesPicked++].move;
|
||||
// Remember to change the line below if we decide to hash the qsearch!
|
||||
if (/* move != ttMove && */ pos.pl_move_is_legal(move, pinned))
|
||||
if ( move != ttMove
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
@@ -473,20 +472,10 @@ Move MovePicker::pick_move_from_list() {
|
||||
}
|
||||
|
||||
|
||||
/// MovePicker::current_move_type() returns the type of the just
|
||||
/// picked next move. It can be used in search to further differentiate
|
||||
/// according to the current move type: capture, non capture, escape, etc.
|
||||
MovePicker::MovegenPhase MovePicker::current_move_type() const {
|
||||
|
||||
return PhaseTable[phaseIndex];
|
||||
}
|
||||
|
||||
|
||||
/// MovePicker::init_phase_table() initializes the PhaseTable[],
|
||||
/// MainSearchPhaseIndex, EvasionPhaseIndex, QsearchWithChecksPhaseIndex
|
||||
/// QsearchNoCapturesPhaseIndex, QsearchWithoutChecksPhaseIndex and
|
||||
/// NoMovesPhaseIndex variables. It is only called once during program
|
||||
/// startup, and never again while the program is running.
|
||||
/// and QsearchWithoutChecksPhaseIndex. It is only called once during
|
||||
/// program startup, and never again while the program is running.
|
||||
|
||||
void MovePicker::init_phase_table() {
|
||||
|
||||
@@ -511,12 +500,14 @@ void MovePicker::init_phase_table() {
|
||||
|
||||
// Quiescence search with checks
|
||||
QsearchWithChecksPhaseIndex = i - 1;
|
||||
PhaseTable[i++] = PH_TT_MOVE;
|
||||
PhaseTable[i++] = PH_QCAPTURES;
|
||||
PhaseTable[i++] = PH_QCHECKS;
|
||||
PhaseTable[i++] = PH_STOP;
|
||||
|
||||
// Quiescence search without checks
|
||||
QsearchWithoutChecksPhaseIndex = i - 1;
|
||||
PhaseTable[i++] = PH_TT_MOVE;
|
||||
PhaseTable[i++] = PH_QCAPTURES;
|
||||
PhaseTable[i++] = PH_STOP;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user