Skip to content

Commit c73f21d

Browse files
pb00067Disservin
authored andcommitted
Fix for SF getting stuck during search (issue #5023)
Among several passed similar versions this is the simpliest one. Passed STC non-regression https://tests.stockfishchess.org/tests/view/691f3b4aacb6dbdf23d07d11 LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 126368 W: 32607 L: 32489 D: 61272 Ptnml(0-2): 408, 13974, 34298, 14100, 404 Passed LTC non-regression https://tests.stockfishchess.org/tests/view/69209712acb6dbdf23d0836a LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 114786 W: 29097 L: 28976 D: 56713 Ptnml(0-2): 53, 11841, 33488, 11954, 57 closes #6447 Bench: 2941767
1 parent f4244e1 commit c73f21d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/search.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ void update_all_stats(const Position& pos,
141141
Move TTMove,
142142
int moveCount);
143143

144+
bool isShuffling(Move move, Stack* const ss, const Position& pos) {
145+
if (type_of(pos.moved_piece(move)) == PAWN || pos.capture_stage(move)
146+
|| pos.rule50_count() < 10)
147+
return false;
148+
if (pos.state()->pliesFromNull <= 6 || ss->ply < 20)
149+
return false;
150+
return move.from_sq() == (ss - 2)->currentMove.to_sq()
151+
&& (ss - 2)->currentMove.from_sq() == (ss - 4)->currentMove.to_sq();
152+
}
153+
144154
} // namespace
145155

146156
Search::Worker::Worker(SharedState& sharedState,
@@ -1114,7 +1124,7 @@ Value Search::Worker::search(
11141124
// and lower extension margins scale well.
11151125
if (!rootNode && move == ttData.move && !excludedMove && depth >= 6 + ss->ttPv
11161126
&& is_valid(ttData.value) && !is_decisive(ttData.value) && (ttData.bound & BOUND_LOWER)
1117-
&& ttData.depth >= depth - 3)
1127+
&& ttData.depth >= depth - 3 && !isShuffling(move, ss, pos))
11181128
{
11191129
Value singularBeta = ttData.value - (53 + 75 * (ss->ttPv && !PvNode)) * depth / 60;
11201130
Depth singularDepth = newDepth / 2;

0 commit comments

Comments
 (0)