Skip to content

Commit

Permalink
Clean up some pruning in the move loop around MATED scores
Browse files Browse the repository at this point in the history
This is really a bugfix, as it is possible (although rare) to return
a false MATED score when the first move searched is a MATED move,
we would trigger a research since this only happens in non PV nodes.
Thus, I do not feel the need to test this at LTC.

SPRT @ 5.0+0.05s Threads=1 Hash=2MB
LLR: 3.00 (-2.94, 2.94) [0.00, 5.00]
Games: 25675 W: 6956 L: 6670 D: 12049

BENCH : 9,484,343
  • Loading branch information
AndyGrant committed Mar 19, 2018
1 parent 479a08b commit 4095f4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/search.c
Expand Up @@ -536,7 +536,7 @@ int search(Thread* thread, PVariation* pv, int alpha, int beta, int depth, int h
// and we don't expect anything from this move, skip it.
if ( !PvNode
&& isQuiet
&& played >= 1
&& best > MATED_IN_MAX
&& futilityMargin <= alpha
&& depth <= FutilityPruningDepth)
break;
Expand All @@ -547,7 +547,7 @@ int search(Thread* thread, PVariation* pv, int alpha, int beta, int depth, int h
if ( !PvNode
&& !isQuiet
&& !inCheck
&& played >= 1
&& best > MATED_IN_MAX
&& captureIsWeak(board, &ei, currentMove, depth))
continue;

Expand All @@ -564,7 +564,7 @@ int search(Thread* thread, PVariation* pv, int alpha, int beta, int depth, int h
if ( !PvNode
&& !board->kingAttackers
&& isQuiet
&& played >= 1
&& best > MATED_IN_MAX
&& depth <= LateMovePruningDepth
&& quiets > LateMovePruningCounts[depth]){

Expand Down
5 changes: 4 additions & 1 deletion src/types.h
Expand Up @@ -26,11 +26,14 @@
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define MAX(A, B) ((A) > (B) ? (A) : (B))

#define MATE (16000)
#define MAX_DEPTH (128)
#define MAX_HEIGHT (256)
#define MAX_MOVES (256)

#define MATE (16000)
#define MATE_IN_MAX (+MATE - MAX_HEIGHT)
#define MATED_IN_MAX (-MATE + MAX_HEIGHT)

#define SQUARE_NB (64)
#define COLOUR_NB ( 2)
#define RANK_NB ( 8)
Expand Down
2 changes: 1 addition & 1 deletion src/uci.c
Expand Up @@ -82,7 +82,7 @@ int main(){
getInput(str);

if (stringEquals(str, "uci")){
printf("id name Ethereal 9.29\n");
printf("id name Ethereal 9.30\n");
printf("id author Andrew Grant\n");
printf("option name Hash type spin default 16 min 1 max 65536\n");
printf("option name Threads type spin default 1 min 1 max 2048\n");
Expand Down

0 comments on commit 4095f4c

Please sign in to comment.