@@ -54,7 +54,7 @@ static int RetrievePV(BOARD *board, MOVE *PV, unsigned int depth)
5454 return PVlen ;
5555}
5656
57- static int AssesDraw (const BOARD * board )
57+ static int AssessDraw (const BOARD * board )
5858{
5959 if (board -> rev_plies [board -> ply ] >= 50 ) {
6060 return DRAW_VALUE ;
@@ -78,6 +78,7 @@ static int Quiescent(BOARD *board, int alpha, int beta, int root, CONTROL *contr
7878 control -> stop = 1 ;
7979 }
8080
81+ if (root > control -> seldepth ) control -> seldepth = root ;
8182 val = LazyEval (board );
8283 if (val - LAZYBETA >= beta ) return beta ;
8384 if (val + LAZYALPHA < alpha ) return alpha ;
@@ -122,6 +123,7 @@ static int AlphaBeta(BOARD *board, unsigned int depth, int alpha, int beta,
122123 int reduce = 0 , LMR = 0 ;
123124
124125 if (depth ){
126+ if (root > control -> seldepth ) control -> seldepth = root ;
125127 if (root > 0 ){
126128 val = GetHashEval (& hash_table , board -> zobrist_key , depth , alpha , beta );
127129 if (val != ERRORVALUE ) return val ;
@@ -147,12 +149,12 @@ static int AlphaBeta(BOARD *board, unsigned int depth, int alpha, int beta,
147149 if (!control -> best_move ) control -> best_move = moves [i ]; /* Better than nothing. */
148150 if (depth > 6 && !control -> ponder ){
149151 MoveToAlgeb (moves [i ], str_mov );
150- printf ("info depth %i hashfull %i currmove %s currmovenumber %i\n" ,
151- depth , hash_table .full /(hash_table .size /1000 ), str_mov , i + 1 );
152+ printf ("info depth %i seldepth %i hashfull %i currmove %s currmovenumber %i\n" ,
153+ depth , control -> seldepth , hash_table .full /(hash_table .size /1000 ), str_mov , i + 1 );
152154 }
153155 }
154156 nlegal ++ ;
155- val = AssesDraw (board );
157+ val = AssessDraw (board );
156158 if (val ) {
157159 if (best_move ){
158160 LMR = (reduce && i > good && !CAPTMASK (moves [i ]) && !InCheck (board , 0 )) ? 1 : 0 ;
@@ -227,6 +229,7 @@ void IterativeDeep(BOARD *board, CONTROL *control)
227229 clock_t curr_time = clock ();
228230 memset (sPV , 0 , SPVLEN );
229231 control -> node_count = 0 ;
232+ control -> seldepth = 0 ;
230233
231234 eval = AlphaBeta (board , depth , alpha , beta , 0 , control , 1 , killers );
232235 if (control -> stop && !control -> ponder ){
0 commit comments