diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-03-30 12:33:22 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-03-30 12:33:22 +0100 |
commit | a25442746dbd79b32a1eaedc59e216696a22731d (patch) | |
tree | faee43cfa4d976ff4ea099366b8d43fb862d429e /FICS/gameproc.c | |
parent | 81af718d088960760653fcf4cb3ea7373cc38ceb (diff) |
Reformatted player_has_mating_material()
Diffstat (limited to 'FICS/gameproc.c')
-rw-r--r-- | FICS/gameproc.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/FICS/gameproc.c b/FICS/gameproc.c index 45357b2..f6e33be 100644 --- a/FICS/gameproc.c +++ b/FICS/gameproc.c @@ -985,30 +985,34 @@ PUBLIC int com_courtesyadjourn(int p, param_list param) return COM_OK; } -PRIVATE int player_has_mating_material(game_state_t *gs, int color) +PRIVATE int +player_has_mating_material(game_state_t *gs, int color) { - int i, j; - int piece; - int minor_pieces = 0; - - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) { - piece = gs->board[i][j]; - switch (piecetype(piece)) { - case BISHOP: - case KNIGHT: - if (iscolor(piece, color)) - minor_pieces++; - break; - case KING: - case NOPIECE: - break; - default: - if (iscolor(piece, color)) - return 1; - } - } - return ((minor_pieces > 1) ? 1 : 0); + int i, j; + int minor_pieces = 0; + int piece; + + for (i = 0; i < 8; i++) { + for (j = 0; j < 8; j++) { + piece = gs->board[i][j]; + + switch (piecetype(piece)) { + case BISHOP: + case KNIGHT: + if (iscolor(piece, color)) + minor_pieces++; + break; + case KING: + case NOPIECE: + break; + default: + if (iscolor(piece, color)) + return 1; + } + } + } + + return (minor_pieces > 1 ? 1 : 0); } PUBLIC int |