aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/movecheck.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-05 17:25:49 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-05 17:25:49 +0200
commitff6d3df93e35c89161e21464aa328b1d26f9e883 (patch)
tree9c990140721683951c4b1ca42ebb047bb026d117 /FICS/movecheck.c
parentd27427628d85371ba40c8229e52bbfb9cc287a8e (diff)
Reformatted possible_bishop_moves()
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r--FICS/movecheck.c145
1 files changed, 77 insertions, 68 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c
index ad3013d..1303b37 100644
--- a/FICS/movecheck.c
+++ b/FICS/movecheck.c
@@ -420,76 +420,85 @@ PRIVATE void possible_knight_moves(game_state_t * gs,
}
}
-PRIVATE void possible_bishop_moves(game_state_t * gs,
- int onf, int onr,
- int *posf, int *posr, int *numpos)
+PRIVATE void
+possible_bishop_moves(game_state_t *gs,
+ int onf, int onr,
+ int *posf, int *posr,
+ int *numpos)
{
- int f, r;
+ int f, r;
- /* Up Left */
- f = onf;
- r = onr;
- while (1) {
- f--;
- 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;
- }
- /* Up Right */
- f = onf;
- r = onr;
- while (1) {
- f++;
- 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 Left */
- f = onf;
- r = onr;
- while (1) {
- f--;
- 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 Right */
- f = onf;
- r = onr;
- while (1) {
- f++;
- 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;
- }
+ /* Up Left */
+ f = onf;
+ r = onr;
+ while (1) {
+ f--;
+ 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;
+ }
+
+ /* Up Right */
+ f = onf;
+ r = onr;
+ while (1) {
+ f++;
+ 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 Left */
+ f = onf;
+ r = onr;
+ while (1) {
+ f--;
+ 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 Right */
+ f = onf;
+ r = onr;
+ while (1) {
+ f++;
+ 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