Skip to content

Commit

Permalink
initialize best_index to zero in nega_scout (it causes ub if the dept…
Browse files Browse the repository at this point in the history
…h is 0)
  • Loading branch information
panstromek committed Feb 20, 2022
1 parent 5a4a717 commit 95bca20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion osfbook.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ nega_scout( int depth, int allow_mpc, int side_to_move,
/* First determine the best move in the current position
and its score when searched to depth DEPTH.
This is done using standard negascout with iterative deepening. */

*best_index = 0; // in case the depth is 0, we have to initialize it somehow. Maybe random index would be better than 0.
for ( curr_depth = 2 - (depth % 2); curr_depth <= depth; curr_depth += 2 ) {
low_score = -INFINITE_EVAL;
curr_alpha = -INFINITE_EVAL;
Expand Down

0 comments on commit 95bca20

Please sign in to comment.