aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-05 17:12:09 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-05 17:12:09 +0200
commit770101f1dfa149c7ad505ba526603ac11aa61108 (patch)
tree0341b0ce863294962e848e1c9ec0395f0a7e8c31 /FICS
parente34f3b8018e72cd6b6a6238c5afc6b73a05ddc89 (diff)
Reformatted possible_rook_moves()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/movecheck.c137
1 files changed, 73 insertions, 64 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c
index 001551c..ad3013d 100644
--- a/FICS/movecheck.c
+++ b/FICS/movecheck.c
@@ -492,72 +492,81 @@ PRIVATE void possible_bishop_moves(game_state_t * gs,
}
}
-PRIVATE void possible_rook_moves(game_state_t * gs,
- int onf, int onr,
- int *posf, int *posr, int *numpos)
+PRIVATE void
+possible_rook_moves(game_state_t *gs,
+ int onf, int onr,
+ int *posf, int *posr,
+ int *numpos)
{
- int f, r;
+ int f, r;
- /* Left */
- f = onf;
- r = onr;
- while (1) {
- f--;
- if ((f < 0) || (f > 7))
- break;
- if ((r < 0) || (r > 7))
- break;
- if ((gs->board[f][r] != NOPIECE) && (iscolor(gs->board[f][r], gs->onMove)))
- break;
- add_pos(f, r, posf, posr, numpos);
- if (gs->board[f][r] != NOPIECE)
- break;
- }
- /* Right */
- f = onf;
- r = onr;
- while (1) {
- f++;
- if ((f < 0) || (f > 7))
- break;
- if ((r < 0) || (r > 7))
- break;
- if ((gs->board[f][r] != NOPIECE) && (iscolor(gs->board[f][r], gs->onMove)))
- break;
- add_pos(f, r, posf, posr, numpos);
- if (gs->board[f][r] != NOPIECE)
- break;
- }
- /* Up */
- f = onf;
- r = onr;
- while (1) {
- r++;
- if ((f < 0) || (f > 7))
- break;
- if ((r < 0) || (r > 7))
- break;
- if ((gs->board[f][r] != NOPIECE) && (iscolor(gs->board[f][r], gs->onMove)))
- break;
- add_pos(f, r, posf, posr, numpos);
- if (gs->board[f][r] != NOPIECE)
- break;
- }
- /* Down */
- f = onf;
- r = onr;
- while (1) {
- r--;
- if ((f < 0) || (f > 7))
- break;
- if ((r < 0) || (r > 7))
- break;
- if ((gs->board[f][r] != NOPIECE) && (iscolor(gs->board[f][r], gs->onMove)))
- break;
- add_pos(f, r, posf, posr, numpos);
- if (gs->board[f][r] != NOPIECE)
- break;
- }
+ /* Left */
+ f = onf;
+ r = onr;
+ while (1) {
+ f--;
+ if ((f < 0) || (f > 7))
+ break;
+ if ((r < 0) || (r > 7))
+ break;
+ if ((gs->board[f][r] != NOPIECE) &&
+ (iscolor(gs->board[f][r], gs->onMove)))
+ break;
+ add_pos(f, r, posf, posr, numpos);
+ if (gs->board[f][r] != NOPIECE)
+ break;
+ }
+
+ /* Right */
+ f = onf;
+ r = onr;
+ while (1) {
+ f++;
+ if ((f < 0) || (f > 7))
+ break;
+ if ((r < 0) || (r > 7))
+ break;
+ if ((gs->board[f][r] != NOPIECE) &&
+ (iscolor(gs->board[f][r], gs->onMove)))
+ break;
+ add_pos(f, r, posf, posr, numpos);
+ if (gs->board[f][r] != NOPIECE)
+ break;
+ }
+
+ /* Up */
+ f = onf;
+ r = onr;
+ while (1) {
+ r++;
+ if ((f < 0) || (f > 7))
+ break;
+ if ((r < 0) || (r > 7))
+ break;
+ if ((gs->board[f][r] != NOPIECE) &&
+ (iscolor(gs->board[f][r], gs->onMove)))
+ break;
+ add_pos(f, r, posf, posr, numpos);
+ if (gs->board[f][r] != NOPIECE)
+ break;
+ }
+
+ /* Down */
+ f = onf;
+ r = onr;
+ while (1) {
+ r--;
+ if ((f < 0) || (f > 7))
+ break;
+ if ((r < 0) || (r > 7))
+ break;
+ if ((gs->board[f][r] != NOPIECE) &&
+ (iscolor(gs->board[f][r], gs->onMove)))
+ break;
+ add_pos(f, r, posf, posr, numpos);
+ if (gs->board[f][r] != NOPIECE)
+ break;
+ }
}
PRIVATE void