MadChess 3.1 Beta 533e382 (Move Legality Performance Improvement)

I improved the performance of code that determines the legality of pseudo-legal moves. Previously, move legality was tested prior to playing a move. This consisted of playing a move (to test whether it exposed its own king to check and whether it delivered check on the enemy king), undoing the move, updating the “check” move property, then re-playing the move. Now a move is played, move legality and check is tested, and the Board.PlayMove method returns a (bool isLegal, bool deliversCheck) tuple. The calling method (such as Search.GetDynamicScore or Search.GetQuietScore) then either 1) undoes the move (if illegal or futile)… Continue Reading

MadChess 3.1 Beta d691b32 (Pawn Structure)

I added evaluation of two pawn structure features to MadChess 3.1 Beta. Isolated Pawns Doubled Pawns In addition to pawn structure evaluation, I made other code quality improvements in a series of Pull Requests. PR 24: Upgrade to .NET 6 PR 25: Tune Quiet Positions: Added UCI command that exports quiet positions (static score and quiet score differ <= given centipawns) from a PGN file. Tuner calls Eval.GetStaticScore against QuietPositions.txt instead of Search.GetQuietScore against Games.pgn. PR 26: Lone King Evaluation: Consider any endgame with lone king a simple endgame (instead of only K vrs KQ or KR). PR 27: Remove… Continue Reading

MadChess 3.1 Beta 26e5323 (Threats)

I added evaluation of threats in the middlegame to MadChess 3.1 Beta. A bonus is given if a pawn or minor piece threatens to capture a more valuable piece on its next move. The evaluation code does not determine if the threatening piece is defended. That is left to the Search.GetQuietScore method to resolve. In other words, Search.GetQuietScore may determine the opponent can capture the threatening piece, eliminating the threat and rendering the evaluation bonus moot (because loss of a piece greatly outweighs the threat bonus). Evaluating threats increased the playing strength of MadChess 3.1 Beta by 7 Elo.  … Continue Reading

MadChess 3.1 Beta 2b475bc (Color-Agnostic Code)

I removed 350 lines of code from MadChess and increased its playing strength by 12 Elo. I’m happy with the ratio. The bulk of changes since my last blog post involve replacing redundant, color-specific code with color-agnostic code, mostly in the Eval class. I replaced code such as this… … with code that’s generalized for multiple pieces and colors. The above is just one example of refactored code. There are many others in PR 22 that adds 2,641 lines of code and removes 3,336 lines of code (net -695 lines of code). This refactoring took a lot of time. I… Continue Reading

MadChess 3.1 Beta 0c601ea (Singular Move)

I strengthened MadChess by extending the search horizon of singular moves. I gleaned the idea from the Stockfish chess engine. Quoting from my Pull Request #17: In the GetSearchHorizon method, added call to a new method, IsBestMoveSingular, that determines if best move that had failed high in recent searches is best by a significant margin. If so, extend the search by one ply. A code comment explains why: The best move (from the cache) is singular. That is, it’s the only good move in the position. Evaluation of the current position relies on the accuracy of the singular move’s score.… Continue Reading