fix queen move bug

This commit is contained in:
k
2025-06-20 03:56:20 -04:00
parent 05a0b2b7f1
commit 89e00df712
3 changed files with 7 additions and 3 deletions

View File

@@ -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);