MadChess 3.0 Beta 6794c89 (King Safety)

I added evaluation of king safety to MadChess 3.0 Beta. Because determining the safety of a king’s position involves examining moves that attack squares near the king, I combined it with piece mobility evaluation, which also examines moves. When examining piece mobility, keep a weighted count of attacks on squares ringing the king (16 squares in outer ring and 8 squares in inner ring) with separate weights for attacks by minor pieces, rooks, and queens.

In the following code, white moves to squares ringing the black king contribute negatively to black’s king safety. Black moves to squares ringing the white king contribute negatively to white’s king safety. This will become evident in a later code snippet that illustrates the king safety array contains negative values.

The above code encourages MadChess to block enemy pieces from “aiming” at its king. Conversely, it encourages MadChess to direct its pieces toward the enemy king for an eventual attack.

Next, add a weighted count of semi-open files (missing guard pawn) near the king (left file, king file, and right file). Evaluate this only for the middlegame, assuming open files are common in the endgame and don’t necessarily make a king’s position unsafe.

Finally, lookup the king safety score in an array. The array is calculated at engine startup using a non-linear formula.

The showevalparams command displays the king safety values calculated by the above code.

PS C:\Users\Erik\Documents\Chess\Engines\MadChess\3.0> .\MadChess.Engine.exe
showevalparams

King Safety KingSafetyPowerPer16:                029
King Safety MgKingSafetySemiOpenFilePer8:        062
King Safety KingSafetyMinorAttackOuterRingPer8:  008
King Safety KingSafetyMinorAttackInnerRingPer8:  021
King Safety KingSafetyRookAttackOuterRingPer8:   007
King Safety KingSafetyRookAttackInnerRingPer8:   018
King Safety KingSafetyQueenAttackOuterRingPer8:  014
King Safety KingSafetyQueenAttackInnerRingPer8:  033
King Safety KingSafetyScalePer128:               043

King Safety:  +000 +000 -001 -002 -004 -006 -008 -011 -014 -018 -021 -025 -030 -035 -040 -045 -051 -057 -063 -069 -076 -083 -091 -098 -106 -114 -123 -132 -141 -150 -159 -169 -179 -189 -200 -211 -222 -233 -245 -257 -269 -281 -294 -306 -319 -333 -346 -360 -374 -388 -403 -418 -433 -448 -463 -479 -495 -511 -527 -544 -561 -578 -595 -613

In addition, I simplified use of aspiration windows when searching the root position. The engine searches with a window of 200 centipawns (100 in each direction) centered around the best score from the prior search depth. If this fails high or low, adjust the aspiration window in the direction of failure by 600 centipawns. If this fails high or low, search the root position using an infinite window.

This code increased the playing strength of MadChess 3.0 Beta by 63 ELO. MadChess has crossed the 2500 ELO threshold.

 

Feature Category Date Rev1 WAC2 ELO Rating3 Improvement
King Safety Evaluation 2020 Aug 16 6794c89 288 2513 +63
Eval Param Tuning Evaluation 2020 Jul 23 bef88d5 283 2450 +30
Late Move Pruning Search 2020 Feb 08 6f3d17a 288 2420 +29
Piece Mobility Evaluation 2020 Feb 01 5c5d4fc 282 2391 +62
Passed Pawns Evaluation 2018 Dec 27 103 279 2329 +119
Staged Move Generation Search 2018 Dec 15 93 275 2210 +39
History Heuristics Search 2018 Dec 03 84 275 2171 +28
Eval Param Tuning Evaluation 2018 Nov 24 75 272 2143 +47
Sophisticated Search
Material and Piece Location
Baseline 2018 Nov 08 58 269 2096 0
  1. GitHub (hash) or Subversion (integer) source code revision
  2. Win At Chess position test, 3 seconds per position
  3. Bullet chess, 2 min / game + 1 sec / move
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *