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 improvements suggested by MadChess.

Banks 87th Amateur Series Division 6

MadChess 3.0 participated in Graham Banks’ 87th amateur tournament in division 6.

                           1    2    3    4    5    6    7    8    9    0    1    2    
1   Cheese 2.2 64-bit      **** 0110 1110 ½½01 ½001 1½½1 1½½½ 11½1 ½111 00½1 1111 11½1  30.0/44
2   Nalwald 1.12 64-bit    1001 **** ½½1½ 0½½1 1½11 ½½½1 0½½½ ½½½½ 1½½1 ½1½½ 1½11 1011  28.0/44
3   RuyDos 1.1.11 64-bit   0001 ½½0½ **** ½010 0½1½ 1011 10½1 11½0 00½½ 1½1½ 1110 1111  25.0/44
4   Devel 3.8.4            ½½10 1½½0 ½101 **** ½000 0½0½ 000½ ½1½1 ½1½1 01½1 1½11 1111  24.5/44
5   K2 0.99                ½110 0½00 1½0½ ½111 **** 1½½1 100½ 1010 1½½0 1½½½ 0110 0½11  24.0/44  517.75
6   OliThink 5.9.9 64-bit  0½½0 ½½½0 0100 1½1½ 0½½0 **** 111½ ½0½0 ½111 11½0 ½01½ 1111  24.0/44  485.00
7   ECE 20.1 64-bit        0½½½ 1½½½ 01½0 111½ 011½ 000½ **** ½1½1 ½001 11½0 0010 10½½  22.0/44
8   Zahak 5.0 64-bit       00½0 ½½½½ 00½1 ½0½0 0101 ½1½1 ½0½0 **** 0½10 1½½½ ½1½1 11½½  21.0/44
9   ProDeo 3.1             ½000 0½½0 11½½ ½0½0 0½½1 ½000 ½110 1½01 **** 1½01 1010 0½½½  19.0/44
10  Nawito 2103            11½0 ½0½½ 0½0½ 10½0 0½½½ 00½1 00½1 0½½½ 0½10 **** ½1½½ ½010  18.0/44
11  Drosophila 1.6 64-bit  0000 0½00 0001 0½00 1001 ½10½ 1101 ½0½0 0101 ½0½½ **** 1110  16.5/44
12  MadChess 3.0 64-bit    00½0 0100 0000 0000 1½00 0000 01½½ 00½½ 1½½½ ½101 0001 ****  12.0/44

Games

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 was careful to test often to ensure my (partial) changes did not weaken the engine due a mistake when translating color-specific code to color-agnostic code via array lookups indexed by colorless piece.

The Board.GetSquareFromWhitePerspective method violates the spirit of my refactoring. However, an exception is warranted because I don’t bother storing white and black piece location values in separate tables. For black, I simply lookup the corresponding square from white’s side of the board.

In addition to color-agnostic refactoring, I made other code quality improvements in a series of Pull Requests.

Combined, the five PRs removed 350 lines of code. This increased the playing strength of MadChess 3.1 Beta by 12 Elo.

 

Feature Category Date Commit1 WAC2 Elo Rating3 Improvement
Color-Agnostic Code Evaluation 2021 Sep 13 2b475bc 286 2629 +12
Singular Move Search 2021 Jun 14 0c601ea 290 2617 +13
Endgame Eval Scaling Evaluation 2021 Apr 08 4d22dec 286 2604 +12
Bishop Pair Evaluation 2021 Mar 14 2960ec9 285 2592 +22
Position Cache Optimization Search 2021 Feb 23 42d7702 286 2570 +8
Move Generation Optimization Search 2021 Feb 17 22002dc 287 2562 +12
PVS and Null Move Search 2021 Feb 09 f231dac 285 2550 +20
Remove Aspiration Windows Search 2020 Dec 20 4b7963b 290 2530 +9
Time Management Search 2020 Dec 19 d143bb5 286 2521 +8
Crash Bug Search 2020 Aug 29 2d855ec 288 2513 +0
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 commit (hash) or Subversion source code revision (integer)
  2. Win At Chess position test, 3 seconds per position
  3. Bullet chess, 2 min / game + 1 sec / move

The Mad Lot

MadChess 3.0 participated in a tournament Graham Banks arranged, named The Mad Lot.

“The Mad Lot”, ha ha. My engine’s namesake tournament. Rising to the occasion, MadChess 3.0 won the tournament! That’s two consecutive tournament victories for MadChess.

                                1    2    3    4    5    6    7    8    9    0    1    2    3    4    
