diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 18:09:41 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 18:09:41 +0200 |
commit | 6a58819ef7a27bd8b019f0519a066fef04066293 (patch) | |
tree | e3bda40053547eddc321ba0ae919ba49bd7a4db2 /FICS | |
parent | 8622799296ec46de4edb1d8f0984c59ac7bb9ddf (diff) |
Reformatted legal_knight_move()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/movecheck.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c index 99e5185..d7cf963 100644 --- a/FICS/movecheck.c +++ b/FICS/movecheck.c @@ -175,21 +175,23 @@ 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 |