Skip to content

Commit

Permalink
Add Razoring and removed History component from LMP
Browse files Browse the repository at this point in the history
Added the same form of razoring used by SF
Removed history component from Late Move Pruning
No longer doing Late Move Pruning on checking moves
Extended the depth at which Late Move Pruning is done
Reduced move counts before enabling Late Move Pruning

-------------------------------------------------------------------------------

RazoringHistory @ 30.0+0.3 with 128MB Hash
Base                Alpha   Beta    Games   Test Elo  Base Elo  Status
LateMovePruning10   0.01    0.01    24900   2742.34   2729.09   PASSED

MATCHUPS FOR CANDIDATE
Opponent        Wins    Draws   Losses  Games   Score   ELO      +      -
Floyd0.9        974     256     320     1550    71.10%  2746.36  19.55  18.66
Laser1.0        546     412     592     1550    48.52%  2716.69  17.29  17.34
Sloppy0.2.2     992     287     271     1550    73.26%  2792.07  20.09  19.06
WyldChess1.4    934     360     256     1550    71.87%  2772.96  19.73  18.80
DiscoCheck4.03  494     414     642     1550    45.23%  2678.72  17.31  17.47
RedQueen1.1.98  574     396     580     1550    49.81%  2670.66  17.31  17.31
Ethereal8.15    753     575     222     1550    67.13%  2738.04  18.77  18.10
Tucano3.0       981     407     162     1550    76.42%  2823.26  21.05  19.78

MATCHUPS FOR BASE
Opponent        Wins    Draws   Losses  Games   Score   ELO      +      -
Floyd0.9        944     247     359     1550    68.87%  2727.95  19.08  18.32
Laser1.0        561     420     619     1600    48.19%  2714.40  17.02  17.08
Sloppy0.2.2     938     312     300     1550    70.58%  2769.02  19.44  18.58
WyldChess1.4    893     360     297     1550    69.23%  2750.83  19.15  18.37
DiscoCheck4.03  471     451     678     1600    43.53%  2666.80  17.07  17.29
RedQueen1.1.98  547     378     625     1550    47.48%  2654.50  17.29  17.38
Ethereal8.15    766     575     209     1550    67.97%  2744.69  18.92  18.20
Tucano3.0       957     393     200     1550    74.42%  2804.51  20.41  19.30

-------------------------------------------------------------------------------

RazoringHistory @ 5.0+0.05 with 128MB Hash
Base                Alpha   Beta    Games   Test Elo  Base Elo  Status
LateMovePruning10   0.01    0.01    17800   2771.24   2738.09   PASSED

MATCHUPS FOR CANDIDATE
Opponent        Wins    Draws   Losses  Games   Score   ELO      +      -
Floyd0.9        185      29       36    250     79.80%  2828.66  59.65  49.45
Laser1.0        104      60       86    250     53.60%  2752.06  43.80  43.02
Sloppy0.2.2     163      41       46    250     73.40%  2793.33  52.56  46.00
WyldChess1.4    166      45       39    250     75.40%  2804.57  54.38  46.88
DiscoCheck4.03   79      51      120    250     41.80%  2654.50  43.00  44.83
RedQueen1.1.98  116      58       76    250     58.00%  2728.07  44.77  42.99
Ethereal8.15    139      71       40    250     69.80%  2759.54  49.89  44.77
Tucano3.0       180      35       35    250     79.00%  2849.16  58.54  48.90

MATCHUPS FOR BASE
Opponent        Wins    Draws   Losses  Games   Score   ELO      +      -
Floyd0.9        1441    211     348     2000    77.33%  2803.11  18.74  17.69
Laser1.0        753     452     745     1950    50.21%  2728.43  15.43  15.43
Sloppy0.2.2     1212    344     444     2000    69.20%  2757.62  16.81  16.21
WyldChess1.4    1226    349     375     1950    71.82%  2772.53  17.53  16.79
DiscoCheck4.03  546     434     970     1950    39.13%  2635.23  15.65  15.97
RedQueen1.1.98  861     398     741     2000    53.00%  2692.87  15.30  15.22
Ethereal8.15    937     675     388     2000    63.73%  2711.88  16.05  15.65
Tucano3.0       1248    400     302     1950    74.26%  2803.03  18.10  17.23
  • Loading branch information
