Evaluation function query - scoring when in check

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

Evaluation function query - scoring when in check

Post by silentshark »

Here's one I've been thinking about, but have thus far ignored.

What do you do about the eval function if STM is in check. At the moment, I ignore, but that doesn't feel right. I could score it as 0 or some lower score, but that doesn't sound right either. What do others do when calling the eval function when in check?
jorose
Posts: 360
Joined: Thu Jan 22, 2015 3:21 pm
Location: Zurich, Switzerland
Full name: Jonathan Rosenthal

Re: Evaluation function query - scoring when in check

Post by jorose »

If the side to move is in check I don't call the evaluation function in such positions and do not reduce search depth in such positions either. I feel this is necessary for tactical stability.
qIf your evaluation function can deal with short tactics like a neural network can for example, there is little reason to care about checks specifically. Unfortunately, classical feature based models can't typically do that.
-Jonathan
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Evaluation function query - scoring when in check

Post by Ras »

Nothing special, but in main search, I don't enter QS when in check, and in QS, I generate evasions.
Rasmus Althoff
https://www.ct800.net
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Evaluation function query - scoring when in check

Post by xr_a_y »

Ras wrote: Mon Jan 21, 2019 9:07 pm Nothing special, but in main search, I don't enter QS when in check, and in QS, I generate evasions.
I never enter QS when in check also.

Maybe the question was what to do with static scoring when in check. And for this question I see many engine setting static score to mate. Here is xiphos line about that

Code: Select all

  if (pos->in_check)
    static_score = -MATE_SCORE + ply;
else
    // ...
I guess this avoid check for isInCheck bool at many places.
User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

Re: Evaluation function query - scoring when in check

Post by silentshark »

xr_a_y wrote: Tue Jan 22, 2019 7:40 am
Ras wrote: Mon Jan 21, 2019 9:07 pm Nothing special, but in main search, I don't enter QS when in check, and in QS, I generate evasions.
I never enter QS when in check also.

Maybe the question was what to do with static scoring when in check. And for this question I see many engine setting static score to mate. Here is xiphos line about that

Code: Select all

  if (pos->in_check)
    static_score = -MATE_SCORE + ply;
else
    // ...
I guess this avoid check for isInCheck bool at many places.
Yes, the question would have been better phrased as 'what to do with static scoring when in check'. Thanks for your feedback, I *think* your response makes sense.