King position evaluations?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

SrcEngine
Posts: 6
Joined: Sun Mar 22, 2020 3:04 pm
Full name: Luke Kong

King position evaluations?

Post by SrcEngine »

How do I evaluate the position of the king? During the opening and the middle game, the king should be behind the pawns and at the back ranks. In the end game, however, the king should be more active. How should my engine distinguish between openings and end games?
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: King position evaluations?

Post by Dann Corbit »

There are different ways to calculate game phase.
An easy way is just to look at the chessman count.
You might like to look at Ed Schroder's page about evaluation, or the chess programming wiki under topic king safety.
https://www.chessprogramming.org/King_Safety
http://members.home.nl/matador/Inside%20Rebel.pdf
https://www.chessprogramming.org/Game_Phases
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Terje
Posts: 347
Joined: Tue Nov 19, 2019 4:34 am
Location: https://github.com/TerjeKir/weiss
Full name: Terje Kirstihagen

Re: King position evaluations?

Post by Terje »