diff options
-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 * |