diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-24 00:13:54 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-24 00:13:54 +0100 |
commit | 165fd508be34f84465bf86a20e7a5a9e0965e925 (patch) | |
tree | ff606345e28088468fe89b0301457b3433d12e58 /FICS/board.c | |
parent | 6eee2e702c6fff02c44bed3c61b219606d6567b2 (diff) |
Reformatted board_calc_strength()
Diffstat (limited to 'FICS/board.c')
-rw-r--r-- | FICS/board.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/FICS/board.c b/FICS/board.c index 0e5890e..f41c411 100644 --- a/FICS/board.c +++ b/FICS/board.c @@ -110,25 +110,28 @@ PUBLIC int board_init(game_state_t *b, char *category, char *board) return retval; } -PUBLIC void board_calc_strength(game_state_t *b, int *ws, int *bs) +PUBLIC void +board_calc_strength(game_state_t *b, int *ws, int *bs) { - int r, f; - int *p; - - *ws = *bs = 0; - for (f = 0; f < 8; f++) { - for (r = 0; r < 8; r++) { - if (colorval(b->board[r][f]) == WHITE) - p = ws; - else - p = bs; - *p += pieceValues[piecetype(b->board[r][f])]; - } - } - for (r = PAWN; r <= QUEEN; r++) { - *ws += b->holding[0][r-1] * pieceValues[r]; - *bs += b->holding[1][r-1] * pieceValues[r]; - } + int *p; + int r, f; + + *ws = *bs = 0; + + for (f = 0; f < 8; f++) { + for (r = 0; r < 8; r++) { + if (colorval(b->board[r][f]) == WHITE) + p = ws; + else + p = bs; + *p += pieceValues[piecetype(b->board[r][f])]; + } + } + + for (r = PAWN; r <= QUEEN; r++) { + *ws += (b->holding[0][r - 1] * pieceValues[r]); + *bs += (b->holding[1][r - 1] * pieceValues[r]); + } } PRIVATE char * |