Including threats in evaluation

Code, algorithms, languages, construction...

Including threats in evaluation

Postby kickstone » Fri Dec 30, 2016 5:00 pm

I'm looking at scoring threats in the evaluation function. I already update the attack/defend bit boards when computing mobility and king safety so i'm less concerned about the expense. This is what i'm doing so far:

supported = attacked by an own pawn
defended = attacked by an own piece

Score a bonus for attacking an unsupported enemy pawn or bishop, or any attack on enemy rook or queen

Score a bonus for attacking an unsupported enemy pawn or knight, or any attack on enemy rook or queen

Score a bonus for attacking an unsupported enemy pawn, knight or bishop or any attack on enemy queen

Score a bonus for attacking an unsupported enemy pawn, knight, bishop or rook

While computing these bonuses i update a bit board of hanging pieces which attract a bonus a well.

I think including threats in evaluation has some obvious benefits. We include so many eval bonuses that are just best guesses in any specific position anyways. I would think attacking unsupported pieces would promote an attacking style and open up some tactical possibilities. The other major benefit i see is in countering some horizon effects. When at D = 1 some threat develops (say we are forked by an enemy knight) we go to quiescence where we decide to stand pat and the loss is ignored. By including threats, the decrease in standpat score may be enough to choose a different path and avoid this.

I have two questions. What size of bonuses have people had success with? Just to give you an idea of what i tried so far, for knights these are the bonuses for attacking various pieces (pawn, bishop, rook, queen). I use higher values for the endgame bonuses.

3, 8, 15, 15 (centipawns)

I want the bonus to be big enough to detect threats when entering qSearch but i don't want to override other eval terms. Specifically i don't want to value chasing pieces around over other positional factors.

And finally, I do a static eval at all internal nodes. How have people used this threat information to improve search? I'm thinking we avoid futility pruning at nodes where we have a big jump in threat score from the previous ply. Anything else?
Posts: 14
Joined: Fri Feb 26, 2016 7:27 am

Re: Including threats in evaluation

Postby kickstone » Tue Jan 03, 2017 8:06 pm

Okay so its not an inexpensive eval term after all, even with much of the calcs done in mobility. However, upon further reflection it can be made faster and better. I was ignoring the case where a white piece attacks the same piece type of black. Thats a mistake. If a white knight that is supported by an own pawn attacks a black knight that is also supported than its a wash. But if the black knight is not supported, then either the tension is resolved by an exchange or an evasion OR another black piece is tasked with defending it. This should result in a small penalty, as we have most likely overstated the mobility of that defending piece in the mobility scoring. Its also faster since i only have to look at minor piece attacks on unsupported enemy pawns or minor pieces as well as enemy rooks and queens instead of knights and bishops separately.

I'm convinced this is an important eval term. Anything that results in pieces being forced to defend other pieces decreases their mobility (currently not accounted for in mobility calculation) and leads to potentially winning tactics. I'm just not sure of the magnitude of the penalty and more importantly, how can i use this information within the search to make better pruning decisions?
Posts: 14
Joined: Fri Feb 26, 2016 7:27 am

Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 1 guest