Skip to content

Commit

Permalink
Updated to "Simplification for countermoves based pruning".
Browse files Browse the repository at this point in the history
  • Loading branch information
syzygy1 committed Jun 26, 2021
1 parent 68d5df3 commit fb847b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
14 changes: 13 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,16 @@ ifeq ($(ARCH),ppc-64)
prefetch = yes
endif

ifneq ($(findstring e2k,$(ARCH)),)
arch = e2k
bits = 64
sse = yes
sse2 = yes
ssse3 = yes
sse41 = yes
popcnt = yes
endif

endif

ifeq ($(avx2),yes)
Expand Down Expand Up @@ -820,6 +830,7 @@ help:
@echo "armv7-neon > ARMv7 32-bit with popcnt and neon"
@echo "armv7 > ARMv7 32-bit"
@echo "apple-silicon > Apple silicon ARM64"
@echo "e2k > Elbrus 2000"
@echo "general-64 > unspecified 64-bit"
@echo "general-32 > unspecified 32-bit"
@echo ""
Expand Down Expand Up @@ -948,7 +959,8 @@ config-sanity: net
@test "$(optimize)" = "yes" || test "$(optimize)" = "no"
@test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || \
test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64" || \
test "$(arch)" = "e2k"
@test "$(bits)" = "32" || test "$(bits)" = "64"
@test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
@test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
Expand Down
32 changes: 3 additions & 29 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,14 +971,6 @@ INLINE Value search_node(Position *pos, Stack *ss, Value alpha, Value beta,
&& ttValue != VALUE_NONE
&& ttValue < probCutBeta))
{
if ( ss->ttHit
&& tte_depth(tte) >= depth - 3
&& ttValue != VALUE_NONE
&& ttValue >= probCutBeta
&& ttMove
&& is_capture_or_promotion(pos, ttMove))
return probCutBeta;

mp_init_pc(pos, ttMove, probCutBeta - ss->staticEval);
int probCutCount = 2 + 2 * cutNode;
bool ttPv = ss->ttPv;
Expand Down Expand Up @@ -1136,7 +1128,7 @@ INLINE Value search_node(Position *pos, Stack *ss, Value alpha, Value beta,
} else {

// Countermoves based pruning
if ( lmrDepth < 4 + ((ss-1)->statScore > 0 || (ss-1)->moveCount == 1)
if ( lmrDepth < 4
&& (*cmh )[movedPiece][to_sq(move)] < CounterMovePruneThreshold
&& (*fmh )[movedPiece][to_sq(move)] < CounterMovePruneThreshold)
continue;
Expand Down Expand Up @@ -1278,14 +1270,7 @@ INLINE Value search_node(Position *pos, Stack *ss, Value alpha, Value beta,
if (singularQuietLMR)
r--;

if (captureOrPromotion) {
// Unless giving check, this capture is likely bad
if ( !givesCheck
&& ss->staticEval + PieceValue[EG][captured_piece()] + 210 * depth <= alpha)
r++;

} else {

if (!captureOrPromotion) {
// Increase reduction if ttMove is a capture
if (ttCapture)
r++;
Expand All @@ -1304,18 +1289,7 @@ INLINE Value search_node(Position *pos, Stack *ss, Value alpha, Value beta,
+ (*pos->mainHistory)[!stm()][from_to(move)]
- 4741;

// Decrease/increase reduction by comparing with opponent's stat score.
if (ss->statScore >= -89 && (ss-1)->statScore < -116)
r--;

else if ((ss-1)->statScore >= -112 && ss->statScore < -100)
r++;

// Decrease/increase reduction for moves with a good/bad history.
if (inCheck)
r -= ( (*pos->mainHistory)[!stm()][from_to(move)]
+ (*cmh)[movedPiece][to_sq(move)] - 3833) / 16384;
else
if (!inCheck)
r -= ss->statScore / 14790;
}

Expand Down

0 comments on commit fb847b0

Please sign in to comment.