Why is my engine making no progress in the endgame?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

zd3nik
Posts: 193
Joined: Wed Mar 11, 2015 3:34 am
Location: United States

Re: Why is my engine making no progress in the endgame?

Post by zd3nik »

kbhearn wrote:a bit more detail for the position in particular should you try to tackle it by eval (but you should try to fix the 50 move rule thing besides as it'll help these situations in general):

position after 51 ... Rh7

[d]1k2bn2/2p1p2r/2p1P1pN/P1P3P1/1P3P1P/3N4/4R3/2K5 w - - 1 52

what you need to recognise as progress here is that h5 gxh5 f5 is an improvement

[d]1k2bn2/2p1p2r/2p1P2N/P1P2PPp/1P6/3N4/4R3/2K5 b - - 0 53

after that there's many varied possibilities for further progress/counterattacks/etc so it's possible this may not be enough (i.e. some lines white sacs more pawns for a piece so if it likes its pawns so much that it doesn't want to win a piece that could again create a problem)
h5 with the plan of f5 is certainly playable, and probably an easy win. But it's unnecessarily complex. It also gives black an outside passer which any engine eval function is not going to like. Trying to code your eval heuristics to recognize all the complexities of h5 + f5 seems perilous to me.

The simpler and more generalized (e.g. applicable to a wide range of positions, if not all positions) points to focus on in a position like this are:

1. king centralization in endgame positions
2. supporting advanced pawns with the king
3. piece mobility
4. attackers vs defenders (on e6 for example)
5. king safety

1 and 2 should nudge your engine into walking the king up to the (perfectly safe) center. If it gets all the way to e5 (providing support to e6) the night and rook no longer have to babysit e6. Then the rook and nigh can maneuver to more active positions instead of just moving from defensive post to defensive post to hold the position as is.

I think the simplest and most productive thing here is "get the king into the game".

Trying to make your engine smart enough to recognize (via static evaluation) that giving up a pawn to generate a passed pawn *for the enemy* in order to create possibilities with the e+f+g pawns is perilous and will only come in handy in a small percentage of positions. Certainly worth it if you can do it without making eval too slow and without making your engine prefer unnecessary risk over simple development. Also worth the effort if your goal is to make an engine that isn't just like the other 99% of engines out there. But I see that as icing on the cake when sticking to the basics listed above should be enough for any engine to know how to make progress in this position.

Just my 2 cents.
User avatar
hgm
Posts: 27819
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Why is my engine making no progress in the endgame?

Post by hgm »

I don't think the evaluation not recognizing progress can be the OP's problem. He says his engine evaluates the position as +7, while he is only 2 Pawns ahead. So the search must see ample progress.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Why is my engine making no progress in the endgame?

Post by Evert »

hgm wrote:I don't think the evaluation not recognizing progress can be the OP's problem. He says his engine evaluates the position as +7, while he is only 2 Pawns ahead. So the search must see ample progress.
I thought he said that the +7 is from static evaluation of positional elements in the first position...
konsolas
Posts: 182
Joined: Sun Jun 12, 2016 5:44 pm
Location: London
Full name: Vincent

Re: Why is my engine making no progress in the endgame?

Post by konsolas »

hgm wrote:I don't think the evaluation not recognizing progress can be the OP's problem. He says his engine evaluates the position as +7, while he is only 2 Pawns ahead. So the search must see ample progress.
There is a +2 from material, and a +5 from all the positional elements. I'm not sure if I'm weighting the position too much; the positional stuff comes from me forgetting to include material in my initial attempt at writing an eval. Statically, my engine gives a centipawn score of 755 without any searching.

I'm going to start experimenting with attack and defense, and tapering my pcsq tables.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Why is my engine making no progress in the endgame?

Post by Evert »

konsolas wrote: There is a +2 from material, and a +5 from all the positional elements. I'm not sure if I'm weighting the position too much; the positional stuff comes from me forgetting to include material in my initial attempt at writing an eval. Statically, my engine gives a centipawn score of 755 without any searching.
Consider this: a +5 from positional elements is the equivalent of a rook. That's really a lot.

Normally positional elements together are less than a full pawn (it's actually hard to compensate a material deficit with position). There are some that may be larger (king safety can be the equivalent of a rook if it's really poor, a passed pawn on the 7th rank is the equivalent of a minor), but they usually aren't. Certainly it's better to begin conservatively and then ramp things up if testing reveals that they can be larger.