Definition of "endgame"?

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, bob, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Jouni
Posts: 2227
Joined: Wed Mar 08, 2006 7:15 pm

Definition of "endgame"?

Post by Jouni » Wed Jan 30, 2008 3:26 pm

Simply: how many pieces there can be on board? I remember old
Crafty's had some kind of game phase info: how was it done?

Jouni

User avatar
pedrox
Posts: 998
Joined: Fri Mar 10, 2006 5:07 am
Location: Basque Country (Spain)
Contact:

Re: Definition of "endgame"?

Post by pedrox » Wed Jan 30, 2008 4:17 pm

Definition of endgame --> the endgame refers to the stage of the game when there are few pieces left on the board.

Every programmer and player may have its own idea of when it begins this stage of the game.

For example TSCP said that the endgame phase occurs when the two sides have a material equal to or less than the equivalent of 12 pawns (knight and bishop equal 3 pawns, rook 5 pawns, queen 9 pawns).

Harald Johnsen

Re: Definition of "endgame"?

Post by Harald Johnsen » Wed Jan 30, 2008 5:19 pm

Jouni wrote:Simply: how many pieces there can be on board? I remember old
Crafty's had some kind of game phase info: how was it done?

Jouni
You don't want to go from the middle game to the end game abruptly when a piece is exhanged. You compute two evaluations of the position, one for the middle game, and one that fit better late end game evaluation.
Then you smooth the two values.
eval = Lerp(middle game score, end game score, phase);
Phase could be 0.0 at the begining and 1.0 when there is only the king left,
for example phase = 1.0 - number of pieces on board / max number of piece on the board.

HJ.

User avatar
hgm
Posts: 25075
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Definition of "endgame"?

Post by hgm » Wed Jan 30, 2008 5:33 pm

This has always seemed a very fishy method to me. Why would the game stage not simply be an instantaneous function of what is on the board? We don't smooth heavy material losses, do we? Like if you are a Rook ahead, and a certain line loses your Queen, not take the -950 centiPawn immediately, but slowly ramp down the evaluation from +500 to -450 over the next 10 moves after the capture...

Tony

Re: Definition of "endgame"?

Post by Tony » Wed Jan 30, 2008 6:01 pm

hgm wrote:This has always seemed a very fishy method to me. Why would the game stage not simply be an instantaneous function of what is on the board? We don't smooth heavy material losses, do we? Like if you are a Rook ahead, and a certain line loses your Queen, not take the -950 centiPawn immediately, but slowly ramp down the evaluation from +500 to -450 over the next 10 moves after the capture...
Agreed, when we're in a RB vs RB endgame, we don't want to smoothly continue when the bishops or the rook are exchanged. We enter a complete different endgame, with different bonusses or penalties.

Connected passed pawn fe change their scores bigtimes.

The smoothing seems nice for some general stuff. ie a pawn advantage can smoothly increase when changing pieces to "guide" the engine. But there are different ways of doing that as well.

Tony

adams161
Posts: 556
Joined: Sun May 13, 2007 7:55 pm
Location: Tacoma, WA USA

Re: Definition of "endgame"?

Post by adams161 » Wed Jan 30, 2008 6:06 pm

hi,

I have a cheap way of doing this. An endgame occurs when material reaches a point that you have few pieces on the board. Maybe as suggested the value of 12 pawns. I'm actually using two stages of endgame i think, endgame1 and endgame2.

Since i dont want to allow a single capture mid search to radically change teh score, i.e. the capture and bring me into endgame, I dont allow the phase change to endgame to occur in a search.

At the beginning of a search before calling search, i check if we are in endgame. If we are then i set one of or both of the endgame flags. I dump the hash also at that point since it contains scores that were not evalutated with endgame eval parameters.

the cost is a less precise knowledge of when you enter endgame. but i set my count of pieces in such a way that its a little higher, so that if some pieces get captured in search it doesnt push me to to low a piece count beyond what i feel would be endgame.

Mike

Tony

Re: Definition of "endgame"?

Post by Tony » Wed Jan 30, 2008 6:21 pm

adams161 wrote:hi,

I have a cheap way of doing this. An endgame occurs when material reaches a point that you have few pieces on the board. Maybe as suggested the value of 12 pawns. I'm actually using two stages of endgame i think, endgame1 and endgame2.

Since i dont want to allow a single capture mid search to radically change teh score, i.e. the capture and bring me into endgame, I dont allow the phase change to endgame to occur in a search.

At the beginning of a search before calling search, i check if we are in endgame. If we are then i set one of or both of the endgame flags. I dump the hash also at that point since it contains scores that were not evalutated with endgame eval parameters.

the cost is a less precise knowledge of when you enter endgame. but i set my count of pieces in such a way that its a little higher, so that if some pieces get captured in search it doesnt push me to to low a piece count beyond what i feel would be endgame.

Mike
That doesn't sound like a solution, more like ignoring (or worsening) the problem. A lot of times (fe a rook bishop ending) the reason for not exchanging the bishop is because the "shift" of the values of the connected passed pawns.

Not allowing the score transitions would be very bad. With nowadays hardware, the normal search makes this transition pretty often and quiescence search very often.

Tony

adams161
Posts: 556
Joined: Sun May 13, 2007 7:55 pm
Location: Tacoma, WA USA

Re: Definition of "endgame"?

Post by adams161 » Wed Jan 30, 2008 7:07 pm

hi,

My endgame control only effects king saftey and null moves so its not such a big issue however its been on the back of my mind how to implent pawn evaluates specific to endgames which i dont do now.

The other week i had pulsar play a game with tinker on icc, it was doing fine the whole game tell it got to endgame then it let tinker get a passed pawn, pulsar had one two, but pulsars pawn was going to lose the race but pulsar didnt see it. So the idea of adding endgame specific pawn code has been on my mind.

Any suggestions for some basic start points on how to evaluate pawns differently in endgame, throughout the game i'm evaluating passed, doubled, isolated and backwared i think, and cheap ways in terms of code and proccesing to implement them?

MIke

bob
Posts: 20918
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Definition of "endgame"?

Post by bob » Wed Jan 30, 2008 7:54 pm

Jouni wrote:Simply: how many pieces there can be on board? I remember old
Crafty's had some kind of game phase info: how was it done?

Jouni
there is no "exact solution". The question is, at what point in material do you feel safe to have your king get out into the center of the board as an attacking piece? If you start too early, you get mated. If you start too late, your opponent crushes you in an ending.

bob
Posts: 20918
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Definition of "endgame"?

Post by bob » Wed Jan 30, 2008 7:55 pm

hgm wrote:This has always seemed a very fishy method to me. Why would the game stage not simply be an instantaneous function of what is on the board? We don't smooth heavy material losses, do we? Like if you are a Rook ahead, and a certain line loses your Queen, not take the -950 centiPawn immediately, but slowly ramp down the evaluation from +500 to -450 over the next 10 moves after the capture...
It is a known problem, known as an evaluation discontinuity. Berliner wrote a paper on it years ago. It is definitely a bad idea to have a large jump. The search will be very unstable around that point and the alpha/beta full-width search can find creative ways to use that "jump" to distort the score in a bad way...

best avoided...

Post Reply