Skip to content

Commit

Permalink
Scale printed score to be in centipawns (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir authored Dec 23, 2019
1 parent 8040ab7 commit f18ccb9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void PrintThinking(const SearchInfo *info, Position *pos) {
// Convert score to mate score when applicable
score = score > ISMATE ? ((INFINITE - score) / 2) + 1
: score < -ISMATE ? -((INFINITE + score) / 2)
: score;
: score * 100 / P_MG;

int depth = info->IDDepth;
int seldepth = info->seldepth;
Expand Down Expand Up @@ -464,13 +464,13 @@ static int AlphaBeta(int alpha, int beta, int depth, Position *pos, SearchInfo *
static int AspirationWindow(Position *pos, SearchInfo *info) {

const int score = info->score;
// Dynamic bonus increasing initial window and delta
const int bonus = (score * score) / 256;
// Delta used for initial window and widening
const int delta = (P_MG / 2) + bonus;
// Dynamic bonus increasing initial window and relaxation delta
const int bonus = score * score;
const int initialWindow = 8 + bonus / 2048;
const int delta = 64 + bonus / 256;
// Initial window
int alpha = MAX(score - delta / 8, -INFINITE);
int beta = MIN(score + delta / 8, INFINITE);
int alpha = MAX(score - initialWindow, -INFINITE);
int beta = MIN(score + initialWindow, INFINITE);
// Counter for failed searches, bounds are relaxed more for each successive fail
unsigned fails = 0;

Expand Down

0 comments on commit f18ccb9

Please sign in to comment.