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

Missed Clever Tactical Shot

Recently I reviewed some blitz games I’ve played on Chess.com over the past few months. I found an enjoyable game where I played very well but missed a clever tactical shot near the end of the game. When reviewing the game, I recognized this position. I remember wishing, during the game, that I had more time on my clock to think and work out the tactics. On second observation, I found the killer move. MadChess, along with world-class chess engines Stockfish and Komodo Dragon, confirmed it’s the best move. Can you find it? Very nice! Here’s the full game, with… 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