diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-03-17 21:40:33 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-03-17 21:40:33 +0100 |
commit | 0adb8adf8a6f401aa3ded334b1e79d7b2369a534 (patch) | |
tree | 2ae0200e6b265710e192027d36c7ebf4eaf3845a /FICS/movecheck.c | |
parent | 96d81730bada204542411f34e3d945416fed48e0 (diff) |
Reformatted legal_knight_move()
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r-- | FICS/movecheck.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c index 69b8293..10f8744 100644 --- a/FICS/movecheck.c +++ b/FICS/movecheck.c @@ -177,21 +177,24 @@ PRIVATE int legal_pawn_move( game_state_t *gs, int ff, int fr, int tf, int tr ) return 0; } -PRIVATE int legal_knight_move(game_state_t * gs, int ff, int fr, int tf, int tr) +PRIVATE int +legal_knight_move(game_state_t *gs, int ff, int fr, int tf, int tr) { - int dx, dy; + int dx, dy; - dx = ff - tf; - dy = fr - tr; - if ((dx == 2) || (dx == -2)) { - if ((dy == -1) || (dy == 1)) - return 1; - } - if ((dy == 2) || (dy == -2)) { - if ((dx == -1) || (dx == 1)) - return 1; - } - return 0; + dx = ff - tf; + dy = fr - tr; + + if (dx == 2 || dx == -2) { + if (dy == -1 || dy == 1) + return 1; + } + if (dy == 2 || dy == -2) { + if (dx == -1 || dx == 1) + return 1; + } + + return 0; } PRIVATE int |