1   MadChess 3.0 64-bit         **** ½½0½ 0111 1½01 0011 ½½½1 11½0 ½10½ ½½½½ 1½11 1½11 ½111 1½1½ 1½11  35.0/52
2   Nalwald 1.10 64-bit         ½½1½ **** 101½ 1½10 01½1 1010 1100 10½1 ½1½0 11½1 1½11 ½011 ½11½ 11½1  34.5/52
3   Coiled 0.6 64-bit           1000 010½ **** 1111 ½101 0½11 ½½1½ 0½11 1½01 111½ ½1½1 ½11½ ½101 1001  33.0/52
4   CM9000 Default              0½10 0½01 0000 **** ½011 00½1 ½11½ 111½ 1½00 ½½1½ 1110 1½01 ½½11 1110  29.0/52
5   Ceibo 0.7 64-bit            1100 10½0 ½010 ½100 **** 1½½½ 0½1½ 101½ 0111 ½½10 1101 101½ 0100 0111  28.0/52  706.75
6   RookieMonster 1.9.2 64-bit  ½½½0 0101 1½00 11½0 0½½½ **** ½00½ ½1½0 ½10½ 0½01 1½01 1111 11½1 ½110  28.0/52  681.25
7   Zahak 4.0 64-bit            00½1 0011 ½½0½ ½00½ 1½0½ ½11½ **** 00½½ 0½11 10½0 ½½01 ½½11 101½ 1111  27.5/52
8   Ghost 3.1 64-bit            ½01½ 01½0 1½00 000½ 010½ ½0½1 11½½ **** ½½11 ½00½ 10½0 1111 11½1 ½1½0  27.0/52
9   Raven 1.10 64-bit           ½½½½ ½0½1 0½10 0½11 1000 ½01½ 1½00 ½½00 **** 1110 ½½0½ 01½1 0111 ½10½  25.5/52
10  Dorky 4.8 64-bit            0½00 00½0 000½ ½½0½ ½½01 1½10 01½1 ½11½ 0001 **** 10½0 1½10 ½0½1 1½01  22.5/52
11  Galjoen 0.41.2 64-bit       0½00 0½00 ½0½0 0001 0010 0½10 ½½10 01½1 ½½1½ 01½1 **** 1010 1½01 0011  21.5/52
12  Trace 1.37a                 ½000 ½100 ½00½ 0½10 010½ 0000 ½½00 0000 10½0 0½01 0101 **** 11½1 ½1½½  18.0/52
13  CT800 1.42 64-bit           0½0½ ½00½ ½010 ½½00 1011 00½0 010½ 00½0 1000 ½1½0 0½10 00½0 **** ½101  17.5/52
14  Qapla 0.1.1 64-bit          0½00 00½0 0110 0001 1000 ½001 0000 ½0½1 ½01½ 0½10 1100 ½0½½ ½010 ****  17.0/52

Games

Banks 86th Amateur Series Division 7

MadChess 3.0 participated in Graham Banks’ 86th amateur tournament in division 7.

MadChess 3.0 won the tournament! I believe this is MadChess’ first tournament win.

                                1    2    3    4    5    6    7    8    9    0    1    2    
1   MadChess 3.0 64-bit         **** ½1½1 ½½11 1010 ½111 1½01 0101 ½10½ 1000 ½001 ½1½½ 1111  27.0/44  586.25
2   Drosophila 1.6 64-bit       ½0½0 **** 00½1 1½½1 ½½½0 01½½ 11½½ ½½1½ 1110 ½1½½ 0111 1111  27.0/44  558.50
3   KnightX 2.8 64-bit          ½½00 11½0 **** 1010 1011 ½½1½ 01½½ 11½0 01½½ 101½ 1011 01½½  25.0/44  536.00
4   Supernova 2.3 64-bit        0101 0½½0 0101 **** ½0½0 ½111 ½011 1½½½ 1½1½ ½½1½ ½½11 ½10½  25.0/44  528.00
5   paulchen332 0.1.1 64-bit    ½000 ½½½1 0100 ½1½1 **** ½110 ½10½ ½1½½ ½11½ 11½0 1100 1100  23.5/44
6   RookieMonster 1.9.2 64-bit  0½10 10½½ ½½0½ ½000 ½001 **** ½1½1 11½½ 1100 ½1½½ 1011 0½½1  22.5/44
7   Nalwald 1.9 64-bit          1010 00½½ 10½½ ½100 ½01½ ½0½0 **** ½111 1100 ½½11 1½01 0½10  22.0/44  472.75
8   Lozza 2.0 64-bit            ½01½ ½½0½ 00½1 0½½½ ½0½½ 00½½ ½000 **** ½½1½ 1111 1½½1 11½½  22.0/44  456.25
9   Delocto 200419 64-bit       0111 0001 10½½ 0½0½ ½00½ 0011 0011 ½½0½ **** 0½10 ½001 1½10  19.0/44
10  Jumbo 0.7.0 64-bit          ½110 ½0½½ 010½ ½½0½ 00½1 ½0½½ ½½00 0000 1½01 **** 0½01 ½½1½  17.5/44
11  Raven 1.10 64-bit           ½0½½ 1000 0100 ½½00 0011 0100 0½10 0½½0 ½110 1½10 **** 1010  17.0/44
12  Axolotl 1.9 64-bit          0000 0000 10½½ ½01½ 0011 1½½0 1½01 00½½ 0½01 ½½0½ 0101 ****  16.5/44

Games