diff -r d1420f5c5704 -r 619f07c95894 src/chess/pawn.c --- a/src/chess/pawn.c Tue Aug 25 18:35:18 2026 +0200 +++ b/src/chess/pawn.c Tue Aug 25 18:59:18 2026 +0200 @@ -33,7 +33,7 @@ bool pawn_chkrules(const GameState *gamestate, const Move *move) { int8_t d = piece_color(move->piece) == WHITE ? -1 : 1; - if (move->torow == (d < 0 ? 7 : 0)) { + if (move->torank == (d < 0 ? 7 : 0)) { if (move->promotion) { unsigned ppiecetype = piece_type(move->promotion); if (!ppiecetype || ppiecetype == PAWN || ppiecetype == KING) { @@ -49,20 +49,20 @@ } if (move->capture) { - if (move->fromrow == move->torow + d && ( + if (move->fromrank == move->torank + d && ( move->fromfile == move->tofile + 1 || move->fromfile == move->tofile - 1)) { - return piece_at(gamestate, mdst(move)) || - enpassant_threat_exists(gamestate, move->fromrow, move->tofile); + return piece_at(gamestate, move->torank, move->tofile) || + enpassant_threat_exists(gamestate, move->fromrank, move->tofile); } else { return false; } } else { if (move->fromfile == move->tofile) { - return (move->fromrow == move->torow + d) || - (move->fromrow == (d < 0 ? 1 : 6) && /* advanced first move */ - move->fromrow == move->torow + d*2); + return (move->fromrank == move->torank + d) || + (move->fromrank == (d < 0 ? 1 : 6) && /* advanced first move */ + move->fromrank == move->torank + d*2); } else { return false; } @@ -70,46 +70,48 @@ } bool pawn_isblocked(const GameState *gamestate, const Move *move) { - if (move->torow == move->fromrow + 1 || move->torow == move->fromrow - 1) { - return piece_at(gamestate, mdst(move)) && !move->capture; + if (move->torank == move->fromrank + 1 + || move->torank == move->fromrank - 1) { + return piece_at(gamestate, move->torank, move->tofile) + && !move->capture; } else { - return piece_at(gamestate, mdst(move)) || - gamestate->board[(move->fromrow+move->torow)/2][move->tofile]; + return piece_at(gamestate, move->torank, move->tofile) || + gamestate->board[(move->fromrank + move->torank) / 2][move->tofile]; } } size_t pawn_moves(const GameState *gamestate, - Color c, Row r, File f, Move *moves) { + Color c, Rank r, File f, Move *moves) { (void) gamestate; /* no (theoretical) move depends on the game state */ size_t count = 0; - int rowdelta = c == WHITE ? 1 : -1; - int promotionrow = c == WHITE ? 7 : 0; - int startrow = c == WHITE ? 1 : 6; + int rankdelta = c == WHITE ? 1 : -1; + int promotionrank = c == WHITE ? 7 : 0; + int startrank = c == WHITE ? 1 : 6; const int targets[4][3] = { - {r + rowdelta, f, 0}, - {r + rowdelta, f - 1, 1}, - {r + rowdelta, f + 1, 1}, - {r + rowdelta * 2, f, 0} + {r + rankdelta, f, 0}, + {r + rankdelta, f - 1, 1}, + {r + rankdelta, f + 1, 1}, + {r + rankdelta * 2, f, 0} }; for (size_t i = 0 ; i < 4 ; i++) { - int row = targets[i][0]; - int file = targets[i][1]; + Rank rank = targets[i][0]; + File file = targets[i][1]; - if (i == 3 && r != startrow) { + if (i == 3 && r != startrank) { continue; } - if (isidx(row) && isidx(file)) { + if (isidx(rank) && isidx(file)) { moves[count] = (Move){0}; moves[count].piece = mkpiece(PAWN, c); - moves[count].fromrow = r; + moves[count].fromrank = r; moves[count].fromfile = f; - moves[count].torow = row; + moves[count].torank = rank; moves[count].tofile = file; moves[count].capture = targets[i][2]; - if (row == promotionrow) { + if (rank == promotionrank) { moves[count].promotion = mkpiece(QUEEN, c); }