AndyGrant committed Jul 31, 2017
1 parent 8cd0115 commit 1c18eac
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
Binary file removed dist/Ethereal8.22.zip
Binary file not shown.
Binary file added dist/Ethereal8.23.zip
Binary file not shown.
52 changes: 41 additions & 11 deletions src/search.c
Expand Up @@ -346,6 +346,26 @@ int alphaBetaSearch(PVariation * pv, Board * board, int alpha, int beta,
optimal = eval + depth * 1.25 * PawnValue;
}

// Node Razoring at expected ALLNODEs
if (USE_RAZORING
&& nodeType != PVNODE
&& !inCheck
&& depth <= 4
&& !tableIsTactical
&& hasNonPawnMaterial(board, board->turn)
&& eval + RazorMargins[depth] < alpha){


if (depth <= 1)
return quiescenceSearch(board, alpha, beta, height);

value = quiescenceSearch(board, alpha - RazorMargins[depth],
beta - RazorMargins[depth], height);

if (value + RazorMargins[depth] < alpha)
return value;
}

// Static null move pruning
if (USE_STATIC_NULL_PRUNING
&& depth <= 3
Expand Down Expand Up @@ -413,17 +433,6 @@ int alphaBetaSearch(PVariation * pv, Board * board, int alpha, int beta,
hist = getHistoryScore(History, currentMove, board->turn, 128);
}

// Late Move Pruning
if (USE_LATE_MOVE_PRUNING
&& nodeType != PVNODE
&& played >= 1
&& !inCheck
&& isQuiet
&& depth < 6
&& quiets > LateMovePruningCounts[depth]
&& hist < 32)
continue;

// Use futility pruning
if (USE_FUTILITY_PRUNING
&& nodeType != PVNODE
Expand All @@ -441,6 +450,20 @@ int alphaBetaSearch(PVariation * pv, Board * board, int alpha, int beta,
continue;
}

// Late Move Pruning
if (USE_LATE_MOVE_PRUNING
&& nodeType != PVNODE
&& played >= 1
&& !inCheck
&& isQuiet
&& depth <= 8
&& quiets > LateMovePruningCounts[depth]
&& isNotInCheck(board, board->turn)){

revertMove(board, currentMove, undo);
continue;
}

// Update counter of moves actually played
played += 1;

Expand Down Expand Up @@ -658,4 +681,11 @@ int moveWasTactical(Undo * undo, uint16_t move){
return undo->capturePiece != EMPTY
|| MoveType(move) == PROMOTION_MOVE
|| MoveType(move) == ENPASS_MOVE;
}

int hasNonPawnMaterial(Board * board, int turn){
uint64_t friendly = board->colours[turn];
uint64_t kings = board->pieces[5];
uint64_t pawns = board->pieces[0];
return (friendly & (kings | pawns)) != friendly;
}
7 changes: 6 additions & 1 deletion src/search.h
Expand Up @@ -44,7 +44,11 @@ int moveIsTactical(Board * board, uint16_t move);

int moveWasTactical(Undo * undo, uint16_t move);

static const int LateMovePruningCounts[6] = {0, 6, 11, 15, 20, 25};
int hasNonPawnMaterial(Board * board, int turn);

static const int LateMovePruningCounts[] = {0, 6, 9, 14, 21, 30, 41, 54, 69};

static const int RazorMargins[] = {0, 450, 480, 520, 580};

#define USE_STATIC_NULL_PRUNING (1)
#define USE_FUTILITY_PRUNING (1)
Expand All @@ -53,5 +57,6 @@ static const int LateMovePruningCounts[6] = {0, 6, 11, 15, 20, 25};
#define USE_INTERNAL_ITERATIVE_DEEPENING (1)
#define USE_TRANSPOSITION_TABLE (1)
#define USE_LATE_MOVE_PRUNING (1)
#define USE_RAZORING (1)

#endif
2 changes: 1 addition & 1 deletion src/uci.c
Expand Up @@ -82,7 +82,7 @@ int main(){
http://wbec-ridderkerk.nl/html/UCIProtocol.html */

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

0 comments on commit 1c18eac

Please sign in to comment.