4 king input buckets in the net

bench: 1311861
This commit is contained in:
rektdie committed 2026-03-31 14:34:29 +02:00
1 parent 1f2bb52418
commit 454d9e61c1
7 files changed
+85 -35

No files matched your search

+21 -21
View File
@@ -18,7 +18,7 @@ int CalculateIndex(bool perspective, bool side, int pieceType, int square, bool
}
// All friendly, for quiets
void AccumulatorPair::addSub(bool stm, int add, int addPT, int sub, int subPT) {
void AccumulatorPair::addSub(bool stm, int add, int addPT, int sub, int subPT, BucketPair bp) {
int addW = CalculateIndex(White, stm, addPT, add, mirroredWhite);
int addB = CalculateIndex(Black, stm, addPT, add, mirroredBlack);
@@ -26,16 +26,16 @@ void AccumulatorPair::addSub(bool stm, int add, int addPT, int sub, int subPT) {
int subB = CalculateIndex(Black, stm, subPT, sub, mirroredBlack);
for (int i = 0; i < NNUE::HL_SIZE; i++) {
white[i] += NNUE::net.accumulator_weights[addW * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subW * NNUE::HL_SIZE + i];
white[i] += NNUE::net.accumulator_weights[bp.white][addW * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.white][subW * NNUE::HL_SIZE + i];
black[i] += NNUE::net.accumulator_weights[addB * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subB * NNUE::HL_SIZE + i];
black[i] += NNUE::net.accumulator_weights[bp.black][addB * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.black][subB * NNUE::HL_SIZE + i];
}
}
// Captures
void AccumulatorPair::addSubSub(bool stm, int add, int addPT, int sub1, int subPT1, int sub2, int subPT2) {
void AccumulatorPair::addSubSub(bool stm, int add, int addPT, int sub1, int subPT1, int sub2, int subPT2, BucketPair bp) {
int addW = CalculateIndex(White, stm, addPT, add, mirroredWhite);
int addB = CalculateIndex(Black, stm, addPT, add, mirroredBlack);
@@ -46,18 +46,18 @@ void AccumulatorPair::addSubSub(bool stm, int add, int addPT, int sub1, int subP
int subB2 = CalculateIndex(Black, !stm, subPT2, sub2, mirroredBlack);
for (int i = 0; i < NNUE::HL_SIZE; i++) {
white[i] += NNUE::net.accumulator_weights[addW * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subW1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subW2 * NNUE::HL_SIZE + i];
white[i] += NNUE::net.accumulator_weights[bp.white][addW * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.white][subW1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.white][subW2 * NNUE::HL_SIZE + i];
black[i] += NNUE::net.accumulator_weights[addB * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subB1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subB2 * NNUE::HL_SIZE + i];
black[i] += NNUE::net.accumulator_weights[bp.black][addB * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.black][subB1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.black][subB2 * NNUE::HL_SIZE + i];
}
}
// Castling
void AccumulatorPair::addAddSubSub(bool stm, int add1, int addPT1, int add2, int addPT2, int sub1, int subPT1, int sub2, int subPT2) {
void AccumulatorPair::addAddSubSub(bool stm, int add1, int addPT1, int add2, int addPT2, int sub1, int subPT1, int sub2, int subPT2, BucketPair bp) {
int addW1 = CalculateIndex(White, stm, addPT1, add1, mirroredWhite);
int addB1 = CalculateIndex(Black, stm, addPT1, add1, mirroredBlack);
@@ -71,15 +71,15 @@ void AccumulatorPair::addAddSubSub(bool stm, int add1, int addPT1, int add2, int
int subB2 = CalculateIndex(Black, stm, subPT2, sub2, mirroredBlack);
for (int i = 0; i < NNUE::HL_SIZE; i++) {
white[i] += NNUE::net.accumulator_weights[addW1 * NNUE::HL_SIZE + i]
+ NNUE::net.accumulator_weights[addW2 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subW1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subW2 * NNUE::HL_SIZE + i];
white[i] += NNUE::net.accumulator_weights[bp.white][addW1 * NNUE::HL_SIZE + i]
+ NNUE::net.accumulator_weights[bp.white][addW2 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.white][subW1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.white][subW2 * NNUE::HL_SIZE + i];
black[i] += NNUE::net.accumulator_weights[addB1 * NNUE::HL_SIZE + i]
+ NNUE::net.accumulator_weights[addB2 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subB1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[subB2 * NNUE::HL_SIZE + i];
black[i] += NNUE::net.accumulator_weights[bp.black][addB1 * NNUE::HL_SIZE + i]
+ NNUE::net.accumulator_weights[bp.black][addB2 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.black][subB1 * NNUE::HL_SIZE + i]
- NNUE::net.accumulator_weights[bp.black][subB2 * NNUE::HL_SIZE + i];
}
}