fix queen move bug
This commit is contained in:
@@ -20,14 +20,14 @@ int negamax(game *g, int depth, int alpha, int beta, int color);
|
||||
|
||||
move *findBest(move* moves, size_t size, game* g){
|
||||
int bestScore = -INF;
|
||||
move *bestMove = moves;
|
||||
move *bestMove = NULL;
|
||||
int color = g->whiteToMove ? 1 : -1;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
game gg = *g;
|
||||
makeMove(&gg, &moves[i]);
|
||||
int score = -negamax(&gg, MAX_DEPTH, -INF, INF, -color);
|
||||
if (score > bestScore) {
|
||||
if (score > bestScore || bestScore == -INF) {
|
||||
bestScore = score;
|
||||
bestMove = &moves[i];
|
||||
printf("info score cp %d\n", g->whiteToMove ? bestScore : -bestScore);
|
||||
|
||||
Reference in New Issue
Block a user