Page 1 of 1
Early / middle / end game transitions?
Posted: Sun Feb 19, 2017 3:24 am
by notachessplayer
I've been reading books about chess strategy to be able to code my AI properly, but the limit is never clear.
I was wondering what is generally a good time to change the state of the game to middle or end game, in chess programming?
What do stockfish, komodo, houdini do?
Re: Early / middle / end game transitions?
Posted: Sun Feb 19, 2017 4:41 pm
by thevinenator
notachessplayer wrote:I've been reading books about chess strategy to be able to code my AI properly, but the limit is never clear.
I was wondering what is generally a good time to change the state of the game to middle or end game, in chess programming?
What do stockfish, komodo, houdini do?
When you find out the best way to do it, please share! LOL
this is one of those, "there is no right way" topics.
there are many ways to look at it. i have special code for all 2-3-4 piece endings, so my eval jumps to those whenever detected. I've been reading up on pawn only endings, so perhaps at some point i'll have "ending" code to deal with pawn only. does that mean my "endgame" starts then? not really.
it all depends what you are going to do once you have detected your "endgame". there are examples, such as the test in NULL move that says, if in endgame, don't do NULL move, but you'll have to play around to decide what you like best. one can always find zugzwang positions that will make every endgame cutoff fail. no holy grail here. what defines endgame for NULL move might be wrong elsewhere.
SF does a lot of eval tapering, meaning the score of an eval element changes between the beginning and ending of the game. you could look at it from that perspective on a case by case basis.
Re: Early / middle / end game transitions?
Posted: Sun Feb 19, 2017 6:43 pm
by H.G.Muller
Most engines do not define a point of sudden transition between the game phases, but calculate an 'opening' and 'end-game' score (using different piece values, piece-square tables, king-safety weights,mobility weights, and interpolate these linearly depending on the value of the material still on the board. The latter is usually calculated without paying attention to Pawns, e.g. Q=6, R=3, N=B=1, P=0. Then the game phase can range from 32 (100% opening, 0% end-game) to 0 (0% opening, 100% end-game).
For specific late end-games there can be special evaluation functions. These are usually recognized by keeping track of a 'material index', mapping every material combination to a unique number,and using that to access a table. Such a table could contain a simple additive score corrections (e.g. to account for the Bishop pairs), a multiplication factor for drawishness (e.g. when there are no Pawns, or the last Pawn can be sacrificed away leaving a dawnless draw),or the numberof a specilized end-game evaluator that also takes the location of the pieces into account (e.g. KPK, KBPK, KQKP). These can even be in an exhaustive table, or a much smaller material hash table.