rename Row to Rank

Tue, 25 Aug 2026 18:59:18 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 25 Aug 2026 18:59:18 +0200
changeset 194
619f07c95894
parent 193
d1420f5c5704
child 195
27d02ccb0cef

rename Row to Rank

+ fix increase type safety where we overlooked it before

relates to #956

PROTOCOL.md file | annotate | diff | comparison | revisions
src/chess/bishop.c file | annotate | diff | comparison | revisions
src/chess/bishop.h file | annotate | diff | comparison | revisions
src/chess/fen.c file | annotate | diff | comparison | revisions
src/chess/king.c file | annotate | diff | comparison | revisions
src/chess/king.h file | annotate | diff | comparison | revisions
src/chess/knight.c file | annotate | diff | comparison | revisions
src/chess/knight.h file | annotate | diff | comparison | revisions
src/chess/pawn.c file | annotate | diff | comparison | revisions
src/chess/pawn.h file | annotate | diff | comparison | revisions
src/chess/pgn.c file | annotate | diff | comparison | revisions
src/chess/pgn.h file | annotate | diff | comparison | revisions
src/chess/queen.c file | annotate | diff | comparison | revisions
src/chess/queen.h file | annotate | diff | comparison | revisions
src/chess/rook.c file | annotate | diff | comparison | revisions
src/chess/rook.h file | annotate | diff | comparison | revisions
src/chess/rules.c file | annotate | diff | comparison | revisions
src/chess/rules.h file | annotate | diff | comparison | revisions
src/main.c file | annotate | diff | comparison | revisions
src/network.c file | annotate | diff | comparison | revisions
src/network.h file | annotate | diff | comparison | revisions
test/test-datatypes.c file | annotate | diff | comparison | revisions
test/test-rules-helper.c file | annotate | diff | comparison | revisions
--- a/PROTOCOL.md	Tue Aug 25 18:35:18 2026 +0200
+++ b/PROTOCOL.md	Tue Aug 25 18:59:18 2026 +0200
@@ -36,9 +36,9 @@
   * a DWORD for additional elapsed move time in microseconds
   * a BYTE describing the moved piece (see below)
   * a BYTE index for the file the piece was moved from
-  * a BYTE index for the row the piece was moved from
+  * a BYTE index for the rank the piece was moved from
   * a BYTE index for the file the piece was moved to
-  * a BYTE index for the row the piece was moved to
+  * a BYTE index for the rank the piece was moved to
   * a BYTE set to 1 if this is a capturing move and to zero if it is not
   * a BYTE set to 1 if this move gives check, 2 if it gives checkmate, and
     zero otherwise
