This commit is contained in:
2023-07-09 16:22:42 +02:00
parent 23e49f463e
commit 65f1bef987
2 changed files with 9 additions and 11 deletions

View File

@@ -146,8 +146,6 @@ void pos_check(pos_t *pos)
int rank, file; int rank, file;
piece_t piece; piece_t piece;
board_t *board = pos->board; board_t *board = pos->board;
piece_list_t *wk = list_first_entry(&pos->pieces[WHITE], piece_list_t, list),
*bk = list_first_entry(&pos->pieces[BLACK], piece_list_t, list);
/* check that board and bitboard reflect same information */ /* check that board and bitboard reflect same information */
for (rank = 7; rank >= 0; --rank) { for (rank = 7; rank >= 0; --rank) {

View File

@@ -26,7 +26,7 @@
*/ */
eval_t negamax(pos_t *pos, int depth, int color) eval_t negamax(pos_t *pos, int depth, int color)
{ {
move_t *move, bestmove; move_t *move;
pos_t *newpos; pos_t *newpos;
eval_t best = EVAL_MIN, score; eval_t best = EVAL_MIN, score;
@@ -35,9 +35,9 @@ eval_t negamax(pos_t *pos, int depth, int color)
//pos_check(pos); //pos_check(pos);
if (depth == 0) { if (depth == 0) {
score = eval(pos); score = eval(pos);
printf("evalnega=%d turn=%d color=%d", score, pos->turn, color); //printf("evalnega=%d turn=%d color=%d", score, pos->turn, color);
score *= color; score *= color;
printf(" --> evalnega=%d\n", score); //printf(" --> evalnega=%d\n", score);
return score; return score;
} }
moves_print(pos, 0); moves_print(pos, 0);
@@ -45,17 +45,17 @@ eval_t negamax(pos_t *pos, int depth, int color)
newpos = move_do(pos, move); newpos = move_do(pos, move);
score = -negamax(newpos, depth - 1, -color); score = -negamax(newpos, depth - 1, -color);
move->negamax = score; move->negamax = score;
printf("move="); //printf("move=");
move_print(0, move, 0); //move_print(0, move, 0);
printf("score=%d\n", score); //printf("score=%d\n", score);
if (score > best) { if (score > best) {
best = score; best = score;
pos->bestmove = move; pos->bestmove = move;
# ifdef DEBUG_SEARCH # ifdef DEBUG_SEARCH
printf("depth=%d best move=", depth); //printf("depth=%d best move=", depth);
move_print(0, &bestmove, 0); //move_print(0, &bestmove, 0);
printf(" eval=%d\n", best); //printf(" eval=%d\n", best);
# endif # endif
} }
move_undo(newpos, move); move_undo(newpos, move);