From 165fd508be34f84465bf86a20e7a5a9e0965e925 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 24 Dec 2023 00:13:54 +0100 Subject: Reformatted board_calc_strength() --- FICS/board.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'FICS/board.c') 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 * -- cgit v1.2.3