I still think it is probably not good if you leave out count_1s<Max15>(undefended) like in Marco's original version I think he had this left out? The new king_defender terms all work in one direction and may even lead to negative attackUnits. The squares defended may not be the same as squares attacked and the more this is the case, the more noise is coming from the new terms. In other words, if the defenders leave "holes", and remember these squares are always attacked, because undefended is really a misnomer, then the defenders may simply have no effect at all, the new terms are pure noise all in the wrong direction. Also I thought that if I do not miscalculate, attackUnits = 0 is now a special case because it includes all the cases where the defense is stronger than the attack. Experimented in the past with a initialization function that starts below the x-axis to discourage attacks a bit. I think the case for this is now even stronger. So you could have a KingDangerTable[] array that starts with a negative term. You could take that further and also consider cases where there is just one attacker (forbidden now) and many defenders. attackUnits should lead to an KingDangerTable element in that case with a negative value, to discourage attacking and concentrating on another weaker spot in the enemy's camp. But if you want just the first term negative, I now havegaard wrote:FYI, for g/6", and g/60", I have a 4-sigma result in favor of the default. This weekend I am going to set up for testing with modifications to the ...CheckBonus coefficients. Results to follow...
Code: Select all
// init_safety() initizes the king safety evaluation, based on UCI
// parameters. It is called from read_weights().
void init_safety() {
const Value MaxSlope = Value(35);
const Value Peak = Value(1280);
Value t[100];
// First setup the base table
for (int i = 0; i < 100; i++)
{
t[i] = Value(int((0.5 * i * i) + (4 * i) - 4));
if (i > 0)
t[i] = Min(t[i], t[i - 1] + MaxSlope);
t[i] = Min(t[i], Peak);
}
// Then apply the weights and get the final KingDangerTable[] array
for (Color c = WHITE; c <= BLACK; c++)
for (int i = 0; i < 100; i++)
KingDangerTable[c][i] = apply_weight(make_score(t[i], 0), Weights[KingDangerUs + c]);
}
Of course it is still possible that the old king safety calculation from Tord is almost entirely speculative in nature and in that case it may be best to ignore the defenders altogether


Eelco