--- a/src/chess/bishop.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/bishop.c	Tue Aug 25 18:59:18 2026 +0200
@@ -32,17 +32,17 @@
 #include <stdlib.h>
 
 bool bishop_chkrules(const Move* move) {
-    return abs(move->torow-move->fromrow) == abs(move->tofile-move->fromfile);
+    return abs(move->torank-move->fromrank) == abs(move->tofile-move->fromfile);
 }
 
 bool bishop_isblocked(const GameState *gamestate, const Move *move) {
-    int dy = move->torow > move->fromrow ? 1 : -1;
+    int dy = move->torank > move->fromrank ? 1 : -1;
     int dx = move->tofile > move->fromfile ? 1 : -1;
     
-    uint8_t y = move->fromrow;
-    uint8_t x = move->fromfile;
+    Rank y = move->fromrank;
+    File x = move->fromfile;
     
-    while (x != move->tofile-dx && y != move->torow-dy) {
+    while (x != move->tofile-dx && y != move->torank-dy) {
         x += dx;
         y += dy;
         if (gamestate->board[y][x]) {
@@ -54,7 +54,7 @@
 }
 
 size_t bishop_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves) {
+        Color c, Rank r, File f, Move *moves) {
 
     size_t count = 0;
     const int directions[4][2] = {
@@ -65,20 +65,20 @@
     };
 
     for (size_t i = 0 ; i < 4 ; i++) {
-        int row = r + directions[i][0];
+        int rank = r + directions[i][0];
         int file = f + directions[i][1];
 
-        while (isidx(row) && isidx(file)) {
+        while (isidx(rank) && isidx(file)) {
             moves[count] = (Move){0};
             moves[count].piece = mkpiece(BISHOP, 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 = piece_at(gamestate, row, file) != 0;
+            moves[count].capture = piece_at(gamestate, rank, file) != 0;
             count++;
 
-            row += directions[i][0];
+            rank += directions[i][0];
             file += directions[i][1];
         }
     }
--- a/src/chess/bishop.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/bishop.h	Tue Aug 25 18:59:18 2026 +0200
@@ -41,9 +41,9 @@
 
 #define BISHOP_MOVES_MAX 13
 size_t bishop_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
-#define bishop_moves_allowed(gamestate, color, row, file, moves) \
-        filter_moves_allowed(gamestate, color, row, file, moves, bishop_moves)
+        Color c, Rank r, File f, Move *moves);
+#define bishop_moves_allowed(gamestate, color, rank, file, moves) \
+        filter_moves_allowed(gamestate, color, rank, file, moves, bishop_moves)
 
 #ifdef	__cplusplus
 }
--- a/src/chess/fen.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/fen.c	Tue Aug 25 18:59:18 2026 +0200
@@ -34,15 +34,16 @@
 
 static size_t fen_pieces(char *str, GameState *gamestate) {
     size_t i = 0;
-    for (int row = 7 ; row >= 0 ; row--) {
+    Rank rank = 7;
+    do {
         unsigned int skip = 0;
-        for (int file = 0 ; file < 8 ; file++) {
-            if (gamestate->board[row][file]) {
+        for (File file = 0 ; file < 8 ; file++) {
+            if (gamestate->board[rank][file]) {
                 if (skip > 0) {
                     str[i++] = '0'+skip;
                     skip = 0;
                 }
-                switch (piece_at(gamestate, row, file)) {
+                switch (piece_at(gamestate, rank, file)) {
                 case WHITE|KING: str[i++] = 'K'; break;
                 case WHITE|QUEEN: str[i++] = 'Q'; break;
                 case WHITE|BISHOP: str[i++] = 'B'; break;
@@ -63,10 +64,10 @@
         if (skip > 0) {
             str[i++] = '0'+skip;
         }
-        if (row > 0) {
+        if (rank > 0) {
             str[i++] = '/';
         }
-    }
+    } while (rank-- > 0);
 
     return i;
 }
@@ -77,11 +78,11 @@
 }
 
 static bool fen_castling_chkmoved(GameState *gamestate,
-    uint8_t row, uint8_t file) {
+    Rank rank, File file) {
 
     for (unsigned i = 0 ; i < gamestate->movecount ; i++) {
         if (gamestate->moves[i].fromfile == file
-            && gamestate->moves[i].fromrow == row) {
+            && gamestate->moves[i].fromrank == rank) {
             return true;
         }
     }
@@ -92,17 +93,17 @@
 static size_t fen_castling(char *str, GameState *gamestate) {
     bool K, Q, k, q;
 
-    if (fen_castling_chkmoved(gamestate, rowidx('1'), fileidx('e'))) {
+    if (fen_castling_chkmoved(gamestate, rankidx('1'), fileidx('e'))) {
         K = Q = false;
     } else {
-        K = !fen_castling_chkmoved(gamestate, rowidx('1'), fileidx('h'));
-        Q = !fen_castling_chkmoved(gamestate, rowidx('1'), fileidx('a'));
+        K = !fen_castling_chkmoved(gamestate, rankidx('1'), fileidx('h'));
+        Q = !fen_castling_chkmoved(gamestate, rankidx('1'), fileidx('a'));
     }
-    if (fen_castling_chkmoved(gamestate, rowidx('8'), fileidx('e'))) {
+    if (fen_castling_chkmoved(gamestate, rankidx('8'), fileidx('e'))) {
         k = q = false;
     } else {
-        k = !fen_castling_chkmoved(gamestate, rowidx('8'), fileidx('h'));
-        q = !fen_castling_chkmoved(gamestate, rowidx('8'), fileidx('a'));
+        k = !fen_castling_chkmoved(gamestate, rankidx('8'), fileidx('h'));
+        q = !fen_castling_chkmoved(gamestate, rankidx('8'), fileidx('a'));
     }
 
     size_t i = 0;
@@ -122,11 +123,11 @@
     for (int file = 0 ; file < 8 ; file++) {
         if (enpassant_threat_exists(gamestate, 3, file)) {
             str[0] = filechr(file);
-            str[1] = rowchr(2);
+            str[1] = rankchr(2);
         }
         if (enpassant_threat_exists(gamestate, 4, file)) {
             str[0] = filechr(file);
-            str[1] = rowchr(5);
+            str[1] = rankchr(5);
         }
     }
 
--- a/src/chess/king.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/king.c	Tue Aug 25 18:59:18 2026 +0200
@@ -31,11 +31,11 @@
 #include "king.h"
 
 static bool king_castling_chkmoved(
-        const GameState *gamestate, Row row, File file) {
+        const GameState *gamestate, Rank rank, File file) {
 
     for (unsigned i = 0; i < gamestate->movecount; i++) {
         if (gamestate->moves[i].fromfile == file
-            && gamestate->moves[i].fromrow == row) {
+            && gamestate->moves[i].fromrank == rank) {
             return true;
         }
     }
@@ -44,19 +44,19 @@
 }
 
 bool king_chkrules(const GameState *gamestate, const Move* move) {
-    if (abs(move->torow - move->fromrow) <= 1 &&
+    if (abs(move->torank - move->fromrank) <= 1 &&
         abs(move->tofile - move->fromfile) <= 1) {
         return true;
     } else {
         /* castling */
-        if (move->fromrow == move->torow &&
-            move->fromrow == (piece_color(move->piece) == WHITE ? 0 : 7) &&
+        if (move->fromrank == move->torank &&
+            move->fromrank == (piece_color(move->piece) == WHITE ? 0 : 7) &&
             move->fromfile == fileidx('e') &&
             (move->tofile == fileidx('c') || move->tofile == fileidx('g'))) {
             
             return !king_castling_chkmoved(gamestate,
-                move->fromrow, move->fromfile) &&
-                !king_castling_chkmoved(gamestate, move->fromrow,
+                move->fromrank, move->fromfile) &&
+                !king_castling_chkmoved(gamestate, move->fromrank,
                 move->tofile == fileidx('c') ? 0 : 7);
         } else {
             return false;
@@ -66,7 +66,7 @@
 
 bool king_isblocked(const GameState *gamestate, const Move *move) {
     
-    uint8_t op_color = opponent_color(piece_color(move->piece));
+    Color op_color = opponent_color(piece_color(move->piece));
     
     /* being in check does not "block" the king, so don't test it here */
     bool blocked = false;
@@ -74,22 +74,22 @@
     /* just test, if castling move is blocked */
     if (abs(move->tofile - move->fromfile) == 2) {
         if (move->tofile == fileidx('c')) {
-            blocked |= gamestate->board[move->torow][fileidx('b')];
+            blocked |= gamestate->board[move->torank][fileidx('b')];
         }
-        uint8_t midfile = (move->tofile+move->fromfile)/2;
+        File midfile = (move->tofile+move->fromfile)/2;
         bool incheck = false;
         if (gamestate->movecount > 0) {
             incheck = is_check_position(gamestate);
         }
-        blocked |= incheck || gamestate->board[move->torow][midfile] ||
-            is_covered(gamestate, move->torow, midfile, op_color);
+        blocked |= incheck || gamestate->board[move->torank][midfile] ||
+            is_covered(gamestate, move->torank, midfile, op_color);
     }
     
     return blocked;
 }
 
 size_t king_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves) {
+        Color c, Rank r, File f, Move *moves) {
 
     size_t count = 0;
     Piece king = mkpiece(KING, c);
@@ -100,39 +100,39 @@
                 continue;
             }
 
-            Row torow = r + dr;
+            Rank torank = r + dr;
             File tofile = f + df;
 
-            if (!isidx(torow) || !isidx(tofile)) {
+            if (!isidx(torank) || !isidx(tofile)) {
                 continue;
             }
 
             moves[count] = (Move){0};
             moves[count].piece = king;
-            moves[count].fromrow = r;
+            moves[count].fromrank = r;
             moves[count].fromfile = f;
-            moves[count].torow = torow;
+            moves[count].torank = torank;
             moves[count].tofile = tofile;
-            moves[count].capture = piece_at(gamestate, torow, tofile) != 0;
+            moves[count].capture = piece_at(gamestate, torank, tofile) != 0;
             count++;
         }
     }
 
-    Row homerow = c == WHITE ? 0 : 7;
-    if (r == homerow && f == fileidx('e')) {
+    Rank homerank = c == WHITE ? 0 : 7;
+    if (r == homerank && f == fileidx('e')) {
         moves[count] = (Move){0};
         moves[count].piece = king;
-        moves[count].fromrow = r;
+        moves[count].fromrank = r;
         moves[count].fromfile = f;
-        moves[count].torow = r;
+        moves[count].torank = r;
         moves[count].tofile = fileidx('c');
         count++;
 
         moves[count] = (Move){0};
         moves[count].piece = king;
-        moves[count].fromrow = r;
+        moves[count].fromrank = r;
         moves[count].fromfile = f;
-        moves[count].torow = r;
+        moves[count].torank = r;
         moves[count].tofile = fileidx('g');
         count++;
     }
--- a/src/chess/king.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/king.h	Tue Aug 25 18:59:18 2026 +0200
@@ -42,9 +42,9 @@
 
 #define KING_MOVES_MAX 8
 size_t king_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
-#define king_moves_allowed(gamestate, color, row, file, moves) \
-        filter_moves_allowed(gamestate, color, row, file, moves, king_moves)
+        Color c, Rank r, File f, Move *moves);
+#define king_moves_allowed(gamestate, color, rank, file, moves) \
+        filter_moves_allowed(gamestate, color, rank, file, moves, king_moves)
 
 #ifdef	__cplusplus
 }
--- a/src/chess/knight.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/knight.c	Tue Aug 25 18:59:18 2026 +0200
@@ -33,13 +33,13 @@
 
 bool knight_chkrules(const Move *move) {
     int dx = abs(move->fromfile - move->tofile);
-    int dy = abs(move->fromrow - move->torow);
+    int dy = abs(move->fromrank - move->torank);
     
     return (dx == 2 && dy == 1) || (dx == 1 && dy == 2);
 }
 
 size_t knight_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves) {
+        Color c, Rank r, File f, Move *moves) {
 
     size_t count = 0;
     const int offsets[8][2] = {
@@ -54,17 +54,17 @@
     };
 
     for (size_t i = 0 ; i < 8 ; i++) {
-        int row = r + offsets[i][0];
-        int file = f + offsets[i][1];
+        Rank rank = r + offsets[i][0];
+        File file = f + offsets[i][1];
 
-        if (isidx(row) && isidx(file)) {
+        if (isidx(rank) && isidx(file)) {
             moves[count] = (Move){0};
             moves[count].piece = mkpiece(KNIGHT, 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 = piece_at(gamestate, row, file) != 0;
+            moves[count].capture = piece_at(gamestate, rank, file) != 0;
             count++;
         }
     }
--- a/src/chess/knight.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/knight.h	Tue Aug 25 18:59:18 2026 +0200
@@ -41,9 +41,9 @@
 
 #define KNIGHT_MOVES_MAX 8
 size_t knight_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
-#define knight_moves_allowed(gamestate, color, row, file, moves) \
-        filter_moves_allowed(gamestate, color, row, file, moves, knight_moves)
+        Color c, Rank r, File f, Move *moves);
+#define knight_moves_allowed(gamestate, color, rank, file, moves) \
+        filter_moves_allowed(gamestate, color, rank, file, moves, knight_moves)
 
 #ifdef	__cplusplus
 }
--- 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);
             }
 
--- a/src/chess/pawn.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/pawn.h	Tue Aug 25 18:59:18 2026 +0200
@@ -41,9 +41,9 @@
 
 #define PAWN_MOVES_MAX 4
 size_t pawn_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
-#define pawn_moves_allowed(gamestate, color, row, file, moves) \
-        filter_moves_allowed(gamestate, color, row, file, moves, pawn_moves)
+        Color c, Rank r, File f, Move *moves);
+#define pawn_moves_allowed(gamestate, color, rank, file, moves) \
+        filter_moves_allowed(gamestate, color, rank, file, moves, pawn_moves)
 
 #ifdef	__cplusplus
 }
--- a/src/chess/pgn.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/pgn.c	Tue Aug 25 18:59:18 2026 +0200
@@ -133,7 +133,7 @@
     
     char movestr[10];
     Move move;
-    uint8_t curcol = WHITE;
+    Color curcol = WHITE;
     bool movetext_ends_with_result = false;
     
     while (true) {
@@ -302,7 +302,7 @@
     return date;
 }
 
-const char *pgn_player_name(const GameState *gamestate, uint8_t color) {
+const char *pgn_player_name(const GameState *gamestate, Color color) {
     const char *name = color == WHITE ? gamestate->wname : gamestate->bname;
     return name[0] != '\0' ? name : "Anonymous";
 }
--- a/src/chess/pgn.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/pgn.h	Tue Aug 25 18:59:18 2026 +0200
@@ -57,7 +57,7 @@
 int parse_pgn(const char *data, GameState *gamestate);
 char *create_pgn(const GameState *gamestate, bool export_comments);
 
-const char *pgn_player_name(const GameState *gamestate, uint8_t color);
+const char *pgn_player_name(const GameState *gamestate, Color color);
 
 const char* pgn_error_str(int code);
 size_t pgn_error_position(void);
--- a/src/chess/queen.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/queen.c	Tue Aug 25 18:59:18 2026 +0200
@@ -45,7 +45,7 @@
 }
 
 size_t queen_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves) {
+        Color c, Rank r, File f, Move *moves) {
 
     size_t count = 0;
     const int directions[8][2] = {
@@ -60,20 +60,20 @@
     };
 
     for (size_t i = 0 ; i < 8 ; i++) {
-        int row = r + directions[i][0];
-        int file = f + directions[i][1];
+        Rank rank = r + directions[i][0];
+        File file = f + directions[i][1];
 
-        while (isidx(row) && isidx(file)) {
+        while (isidx(rank) && isidx(file)) {
             moves[count] = (Move){0};
             moves[count].piece = mkpiece(QUEEN, 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 = piece_at(gamestate, row, file) != 0;
+            moves[count].capture = piece_at(gamestate, rank, file) != 0;
             count++;
 
-            row += directions[i][0];
+            rank += directions[i][0];
             file += directions[i][1];
         }
     }
--- a/src/chess/queen.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/queen.h	Tue Aug 25 18:59:18 2026 +0200
@@ -41,9 +41,9 @@
 
 #define QUEEN_MOVES_MAX 27
 size_t queen_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
-#define queen_moves_allowed(gamestate, color, row, file, moves) \
-        filter_moves_allowed(gamestate, color, row, file, moves, queen_moves)
+        Color c, Rank r, File f, Move *moves);
+#define queen_moves_allowed(gamestate, color, rank, file, moves) \
+        filter_moves_allowed(gamestate, color, rank, file, moves, queen_moves)
 
 #ifdef	__cplusplus
 }
--- a/src/chess/rook.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/rook.c	Tue Aug 25 18:59:18 2026 +0200
@@ -31,24 +31,24 @@
 #include "rook.h"
 
 bool rook_chkrules(const Move *move) {
-    return move->torow == move->fromrow || move->tofile == move->fromfile;
+    return move->torank == move->fromrank || move->tofile == move->fromfile;
 }
 
 bool rook_isblocked(const GameState *gamestate, const Move *move) {
     
-    if (move->torow == move->fromrow) {
+    if (move->torank == move->fromrank) {
         int d = move->tofile > move->fromfile ? 1 : -1;
-        uint8_t f = move->fromfile;
+        File f = move->fromfile;
         while (f != move->tofile-d) {
             f += d;
-            if (gamestate->board[move->fromrow][f]) {
+            if (gamestate->board[move->fromrank][f]) {
                 return true;
             }
         }
     } else {
-        int d = move->torow > move->fromrow ? 1 : -1;
-        uint8_t r = move->fromrow;
-        while (r != move->torow - d) {
+        int d = move->torank > move->fromrank ? 1 : -1;
+        Rank r = move->fromrank;
+        while (r != move->torank - d) {
             r += d;
             if (gamestate->board[r][move->fromfile]) {
                 return true;
@@ -60,7 +60,7 @@
 }
 
 size_t rook_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves) {
+        Color c, Rank r, File f, Move *moves) {
     size_t count = 0;
     const int directions[4][2] = {
         { 1,  0},
@@ -70,20 +70,20 @@
     };
 
     for (size_t i = 0 ; i < 4 ; i++) {
-        int row = r + directions[i][0];
-        int file = f + directions[i][1];
+        Rank rank = r + directions[i][0];
+        File file = f + directions[i][1];
 
-        while (isidx(row) && isidx(file)) {
+        while (isidx(rank) && isidx(file)) {
             moves[count] = (Move){0};
             moves[count].piece = mkpiece(ROOK, 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 = piece_at(gamestate, row, file) != 0;
+            moves[count].capture = piece_at(gamestate, rank, file) != 0;
             count++;
 
-            row += directions[i][0];
+            rank += directions[i][0];
             file += directions[i][1];
         }
     }
--- a/src/chess/rook.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/rook.h	Tue Aug 25 18:59:18 2026 +0200
@@ -41,9 +41,9 @@
 
 #define ROOK_MOVES_MAX 14
 size_t rook_moves(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
-#define rook_moves_allowed(gamestate, color, row, file, moves) \
-        filter_moves_allowed(gamestate, color, row, file, moves, rook_moves)
+        Color c, Rank r, File f, Move *moves);
+#define rook_moves_allowed(gamestate, color, rank, file, moves) \
+        filter_moves_allowed(gamestate, color, rank, file, moves, rook_moves)
 
 #ifdef	__cplusplus
 }
--- a/src/chess/rules.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/rules.c	Tue Aug 25 18:59:18 2026 +0200
@@ -126,7 +126,7 @@
 }
 
 size_t piece_moves_allowed(const GameState *gamestate,
-        Row r, File f, Move *moves) {
+        Rank r, File f, Move *moves) {
     Piece p = piece_at(gamestate, r, f);
     Color c = piece_color(p);
     switch (piece_type(p)) {
@@ -152,7 +152,7 @@
 
     /* scan the board for pieces of the next player's color */
     Move moves[QUEEN_MOVES_MAX];
-    for (Row r = 0; r < 8; r++) {
+    for (Rank r = 0; r < 8; r++) {
         for (File f = 0; f < 8; f++) {
             if (piece_color(piece_at(gamestate, r, f)) == next_player
                 && piece_moves_allowed(gamestate, r, f, moves) > 0) {
@@ -203,7 +203,7 @@
     unsigned op_piece_count[7] = {0};
     bool has_bbishop = false, has_wbishop = false;
     bool op_has_bbishop = false, op_has_wbishop = false;
-    for (Row r = 0 ; r < 8 ; r++) {
+    for (Rank r = 0 ; r < 8 ; r++) {
         for (File f = 0 ; f < 8 ; f++) {
             Piece p = piece_at(gamestate, r, f);
             if (piece_color(p) == color) {
@@ -320,8 +320,8 @@
 static void apply_move_internal(GameState *gamestate, Move *move) {
     /* en passant capture */
     if (move->capture && piece_type(move->piece) == PAWN &&
-            piece_at(gamestate, mdst(move)) == 0) {
-        piece_remove(gamestate, move->fromrow, move->tofile);
+            piece_at(gamestate, move->torank, move->tofile) == 0) {
+        piece_remove(gamestate, move->fromrank, move->tofile);
     }
     
     /* remove old en passant threats */
@@ -331,29 +331,29 @@
     }
     
     /* move (and maybe capture or promote) */
-    piece_remove(gamestate, msrc(move));
+    piece_remove(gamestate, move->fromrank, move->fromfile);
     if (move->promotion) {
-        piece_set(gamestate, mdst(move), move->promotion);
+        piece_set(gamestate, move->torank, move->tofile, move->promotion);
     } else {
-        piece_set(gamestate, mdst(move), move->piece);
+        piece_set(gamestate, move->torank, move->tofile, move->piece);
     }
 
     /* add new en passant threat */
     if (piece_type(move->piece) == PAWN && (
-            (move->fromrow == 1 && move->torow == 3) ||
-            (move->fromrow == 6 && move->torow == 4))) {
-        enpassant_threat_add(gamestate, move->torow, move->tofile);
+            (move->fromrank == 1 && move->torank == 3) ||
+            (move->fromrank == 6 && move->torank == 4))) {
+        enpassant_threat_add(gamestate, move->torank, move->tofile);
     }
     
     /* castling */
     if (piece_type(move->piece) == KING && move->fromfile == fileidx('e')) {
         const Color color = piece_color(move->piece);
         if (move->tofile == fileidx('g')) {
-            gamestate->board[move->torow][fileidx('h')] = 0;
-            gamestate->board[move->torow][fileidx('f')] = mkpiece(ROOK, color);
+            gamestate->board[move->torank][fileidx('h')] = 0;
+            gamestate->board[move->torank][fileidx('f')] = mkpiece(ROOK, color);
         } else if (move->tofile == fileidx('c')) {
-            gamestate->board[move->torow][fileidx('a')] = 0;
-            gamestate->board[move->torow][fileidx('d')] = mkpiece(ROOK, color);
+            gamestate->board[move->torank][fileidx('a')] = 0;
+            gamestate->board[move->torank][fileidx('d')] = mkpiece(ROOK, color);
         }
     }
     
@@ -421,13 +421,13 @@
     Color piececolor = piece_color(move->piece);
     Color oppcolor = opponent_color(piececolor);
     File opkingfile = 0;
-    Row opkingrow = 0;
-    for (Row row = 0 ; row < 8 ; row++) {
+    Rank opkingrank = 0;
+    for (Rank rank = 0 ; rank < 8 ; rank++) {
         for (File file = 0 ; file < 8 ; file++) {
-            Piece p = piece_at(&simulation, row, file);
+            Piece p = piece_at(&simulation, rank, file);
             if (p == mkpiece(KING, oppcolor)) {
                 opkingfile = file;
-                opkingrow = row;
+                opkingrank = rank;
             }
         }
     }
@@ -435,7 +435,7 @@
     /* determine if the opposing king is now threatened */
     Move threats[16];
     size_t threatcount;
-    bool incheck = get_threats(&simulation, opkingrow, opkingfile,
+    bool incheck = get_threats(&simulation, opkingrank, opkingfile,
         piececolor, threats, &threatcount);
 
     if (!incheck) {
@@ -448,7 +448,7 @@
     for (int dr = -1 ; dr <= 1 && !canescape ; dr++) {
         for (int df = -1 ; df <= 1 && !canescape ; df++) {
             if (dr == 0 && df == 0) continue;
-            Row er = opkingrow + dr;
+            Rank er = opkingrank + dr;
             File ef = opkingfile + df;
             if (!isidx(er) || !isidx(ef)) continue;
 
@@ -466,9 +466,9 @@
                 GameState sim_retaliate = gamestate_copy_sim(&simulation);
                 Move move_retaliate = {0};
                 move_retaliate.piece = mkpiece(KING, oppcolor);
-                move_retaliate.fromrow = opkingrow;
+                move_retaliate.fromrank = opkingrank;
                 move_retaliate.fromfile = opkingfile;
-                move_retaliate.torow = er;
+                move_retaliate.torank = er;
                 move_retaliate.tofile = ef;
                 move_retaliate.capture = true;
                 apply_move_internal(&sim_retaliate, &move_retaliate);
@@ -485,7 +485,7 @@
     /* can't escape, can the king be rescued? */
     if (!canescape && threatcount == 1) {
         canescape = is_protected(&simulation,
-                threats[0].fromrow, threats[0].fromfile, oppcolor);
+                threats[0].fromrank, threats[0].fromfile, oppcolor);
     }
 
     /* can't capture, can he block? */
@@ -495,36 +495,36 @@
 
         /* knight, pawns and the king cannot be blocked */
         if (tptype == BISHOP || tptype == ROOK || tptype == QUEEN) {
-            if (threat->fromrow == threat->torow) {
-                /* rook aspect (on row) */
+            if (threat->fromrank == threat->torank) {
+                /* rook aspect (on rank) */
                 int d = threat->tofile > threat->fromfile ? 1 : -1;
                 File file = threat->fromfile;
                 while (!canescape && file != threat->tofile - d) {
                     file += d;
                     canescape |= is_protected(&simulation,
-                        threat->torow, file, oppcolor);
+                        threat->torank, file, oppcolor);
                 }
             } else if (threat->fromfile == threat->tofile) {
                 /* rook aspect (on file) */
-                int d = threat->torow > threat->fromrow ? 1 : -1;
-                Row row = threat->fromrow;
-                while (!canescape && row != threat->torow - d) {
-                    row += d;
+                int d = threat->torank > threat->fromrank ? 1 : -1;
+                Rank rank = threat->fromrank;
+                while (!canescape && rank != threat->torank - d) {
+                    rank += d;
                     canescape |= is_protected(&simulation,
-                        row, threat->tofile, oppcolor);
+                        rank, threat->tofile, oppcolor);
                 }
             } else {
                 /* bishop aspect */
-                int dr = threat->torow > threat->fromrow ? 1 : -1;
+                int dr = threat->torank > threat->fromrank ? 1 : -1;
                 int df = threat->tofile > threat->fromfile ? 1 : -1;
 
-                Row row = threat->fromrow;
+                Rank rank = threat->fromrank;
                 File file = threat->fromfile;
                 while (!canescape && file != threat->tofile - df
-                        && row != threat->torow - dr) {
-                    row += dr;
+                        && rank != threat->torank - dr) {
+                    rank += dr;
                     file += df;
-                    canescape |= is_protected(&simulation, row, file,
+                    canescape |= is_protected(&simulation, rank, file,
                         oppcolor);
                 }
             }
@@ -566,33 +566,33 @@
             /* resolve ambiguities, if any */
             Move candidates[16];
             size_t ccount;
-            if (get_real_candidates(gamestate, move->torow, move->tofile,
+            if (get_real_candidates(gamestate, move->torank, move->tofile,
                     piece_color(move->piece), candidates, &ccount)) {
-                unsigned int ambrows = 0, ambfiles = 0, ambpiece = 0;
+                unsigned int ambranks = 0, ambfiles = 0, ambpiece = 0;
                 for (size_t i = 0 ; i < ccount ; i++) {
                     if (candidates[i].piece == move->piece) {
                         ambpiece++;
-                        if (candidates[i].fromrow == move->fromrow) {
-                            ambrows++;
+                        if (candidates[i].fromrank == move->fromrank) {
+                            ambranks++;
                         }
                         if (candidates[i].fromfile == move->fromfile) {
                             ambfiles++;
                         }
                     }
                 }
-                /* neither file, nor row are ambiguous, name file */
-                if (ambpiece > 1 && ambrows == 1 && ambfiles == 1) {
+                /* neither file, nor rank are ambiguous, name file */
+                if (ambpiece > 1 && ambranks == 1 && ambfiles == 1) {
                     /* this is most likely the case with Knights
                      * in diagonal opposition */
                     string[idx++] = filechr(move->fromfile);
                 } else {
-                    /* ambiguous row, name file */
-                    if (ambrows > 1) {
+                    /* ambiguous rank, name file */
+                    if (ambranks > 1) {
                         string[idx++] = filechr(move->fromfile);
                     }
-                    /* ambiguous file, name row */
+                    /* ambiguous file, name rank */
                     if (ambfiles > 1) {
-                        string[idx++] = rowchr(move->fromrow);
+                        string[idx++] = rankchr(move->fromrank);
                     }
                 }
             }
@@ -605,7 +605,7 @@
 
         /* destination */
         string[idx++] = filechr(move->tofile);
-        string[idx++] = rowchr(move->torow);
+        string[idx++] = rankchr(move->torank);
 
         /* promotion? */
         if (move->promotion) {
@@ -626,23 +626,23 @@
     assert((move->piece & ~(PIECE_MASK|COLOR_MASK)) == 0);
 
     /* validate indices (don't trust opponent) */
-    if (!isidx(move->fromrow) || !isidx(move->fromfile) ||
-        !isidx(move->torow) || !isidx(move->tofile)) {
+    if (!isidx(move->fromrank) || !isidx(move->fromfile) ||
+        !isidx(move->torank) || !isidx(move->tofile)) {
         return INVALID_MOVE_SYNTAX;
     }
 
     /* must move */
-    if (move->fromfile == move->tofile && move->fromrow == move->torow) {
+    if (move->fromfile == move->tofile && move->fromrank == move->torank) {
         return RULES_VIOLATED;
     }
 
     /* does piece exist */
-    if (piece_at(gamestate, msrc(move)) != move->piece) {
+    if (piece_at(gamestate, move->fromrank, move->fromfile) != move->piece) {
         return PIECE_NOT_FOUND;
     }
 
     /* is there any piece at the destination? */
-    Piece piece_at_dst = piece_at(gamestate, mdst(move));
+    Piece piece_at_dst = piece_at(gamestate, move->torank, move->tofile);
 
     /* can't capture own pieces */
     if (piece_color(piece_at_dst) == piece_color(move->piece)) {
@@ -654,7 +654,7 @@
         /* ... or the capture happens en passant */
         if (!move->capture || piece_type(move->piece) != PAWN ||
                 !enpassant_threat_exists(gamestate,
-                    move->fromrow, move->tofile)) {
+                    move->fromrank, move->tofile)) {
             return RULES_VIOLATED;
         }
     }
@@ -706,17 +706,17 @@
     Color piececolor = piece_color(move->piece);
     Color oppcolor = opponent_color(piececolor);
     File kingfile = 0;
-    Row kingrow = 0;
-    for (Row row = 0 ; row < 8 ; row++) {
+    Rank kingrank = 0;
+    for (Rank rank = 0 ; rank < 8 ; rank++) {
         for (File file = 0 ; file < 8 ; file++) {
-            Piece p = piece_at(&simulation, row, file);
+            Piece p = piece_at(&simulation, rank, file);
             if (p == mkpiece(KING, piececolor)) {
                 kingfile = file;
-                kingrow = row;
+                kingrank = rank;
             }
         }
     }
-    if (is_covered(&simulation, kingrow, kingfile, oppcolor)) {
+    if (is_covered(&simulation, kingrank, kingfile, oppcolor)) {
         if (piece_type(move->piece) == KING) {
             result = KING_MOVES_INTO_CHECK;
         } else {
@@ -752,30 +752,30 @@
     return VALID_MOVE_SEMANTICS;
 }
 
-Piece piece_at(const GameState *gamestate, Row row, File file) {
-    return gamestate->board[row][file] & (PIECE_MASK|COLOR_MASK);
+Piece piece_at(const GameState *gamestate, Rank rank, File file) {
+    return gamestate->board[rank][file] & (PIECE_MASK|COLOR_MASK);
 }
 
-void piece_set(GameState *gamestate, Row row, File file, Piece piece) {
-    gamestate->board[row][file] = piece;
+void piece_set(GameState *gamestate, Rank rank, File file, Piece piece) {
+    gamestate->board[rank][file] = piece;
 }
 
-bool get_candidates(const GameState *gamestate, Row row, File file,
+bool get_candidates(const GameState *gamestate, Rank rank, File file,
         Color color, Move *moves, size_t *movecount) {
     Move candidates[32];
     size_t ccount = 0;
-    for (Row r = 0 ; r < 8 ; r++) {
+    for (Rank r = 0 ; r < 8 ; r++) {
         for (File f = 0 ; f < 8 ; f++) {
             Piece p = piece_at(gamestate, r, f);
             if (piece_color(p) == color) {
                 /* non-capturing move */
                 memset(&(candidates[ccount]), 0, sizeof(Move));
                 candidates[ccount].piece = p;
-                candidates[ccount].fromrow = r;
+                candidates[ccount].fromrank = r;
                 candidates[ccount].fromfile = f;
-                candidates[ccount].torow = row;
+                candidates[ccount].torank = rank;
                 candidates[ccount].tofile = file;
-                if (piece_type(p) == PAWN && (row == 0 || row == 7)) {
+                if (piece_type(p) == PAWN && (rank == 0 || rank == 7)) {
                     /* the exact piece for promotion does not matter */
                     candidates[ccount].promotion = mkpiece(QUEEN, color);
                 }
@@ -809,31 +809,31 @@
     return result;
 }
 
-bool get_threats(const GameState *gamestate, Row row, File file,
+bool get_threats(const GameState *gamestate, Rank rank, File file,
         Color color, Move *threats, size_t *threatcount) {
 
     /* simulate a capturing move on the target position */
     Color opcolor = opponent_color(color);
     GameState simulation = gamestate_copy_sim(gamestate);
-    if (piece_color(piece_at(&simulation, row, file)) != opcolor) {
+    if (piece_color(piece_at(&simulation, rank, file)) != opcolor) {
         /* set a fake pawn if the field is not occupied by the opponent */
-        piece_set(&simulation, row, file, mkpiece(PAWN, opcolor));
+        piece_set(&simulation, rank, file, mkpiece(PAWN, opcolor));
     }
 
     Move candidates[16];
     size_t ccount = 0;
-    for (Row r = 0 ; r < 8 ; r++) {
+    for (Rank r = 0 ; r < 8 ; r++) {
         for (File f = 0 ; f < 8 ; f++) {
             Piece p = piece_at(&simulation, r, f);
             if (piece_color(p) == color) {
                 memset(&(candidates[ccount]), 0, sizeof(Move));
                 candidates[ccount].piece = p;
-                candidates[ccount].fromrow = r;
+                candidates[ccount].fromrank = r;
                 candidates[ccount].fromfile = f;
-                candidates[ccount].torow = row;
+                candidates[ccount].torank = rank;
                 candidates[ccount].tofile = file;
                 candidates[ccount].capture = true;
-                if (piece_type(p) == PAWN && (row == 0 || row == 7)) {
+                if (piece_type(p) == PAWN && (rank == 0 || rank == 7)) {
                     /* the exact piece for promotion does not matter */
                     candidates[ccount].promotion = mkpiece(QUEEN, color);
                 }
@@ -871,24 +871,24 @@
     apply_move_internal(&simulation, &simmove);
     
     File kingfile = 0;
-    Row kingrow = 0;
-    for (Row row = 0 ; row < 8 ; row++) {
+    Rank kingrank = 0;
+    for (Rank rank = 0 ; rank < 8 ; rank++) {
         for (File file = 0 ; file < 8 ; file++) {
-            if (piece_at(&simulation, row, file) == mkpiece(KING, color)) {
+            if (piece_at(&simulation, rank, file) == mkpiece(KING, color)) {
                 kingfile = file;
-                kingrow = row;
+                kingrank = rank;
             }
         }
     }
     
     bool covered = is_covered(&simulation,
-        kingrow, kingfile, opponent_color(color));
+        kingrank, kingfile, opponent_color(color));
     gamestate_cleanup(&simulation);
     
     return covered;
 }
 
-bool get_real_candidates(const GameState *gamestate, Row row, File file,
+bool get_real_candidates(const GameState *gamestate, Rank rank, File file,
         Color color, Move *moves, size_t *movecount) {
 
     if (movecount) {
@@ -897,7 +897,7 @@
 
     Move candidates[16];
     size_t ccount;
-    if (get_candidates(gamestate, row, file, color, candidates, &ccount)) {
+    if (get_candidates(gamestate, rank, file, color, candidates, &ccount)) {
         bool result = false;
         for (size_t i = 0 ; i < ccount ; i++) {
             if (!is_pinned(gamestate, &candidates[i])) {
@@ -913,7 +913,7 @@
     }
 }
 
-bool get_real_threats(const GameState *gamestate, Row row, File file,
+bool get_real_threats(const GameState *gamestate, Rank rank, File file,
         Color color, Move *threats, size_t *threatcount) {
     
     if (threatcount) {
@@ -922,7 +922,7 @@
 
     Move candidates[16];
     size_t ccount;
-    if (get_threats(gamestate, row, file, color, candidates, &ccount)) {
+    if (get_threats(gamestate, rank, file, color, candidates, &ccount)) {
         bool result = false;
         for (size_t i = 0 ; i < ccount ; i++) {
             if (!is_pinned(gamestate, &candidates[i])) {
@@ -950,16 +950,16 @@
     size_t candidatecount;
 
     /* determine all candidate moves and sort out the invalid ones */
-    if (get_candidates(gamestate, move->torow, move->tofile, color,
+    if (get_candidates(gamestate, move->torank, move->tofile, color,
             candidates, &candidatecount)) {
         
         bool found = false;
         
         for (size_t i = 0 ; i < candidatecount ; i++) {
-            /* filter by partial fromrow/fromfile information */
+            /* filter by partial fromrank/fromfile information */
             if (candidates[i].piece == move->piece &&
-                    (move->fromrow == POS_UNSPECIFIED ||
-                    move->fromrow == candidates[i].fromrow) &&
+                    (move->fromrank == POS_UNSPECIFIED ||
+                    move->fromrank == candidates[i].fromrank) &&
                     (move->fromfile == POS_UNSPECIFIED ||
                     move->fromfile == candidates[i].fromfile)) {
 
@@ -994,7 +994,7 @@
         }
 
         /* found a candidate, copy the source location */
-        move->fromrow = candidate->fromrow;
+        move->fromrank = candidate->fromrank;
         move->fromfile = candidate->fromfile;
         return VALID_MOVE_SYNTAX;
     } else {
@@ -1005,7 +1005,7 @@
 static int eval_move1(const char *pstr, Move *move, Color color) {
     memset(move, 0, sizeof(Move));
     move->fromfile = POS_UNSPECIFIED;
-    move->fromrow = POS_UNSPECIFIED;
+    move->fromrank = POS_UNSPECIFIED;
 
     size_t len = strlen(pstr);
     if (len < 1 || len > 6) {
@@ -1037,19 +1037,19 @@
         /* pawn move (e.g. "e4") */
         move->piece = mkpiece(PAWN, color);
         move->tofile = fileidx(mstr[0]);
-        move->torow = rowidx(mstr[1]);
+        move->torank = rankidx(mstr[1]);
     } else if (len == 3) {
         if (strcmp(mstr, "O-O") == 0) {
             /* king side castling */
             move->piece = mkpiece(KING, color);
             move->fromfile = fileidx('e');
             move->tofile = fileidx('g');
-            move->fromrow = move->torow = color == WHITE ? 0 : 7;
+            move->fromrank = move->torank = color == WHITE ? 0 : 7;
         } else {
             /* move (e.g. "Nf3") */
             move->piece = getpiece(mstr[0], color);
             move->tofile = fileidx(mstr[1]);
-            move->torow = rowidx(mstr[2]);
+            move->torank = rankidx(mstr[2]);
         }
     } else if (len == 4) {
         move->piece = getpiece(mstr[0], color);
@@ -1070,18 +1070,18 @@
                     move->piece = 0;
                 }
             } else {
-                move->fromrow = rowidx(mstr[1]);
+                move->fromrank = rankidx(mstr[1]);
             }
         }
         move->tofile = fileidx(mstr[2]);
-        move->torow = rowidx(mstr[3]);
+        move->torank = rankidx(mstr[3]);
     } else if (len == 5) {
         if (strcmp(mstr, "O-O-O") == 0) {
             /* queen side castling "O-O-O" */
             move->piece = mkpiece(KING, color);
             move->fromfile = fileidx('e');
             move->tofile = fileidx('c');
-            move->fromrow = move->torow = color == WHITE ? 0 : 7;
+            move->fromrank = move->torank = color == WHITE ? 0 : 7;
         } else {
             move->piece = getpiece(mstr[0], color);
             if (mstr[2] == 'x') {
@@ -1090,8 +1090,8 @@
                     /* capture (e.g. "Ndxf3" or "R1xh3") */
                     if (isfile(mstr[1])) {
                         move->fromfile = fileidx(mstr[1]);
-                    } else if (isrow(mstr[1])) {
-                        move->fromrow = rowidx(mstr[1]);
+                    } else if (isrank(mstr[1])) {
+                        move->fromrank = rankidx(mstr[1]);
                     } else {
                         return INVALID_MOVE_SYNTAX;
                     }
@@ -1099,15 +1099,15 @@
                     /* long notation capture (e.g. "e5xf6") */
                     move->piece = mkpiece(PAWN, color);
                     move->fromfile = fileidx(mstr[0]);
-                    move->fromrow = rowidx(mstr[1]);
+                    move->fromrank = rankidx(mstr[1]);
                 }
             } else {
                 /* long notation move (e.g. "Nc5a4") */
                 move->fromfile = fileidx(mstr[1]);
-                move->fromrow = rowidx(mstr[2]);
+                move->fromrank = rankidx(mstr[2]);
             }
             move->tofile = fileidx(mstr[3]);
-            move->torow = rowidx(mstr[4]);
+            move->torank = rankidx(mstr[4]);
         }
     } else if (len == 6) {
         /* long notation capture (e.g. "Nc5xf3") */
@@ -1115,9 +1115,9 @@
             move->capture = true;
             move->piece = getpiece(mstr[0], color);
             move->fromfile = fileidx(mstr[1]);
-            move->fromrow = rowidx(mstr[2]);
+            move->fromrank = rankidx(mstr[2]);
             move->tofile = fileidx(mstr[4]);
-            move->torow = rowidx(mstr[5]);
+            move->torank = rankidx(mstr[5]);
         }
     }
 
@@ -1127,7 +1127,7 @@
     }
 
     if (piece_type(move->piece) == PAWN
-            && move->torow == (color==WHITE?7:0)
+            && move->torank == (color==WHITE?7:0)
             && !move->promotion) {
         return NEED_PROMOTION;
     }
@@ -1136,8 +1136,8 @@
      * destination indices must be specified and valid
      * source indices must either be valid or unspecified
      */
-    if (!isidxr(move->fromrow) || !isidxr(move->fromfile) ||
-        !isidx(move->torow) || !isidx(move->tofile)) {
+    if (!isidxr(move->fromrank) || !isidxr(move->fromfile) ||
+        !isidx(move->torank) || !isidx(move->tofile)) {
         return INVALID_MOVE_SYNTAX;
     }
 
@@ -1149,7 +1149,7 @@
     int result = eval_move1(mstr, move, color);
     if (result == VALID_MOVE_SYNTAX) {
         if (move->fromfile == POS_UNSPECIFIED
-            || move->fromrow == POS_UNSPECIFIED) {
+            || move->fromrank == POS_UNSPECIFIED) {
             result = getlocation(gamestate, move);
         }
         if (result == VALID_MOVE_SYNTAX) {
@@ -1186,11 +1186,11 @@
     return eval_move1(mstr, &move, color);
 }
 
-bool is_protected(const GameState *gamestate, Row row, File file, Color color) {
+bool is_protected(const GameState *gamestate, Rank rank, File file, Color color) {
     Move candidates[16];
     size_t ccount;
     /* we need all candidates - not only threats! */
-    if (get_candidates(gamestate, row, file, color, candidates, &ccount)) {
+    if (get_candidates(gamestate, rank, file, color, candidates, &ccount)) {
         for (size_t i = 0 ; i < ccount ; i++) {
             /* skip the king */
             if (piece_type(candidates[i].piece) == KING) continue;
@@ -1273,7 +1273,7 @@
 }
 
 size_t filter_moves_allowed(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves, moves_generator_func func) {
+        Color c, Rank r, File f, Move *moves, moves_generator_func func) {
 
     /* worst case: the queen has the most moves */
     Move candidates[QUEEN_MOVES_MAX];
--- a/src/chess/rules.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/chess/rules.h	Tue Aug 25 18:59:18 2026 +0200
@@ -52,20 +52,20 @@
 #if __STDC_VERSION__ < 202310L
 /* since #warning is also a C23 feature, the only hope is this: */
 #pragma GCC warning "Type safety for enums is only available since C23"
-#define enum_uint8_t(name) enum e##name
-#define typedef_enum_uint8_t(name) typedef uint8_t name
+#define enum_byte(name) enum e##name
+#define typedef_enum_byte(name) typedef uint8_t name
 #else
-#define enum_uint8_t(name) enum e##name : uint8_t
-#define typedef_enum_uint8_t(name) typedef enum e##name name
+#define enum_byte(name) enum e##name : uint8_t
+#define typedef_enum_byte(name) typedef enum e##name name
 #endif
 
 #define ENPASSANT_THREAT 0x40u
 
-enum_uint8_t(Color) {
+enum_byte(Color) {
     WHITE = 0x10u,
     BLACK = 0x20u,
 };
-typedef_enum_uint8_t(Color);
+typedef_enum_byte(Color);
 
 static inline Color opponent_color(Color color) {
     return color == WHITE ? BLACK : WHITE;
@@ -81,7 +81,7 @@
 #define QUEEN  0x05u
 #define KING   0x06u
 
-enum_uint8_t(Piece) {
+enum_byte(Piece) {
     WPAWN   = WHITE|PAWN,
     WROOK   = WHITE|ROOK,
     WKNIGHT = WHITE|KNIGHT,
@@ -95,20 +95,20 @@
     BQUEEN  = BLACK|QUEEN,
     BKING   = BLACK|KING,
 };
-typedef_enum_uint8_t(Piece);
+typedef_enum_byte(Piece);
 
 #define POS_UNSPECIFIED 255u
-enum_uint8_t(Row) {
+enum_byte(Rank) {
     RANK_1 = 0, RANK_2, RANK_3, RANK_4, RANK_5, RANK_6, RANK_7, RANK_8,
     RANK_UNSPECIFIED = POS_UNSPECIFIED
 };
-typedef_enum_uint8_t(Row);
+typedef_enum_byte(Rank);
 
-enum_uint8_t(File) {
+enum_byte(File) {
     FILE_A = 0, FILE_B, FILE_C, FILE_D, FILE_E, FILE_F, FILE_G, FILE_H,
     FILE_UNSPECIFIED = POS_UNSPECIFIED
 };
-typedef_enum_uint8_t(File);
+typedef_enum_byte(File);
 
 typedef uint8_t Board[8][8];
 
@@ -123,9 +123,9 @@
     uint64_t movetime; /* the time for this move in microseconds */
     Piece piece;
     File fromfile;
-    Row fromrow;
+    Rank fromrank;
     File tofile;
-    Row torow;
+    Rank torank;
     Piece promotion;
     bool check; /* must always be set if checkmate is set */
     bool checkmate;
@@ -185,37 +185,34 @@
 #define piece_color(piece) ((uint8_t)(piece)&COLOR_MASK)
 #define mkpiece(type,color) (Piece)((type)|(color))
 
-#define mdst(m) (m)->torow, (m)->tofile
-#define msrc(m) (m)->fromrow, (m)->fromfile
-
 /** Checks if the index is specified and valid. */
 static inline bool isidx(uint8_t idx) {return idx < 8;}
 /** Checks if the index is unspecified or valid. */
 static inline bool isidxr(uint8_t idx) {return idx==POS_UNSPECIFIED || idx<8;}
 
 static inline bool isfile(char file) {return file >= 'a' && file <= 'h';}
-static inline bool isrow(char row) {return row >= '1' && row <= '8';}
+static inline bool isrank(char rank) {return rank >= '1' && rank <= '8';}
 
-static inline Row rowidx(char row) {return row-'1';}
+static inline Rank rankidx(char rank) {return rank-'1';}
 static inline File fileidx(char file) {return file-'a';}
 
-static inline char rowchr(Row row) {return (char)row+'1';}
+static inline char rankchr(Rank rank) {return (char)rank+'1';}
 static inline char filechr(File file) {return (char)file+'a';}
 
 
 static inline void enpassant_threat_add(GameState *gamestate,
-        Row row, File file) {
-    gamestate->board[row][file] |= ENPASSANT_THREAT;
+        Rank rank, File file) {
+    gamestate->board[rank][file] |= ENPASSANT_THREAT;
 }
 
 static inline void enpassant_threat_remove(GameState *gamestate,
-        Row row, File file) {
-    gamestate->board[row][file] &= ~ENPASSANT_THREAT;
+        Rank rank, File file) {
+    gamestate->board[rank][file] &= ~ENPASSANT_THREAT;
 }
 
 static inline bool enpassant_threat_exists(const GameState *gamestate,
-        Row row, File file) {
-    return gamestate->board[row][file] & ENPASSANT_THREAT;
+        Rank rank, File file) {
+    return gamestate->board[rank][file] & ENPASSANT_THREAT;
 }
 
 static inline bool is_game_drawn(const GameState *gamestate) {
@@ -232,7 +229,7 @@
     return gamestate->moves[gamestate->movecount - 1].check;
 }
 
-static inline Color field_color(Row r, File f) {
+static inline Color field_color(Rank r, File f) {
     return (r + f) % 2 == 0 ? BLACK : WHITE;
 }
 
@@ -292,35 +289,35 @@
  * Returns the piece at the specified position.
  *
  * @param gamestate the current game state
- * @param row the row
+ * @param rank the rank
  * @param file the file
  * @return the piece at the specified position
  */
-Piece piece_at(const GameState *gamestate, Row row, File file);
+Piece piece_at(const GameState *gamestate, Rank rank, File file);
 
 /**
  * Places a piece at the specified position in the current game state.
  *
  * @param gamestate the current game state
- * @param row the row
+ * @param rank the rank
  * @param file the file
  * @param piece the piece to place at the specified position
  */
-void piece_set(GameState *gamestate, Row row, File file, Piece piece);
+void piece_set(GameState *gamestate, Rank rank, File file, Piece piece);
 
 /**
  * Removes the piece at the specified position in the current game state.
  *
  * @param gamestate the current game state
- * @param row the row
+ * @param rank the rank
  * @param file the file
  */
-static inline void piece_remove(GameState *gamestate, Row row, File file) {
-    piece_set(gamestate, row, file, 0);
+static inline void piece_remove(GameState *gamestate, Rank rank, File file) {
+    piece_set(gamestate, rank, file, 0);
 }
 
 typedef size_t(*moves_generator_func)(const GameState *gamestate,
-        Color c, Row r, File f, Move *moves);
+        Color c, Rank r, File f, Move *moves);
 
 /**
  * Calculates all allowed moves for a specific piece.
@@ -328,13 +325,13 @@
  * Use the macros for the specific pieces instead.
  *
  * @param gamestate the current gamestate
- * @param r the row of the piece
+ * @param r the rank of the piece
  * @param f the file of the piece
  * @param moves target array for the list of moves
  * @return the number of moves stored in the @p moves array
  */
 size_t piece_moves_allowed(const GameState *gamestate,
-        Row r, File f, Move *moves);
+        Rank r, File f, Move *moves);
 
 /**
  * Internal function used to filter out illegal moves.
@@ -343,14 +340,14 @@
  *
  * @param gamestate the current gamestate
  * @param c color of the piece
- * @param r the row of the piece
+ * @param r the rank of the piece
  * @param f the file of the piece
  * @param moves target array for the list of moves
  * @param func a function that unconditionally generates the moves
  * @return the number of moves stored in the @p moves array
  */
 size_t filter_moves_allowed(const GameState *gamestate,
-    Color c, Row r, File f, Move *moves, moves_generator_func func);
+    Color c, Rank r, File f, Move *moves, moves_generator_func func);
 
 /**
  * Determines a list of theoretically possible moves to the specified field.
@@ -362,7 +359,7 @@
  * must be set, too.
  *
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should move to the field
  * @param moves the array where to store the moves
@@ -371,7 +368,7 @@
  * @return true, if any piece of the specified color can move to the specified
  * field regardless of being pinned
  */
-bool get_candidates(const GameState *gamestate, Row row, File file,
+bool get_candidates(const GameState *gamestate, Rank rank, File file,
         Color color, Move* moves, size_t* movecount);
 
 /**
@@ -385,7 +382,7 @@
  * must be set, too.
  *
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should move to the field
  * @param moves the array where to store the moves
@@ -394,7 +391,7 @@
  * @return true, if any piece of the specified color can move to the specified
  * field and is not pinned
  */
-bool get_real_candidates(const GameState *gamestate, Row row, File file,
+bool get_real_candidates(const GameState *gamestate, Rank rank, File file,
         Color color, Move* moves, size_t* movecount);
 
 /**
@@ -407,7 +404,7 @@
  * must be set, too.
  * 
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should threaten the field
  * @param threats the array where to store the threats
@@ -416,7 +413,7 @@
  * @return true, if any piece of the specified color threatens the specified
  * field
  */
-bool get_threats(const GameState *gamestate, Row row, File file,
+bool get_threats(const GameState *gamestate, Rank rank, File file,
         Color color, Move* threats, size_t* threatcount);
 
 /**
@@ -427,7 +424,7 @@
  * must be set, too.
  * 
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should threaten the field
  * @param threats the array where to store the threats
@@ -436,7 +433,7 @@
  * @return true, if any piece of the specified color threatens the specified
  * field and is not pinned
  */
-bool get_real_threats(const GameState *gamestate, Row row, File file,
+bool get_real_threats(const GameState *gamestate, Rank rank, File file,
         Color color, Move* threats, size_t* threatcount);
 
 /**
@@ -446,14 +443,14 @@
  * capture an opponent piece on this field, regardless of being pinned.
  * 
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should cover the field
  * @return true, if any piece of the specified color threatens the specified
  * field
  */
-#define is_covered(gamestate, row, file, color) \
-    get_threats(gamestate, row, file, color, NULL, NULL)
+#define is_covered(gamestate, rank, file, color) \
+    get_threats(gamestate, rank, file, color, NULL, NULL)
 
 /**
  * Checks, if a specified field is attacked by a piece of a certain color.
@@ -462,14 +459,14 @@
  * therefore able to perform the move.
  * 
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should cover the field
  * @return true, if any piece of the specified color threatens the specified
  * field and could capture an opponent piece
  */
-#define is_attacked(gamestate, row, file, color) \
-    get_real_threats(gamestate, row, file, color, NULL, NULL)
+#define is_attacked(gamestate, rank, file, color) \
+    get_real_threats(gamestate, rank, file, color, NULL, NULL)
 
 /**
  * Checks, if a specified field is protected by a piece of a certain color.
@@ -478,13 +475,13 @@
  * that field or move to that field (and is not pinned).
  * 
  * @param gamestate the current game state
- * @param row row of the field to check
+ * @param rank rank of the field to check
  * @param file file of the field to check
  * @param color the color of the piece that should cover the field
  * @return true, if any piece (excluding the king) of the specified color
  * can move to the specified field (including capturing moves)
  */
-bool is_protected(const GameState *gamestate, Row row, File file, Color color);
+bool is_protected(const GameState *gamestate, Rank rank, File file, Color color);
 
 /**
  * Checks, if the specified move cannot be performed, because the piece is
--- a/src/main.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/main.c	Tue Aug 25 18:59:18 2026 +0200
@@ -277,17 +277,18 @@
     return 0;
 }
 
-static void draw_board(GameState *gamestate, uint8_t perspective) {
+static void draw_board(GameState *gamestate, Color perspective) {
     if (gamestate->movecount == 0) {
         mvaddstr(0, 0, gamestate->fen_start);
     } else {
         mvaddstr(0, 0, gamestate->fen[gamestate->movecount - 1]);
     }
 
-    for (uint8_t y = 0 ; y < 8 ; y++) {
-        for (uint8_t x = 0 ; x < 8 ; x++) {
-            uint8_t col = gamestate->board[y][x] & COLOR_MASK;
-            uint8_t piece = gamestate->board[y][x];
+    for (Rank y = 0 ; y < 8 ; y++) {
+        for (File x = 0 ; x < 8 ; x++) {
+            Piece piece = piece_at(gamestate, y, x);
+            Color col = piece_color(piece);
+
             char piecestr[5];
             if (piece) {
                 if (settings.unicode) {
@@ -438,7 +439,7 @@
 }
 
 #define MOVESTR_BUFLEN 10
-static int domove_singlemachine(GameState *gamestate, uint8_t curcolor) {
+static int domove_singlemachine(GameState *gamestate, Color curcolor) {
     size_t bufpos = 0;
     char movestr[MOVESTR_BUFLEN];
 
@@ -524,8 +525,8 @@
         .mtime_sec = net_htonl(move.movetime / 1000000ull),
         .mtime_usec = net_htonl(move.movetime % 1000000ull),
         .piece = move.piece,
-        .fromfile = move.fromfile, .fromrow = move.fromrow,
-        .tofile = move.tofile, .torow = move.torow,
+        .fromfile = move.fromfile, .fromrank = move.fromrank,
+        .tofile = move.tofile, .torank = move.torank,
         .capture = move.capture,
         .check_or_mate = move.checkmate + move.check,
         .promotion = move.promotion,
@@ -539,8 +540,8 @@
         .movetime = (uint64_t)net_ntohl(move.mtime_sec)
                     * 1000000ull + net_ntohl(move.mtime_usec),
         .piece = move.piece,
-        .fromfile = move.fromfile, .fromrow = move.fromrow,
-        .tofile = move.tofile, .torow = move.torow,
+        .fromfile = move.fromfile, .fromrank = move.fromrank,
+        .tofile = move.tofile, .torank = move.torank,
         .promotion = move.promotion,
         .check = move.check_or_mate,
         .checkmate = move.check_or_mate >> 1,
@@ -548,7 +549,7 @@
     };
 }
 
-static int sendmove(GameState *gamestate, int opponent, uint8_t mycolor) {
+static int sendmove(GameState *gamestate, int opponent, Color mycolor) {
 
     size_t bufpos = 0;
     char movestr[MOVESTR_BUFLEN];
@@ -695,7 +696,7 @@
     }
 }
 
-static int recvmove(GameState *gamestate, int opponent, uint8_t mycolor) {
+static int recvmove(GameState *gamestate, int opponent, Color mycolor) {
     memset(gamestate->premove, 0, sizeof(gamestate->premove));
 
     size_t bufpos = 0;
@@ -960,11 +961,11 @@
 static void game_play_singlemachine(GameState *gamestate) {
     inputy = getmaxy(stdscr) - 6;
 
-    uint8_t curcol = current_color(gamestate);
+    Color curcol = current_color(gamestate);
     bool running = is_game_running(gamestate);
     while (running) {
         clear();
-        uint8_t perspective = settings.disableflip ? WHITE : curcol;
+        Color perspective = settings.disableflip ? WHITE : curcol;
         draw_board(gamestate, perspective);
         running = !domove_singlemachine(gamestate, curcol);
         curcol = opponent_color(curcol);
@@ -975,7 +976,7 @@
 static void game_play(GameState *gamestate, int opponent, bool as_client) {
     inputy = getmaxy(stdscr) - 6;
 
-    uint8_t mycolor = gamestate->info.servercolor;
+    Color mycolor = gamestate->info.servercolor;
     if (as_client) {
         mycolor = opponent_color(mycolor);
     }
@@ -1026,7 +1027,7 @@
         } else {
             printw("%s", gamestate->moves[i].string);
         }
-        // only five moves reliably fit into one screen row
+        // only five moves reliably fit into one screen rank
         if ((i+1) % 10)  {
             addch(' ');
         } else {
--- a/src/network.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/network.c	Tue Aug 25 18:59:18 2026 +0200
@@ -163,7 +163,7 @@
 }
 
 void net_send_code(int socket, uint8_t code) {
-    send(socket, &code, sizeof(uint8_t), 0);
+    send(socket, &code, 1, 0);
 }
 
 void net_send_data(int socket, uint8_t code, void *data, size_t len) {
--- a/src/network.h	Tue Aug 25 18:35:18 2026 +0200
+++ b/src/network.h	Tue Aug 25 18:59:18 2026 +0200
@@ -84,9 +84,9 @@
     uint32_t mtime_usec;
     uint8_t piece;
     uint8_t fromfile;
-    uint8_t fromrow;
+    uint8_t fromrank;
     uint8_t tofile;
-    uint8_t torow;
+    uint8_t torank;
     uint8_t capture;
     uint8_t check_or_mate;
     uint8_t promotion;
--- a/test/test-datatypes.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/test/test-datatypes.c	Tue Aug 25 18:59:18 2026 +0200
@@ -37,7 +37,7 @@
 #endif
 
 static_assert(sizeof(Color) == 1);
-static_assert(sizeof(Row) == 1);
+static_assert(sizeof(Rank) == 1);
 static_assert(sizeof(File) == 1);
 static_assert(sizeof(Piece) == 1);
 
--- a/test/test-rules-helper.c	Tue Aug 25 18:35:18 2026 +0200
+++ b/test/test-rules-helper.c	Tue Aug 25 18:59:18 2026 +0200
@@ -42,7 +42,7 @@
         {WHITE, BLACK, WHITE, BLACK, WHITE, BLACK, WHITE, BLACK},
     };
     CX_TEST_DO {
-        for (Row r = 0 ; r < 8 ; r++) {
+        for (Rank r = 0 ; r < 8 ; r++) {
             for (File f = 0 ; f < 8 ; f++) {
                 CX_TEST_ASSERT(field_color(r, f) == colors[r][f]);
             }

mercurial