diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 18:05:51 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 18:05:51 +0200 |
commit | e77c5bc80e4490b40b3754147679eecdbafd98a4 (patch) | |
tree | 554ef0be0af5d384fffb0cb6055da1b70341f7f9 /FICS/movecheck.c | |
parent | da2f83eb30a2587abee372940458525102245369 (diff) |
Reformatted legal_rook_move()
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r-- | FICS/movecheck.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c index d9d1332..252545d 100644 --- a/FICS/movecheck.c +++ b/FICS/movecheck.c @@ -227,44 +227,45 @@ PRIVATE int legal_bishop_move(game_state_t * gs, int ff, int fr, int tf, int tr) return 1; } -PRIVATE int legal_rook_move(game_state_t * gs, int ff, int fr, int tf, int tr) +PRIVATE int +legal_rook_move(game_state_t *gs, int ff, int fr, int tf, int tr) { - int i; - int start, stop; + int i; + int start, stop; - if (ff == tf) { - if (((fr - tr) == 1) || ((tr - fr) == 1)) - return 1; - if (fr < tr) { - start = fr + 1; - stop = tr - 1; - } else { - start = tr + 1; - stop = fr - 1; - } - for (i = start; i <= stop; i++) { - if (gs->board[ff][i] != NOPIECE) - return 0; - } - return 1; - } else if (fr == tr) { - if (((ff - tf) == 1) || ((tf - ff) == 1)) - return 1; - if (ff < tf) { - start = ff + 1; - stop = tf - 1; - } else { - start = tf + 1; - stop = ff - 1; - } - for (i = start; i <= stop; i++) { - if (gs->board[i][fr] != NOPIECE) - return 0; - } - return 1; - } else { - return 0; - } + if (ff == tf) { + if (((fr - tr) == 1) || ((tr - fr) == 1)) + return 1; + if (fr < tr) { + start = fr + 1; + stop = tr - 1; + } else { + start = tr + 1; + stop = fr - 1; + } + for (i = start; i <= stop; i++) { + if (gs->board[ff][i] != NOPIECE) + return 0; + } + return 1; + } else if (fr == tr) { + if (((ff - tf) == 1) || ((tf - ff) == 1)) + return 1; + if (ff < tf) { + start = ff + 1; + stop = tf - 1; + } else { + start = tf + 1; + stop = ff - 1; + } + for (i = start; i <= stop; i++) { + if (gs->board[i][fr] != NOPIECE) + return 0; + } + return 1; + } else { + return 0; + } } PRIVATE int |