I added tapered evaluation to MadChess 2.0 Beta. The evaluation assigns a material score, a middlegame piece location score, and an endgame piece location score. Then calculates the game phase and returns a weighted average of the middlegame and endgame scores.
By separating piece location scores into middlegame and endgame phases, I can encourage MadChess to hold its queen back during the middlegame, and bring its king to the center during the endgame, for example.
private const int _minorPhaseMaterial = 1; | |
private const int _rookPhaseMaterial = 1; | |
private const int _queenPhaseMaterial = 2; | |
_openingPhaseMaterial = (8 * _minorPhaseMaterial) + (4 * _rookPhaseMaterial) + (2 * _queenPhaseMaterial); | |
// Determine phase. | |
int phaseMaterial = _minorPhaseMaterial * (_whiteKnights + _whiteBishops + _blackKnights + _blackBishops); | |
phaseMaterial += _rookPhaseMaterial * (_whiteRooks + _blackRooks); | |
phaseMaterial += _queenPhaseMaterial * (_whiteQueens + _blackQueens); | |
_middlegamePercent = Math.Min((100 * phaseMaterial) / _openingPhaseMaterial, 100); | |
int endgamePercent = 100 - _middlegamePercent; | |
int middlegameScore = materialScore + mgLocationScore; | |
int endgameScore = materialScore + egLocationScore; | |
int staticScore = ((middlegameScore * _middlegamePercent) + (endgameScore * endgamePercent)) / 100; | |
return _board.CurrentPosition.WhiteMove ? staticScore : -staticScore; |
This added 107 Elo to the playing strength of MadChess 2.0 Beta.
MadChess 2.0 1596 : 800 (+42,=72,-686), 9.8 % vs. : games ( +, =, -), (%) : Diff, SD, CFS (%) BikJump v2.01 : 100 ( 0, 2, 98), 1.0 : -490, 18, 0.0 Matheus-2.3 : 100 ( 3, 10, 87), 8.0 : -467, 17, 0.0 Monarch 1.7 : 100 ( 2, 2, 96), 3.0 : -446, 18, 0.0 BigLion 2.23w : 100 ( 5, 11, 84), 10.5 : -413, 17, 0.0 Faile 1.4 : 100 ( 7, 10, 83), 12.0 : -404, 16, 0.0 Sharper 0.17 : 100 ( 4, 9, 87), 8.5 : -396, 17, 0.0 Jabba13032012 : 100 ( 7, 12, 81), 13.0 : -337, 17, 0.0 Roce 0.0390 : 100 ( 14, 16, 70), 22.0 : -258, 16, 0.0
Feature | Category | Date | Rev1 | WAC2 | Elo Rating3 | Improvement |
---|---|---|---|---|---|---|
Tapered Evaluation MG and EG Piece Location |
Evaluation | 2014 Nov 29 | 21 | 234 | 1596 | +107 |
Alpha / Beta Negamax Aspiration Windows Quiescence, Hash Material, Piece Squares |
Baseline | 2014 Nov 25 | 20 | 236 | 1489 | – |
- Subversion source code revision
- Win At Chess position test, 3 seconds per position
- Bullet chess, 2 min / game + 1 sec / move