move-do: save move in state, pos-print: print last move

This commit is contained in:
2024-06-28 11:44:38 +02:00
parent b8f0f6a120
commit bb13eae0b8
2 changed files with 5 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ pos_t *move_do(pos_t *pos, const move_t move, state_t *state)
pos->en_passant = SQUARE_NONE;
pos->turn = them;
pos->captured = captured;
pos->move = move;
bug_on(COLOR(piece) != us);
@@ -237,6 +238,7 @@ pos_t *move_do_alt(pos_t *pos, const move_t move, state_t *state)
pos->en_passant = SQUARE_NONE;
pos->turn = them;
pos->captured = captured;
pos->move = move;
bug_on(COLOR(piece) != us);

View File

@@ -108,6 +108,7 @@ pos_t *pos_clear(pos_t *pos)
pos->castle = 0;
pos->clock_50 = 0;
pos->plycount = 0;
pos->move = MOVE_NONE;
pos->captured = NO_PIECE;
for (square_t sq = A1; sq <= H8; ++sq)
@@ -430,8 +431,9 @@ void pos_print(const pos_t *pos)
char str[128];
board_print(pos->board);
printf("key:%lx (#%lx)", pos->key, hash_short(pos->key));
printf("fen: %s\n", pos2fen(pos, str));
printf("last move:%s ", move_to_str(str, pos->move, 0));
printf("key:%lx", pos->key);
printf("checkers:%s ", pos_checkers2str(pos, str, sizeof(str)));
printf("pinners: %s ", pos_pinners2str(pos, str, sizeof(str)));
printf("blockers: %s\n", pos_blockers2str(pos, str, sizeof(str)));