- Result KPKPosition::classify_black(const Result db[]) {
-
- // If one move leads to a position classified as RESULT_DRAW, the result
- // of the current position is RESULT_DRAW. If all moves lead to positions
- // classified as RESULT_WIN, the position is classified as RESULT_WIN.
- // Otherwise, the current position is classified as RESULT_UNKNOWN.
-
- bool unknownFound = false;
- Bitboard b;
- Square s;
- Result r;
-
- // King moves
- b = bk_attacks();
- while (b)
- {
- s = pop_1st_bit(&b);
- r = db[compute_index(whiteKingSquare, s, pawnSquare, WHITE)];
-
- if (r == RESULT_DRAW)
- return RESULT_DRAW;
-
- if (r == RESULT_UNKNOWN)
- unknownFound = true;
- }
- return unknownFound ? RESULT_UNKNOWN : RESULT_WIN;