made ai better at endgames (it's just a start)
Some checks failed
pre-release / Pre Release (push) Waiting to run
tagged-release / Tagged Release (push) Has been cancelled

This commit is contained in:
Karma Riuk
2025-02-16 10:12:06 +01:00
parent 5cbe57dc55
commit 62a35ecafd
6 changed files with 80 additions and 12 deletions

View File

@ -26,10 +26,13 @@ int piece_value(Piece p) {
}
}
int count_material(const Board& b, int8_t colour) {
int count_material(const Board& b, int8_t colour, bool count_pawns) {
int ret = 0;
for (int i = 0; i < 64; i++)
for (int i = 0; i < 64; i++) {
if (b.piece_at(i) == Pawn && !count_pawns)
continue;
if (b.colour_at(i) == colour)
ret += piece_value(b.piece_at(i));
}
return ret;
}