From 679c2ea2275d6a978cea10e4260ee0598e044c82 Mon Sep 17 00:00:00 2001 From: Eelco de Groot Date: Mon, 2 Sep 2013 22:50:32 +0200 Subject: [PATCH] Fix check for bishop pair in material imbalance Prefer pos.bishop_pair() to pos.count(WHITE) > 1 because the first checks that the two bishops are on different color squares. Although the change seems to kick in only in very rare cases, quite surprisingly it was able to pass SPRT test at short TC. LLR: 2.95 (-2.94,2.94) Total: 39818 W: 8174 L: 7956 D: 23688 bench: 3453941 --- src/material.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/material.cpp b/src/material.cpp index 0f1e19b9..88882959 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -263,14 +263,14 @@ Entry* probe(const Position& pos, Table& entries, Endgames& endgames) { e->spaceWeight = make_score(minorPieceCount * minorPieceCount, 0); } - // Evaluate the material imbalance. We use PIECE_TYPE_NONE as a place holder + // Evaluate the material imbalance. We use NO_PIECE_TYPE as a place holder // for the bishop pair "extended piece", this allow us to be more flexible // in defining bishop pair bonuses. const int pieceCount[COLOR_NB][PIECE_TYPE_NB] = { - { pos.count(WHITE) > 1, pos.count(WHITE), pos.count(WHITE), - pos.count(WHITE) , pos.count(WHITE), pos.count(WHITE) }, - { pos.count(BLACK) > 1, pos.count(BLACK), pos.count(BLACK), - pos.count(BLACK) , pos.count(BLACK), pos.count(BLACK) } }; + { pos.bishop_pair(WHITE) , pos.count(WHITE), pos.count(WHITE), + pos.count(WHITE), pos.count(WHITE), pos.count(WHITE) }, + { pos.bishop_pair(BLACK) , pos.count(BLACK), pos.count(BLACK), + pos.count(BLACK), pos.count(BLACK), pos.count(BLACK) } }; e->value = (int16_t)((imbalance(pieceCount) - imbalance(pieceCount)) / 16); return e; -- 2.39.2