King Safety Is Hard!
I have been trying very hard to implement king-safety measurements in the evaluation function. At first, I took it lightly and added all the dream features that I knew of at once:
- Attacks to the king
- Pawn shield for the castled king
- Open files on the castled king
- Awards for castling
Obviously, implementing all the above in one go was a very sweet dream, that never came true. That was when Zahak was still at version 0.3.0. No matter how I was changing the evaluation terms/parameters, the end result was always a weaker Zahak.
After a few iterations, I decided to postpone it until the Search is better, because of course I never implement anything buggy. If there is an issue, it should be from my past-self, not present-self.
No need to say, I was terrified of doing king safety again, version 1.0.0 and 2.0.0 didn’t have any measurements for king safety, and I didn’t even bother trying them again.
Then, Zahak 3.0 came, with the Texel evaluation under his belt. I took the opportunity, and finally was able to add measurements for attacks to the king, and it finally added some Elo! I was so happy, and cut a release and called it a day. So yeah, Zahak 3.0 knows how to attack the king, but doesn’t know how to protect his own king.
Now, I am working on the rest of king safety measurements. While I can make Zahak to retain its strength with king safety, I still struggle to add any measurable strength. At this moment, I am running a gauntlet between current master and a version that implements pawn-shield and castling award measurements. The match is a tight race but the match is still halfway through.
As a side note, I figured that probably the best time-control to measure
Zahak’s progress is
inf/15+0.20. That makes the games (and the match) to take
longer, but the results are more meaningful.