Banks 73rd Amateur Series Division 7

MadChess 2.2 participated in Graham Banks’ 73rd amateur tournament in division 7.

                                Baga Donn Dork Orio Ghos MadC Bets Rook Dros Jumb Lozz Romi
 1. Bagatur 1.7 64-bit          #### =0== ==0= 1==0 ===1 =111 11=1 =10= ==1= 110= =111 1=1= 64%  28.0 (944.0, 583.8)
 2. Donna 4.1 64-bit            =1== #### =101 =11= 1=00 1=1= 1110 ===1 1==0 ==== 1110 101= 62%  27.5 (946.0, 592.0)
 3. Dorky 4.8 64-bit            ==1= =010 #### 1=== 111= 1=00 10== =011 1110 0=11 ===1 =0=1 59%  26.0 (952.0, 561.3)
 4. Orion 0.5 64-bit            0==1 =00= 0=== #### 0100 1==1 =001 =1=1 1011 1111 ==1= =1=1 58%  25.5 (954.0, 519.0)
 5. Ghost 3.1 64-bit            ===0 0=11 000= 1011 #### 1101 =101 ==== =111 10=0 10=0 111= 57%  25.0 (956.0, 528.8)
 6. MadChess 2.2 64-bit         =000 0=0= 0=11 0==0 0010 #### 0=1= 11=1 1011 0111 =110 =1=1 52%  23.0 (964.0, 462.3)
 7. Betsabe II 1.84             00=0 0001 01== =110 =010 1=0= #### 1=10 ==0= 1111 ==10 1110 51%  22.5 (966.0, 462.8)
 8. RookieMonster 1.6.6 64-bit  =01= ===0 =100 =0=0 ==== 00=0 0=01 #### 11=0 01=1 001= ===1 43%  19.0 (980.0, 408.3)
 9. Drosophila 1.5.1 64-bit     ==0= 0==1 0001 0100 =000 0100 ==1= 00=1 #### ==01 =110 11=1 43%  19.0 (980.0, 394.0)
10. Jumbo 0.6.96 64-bit         001= ==== 1=00 0000 01=1 1000 0000 10=0 ==10 #### =1=1 =11= 41%  18.0 (984.0, 379.5)
11. Lozza 1.18 64-bit           =000 0001 ===0 ==0= 01=1 =001 ==01 110= =001 =0=0 #### 0011 40%  17.5 (986.0, 380.8)
12. RomiChess P3n 64-bit        0=0= 010= =1=0 =0=0 000= =0=0 0001 ===0 00=0 =00= 1100 #### 30%  13.0 (1004.0, 295.8)

Games

Banks 72nd Amateur Series Division 7

MadChess 2.2 participated in Graham Banks’ 72nd amateur tournament in division 7.

                                Asym Topp Dork Ghos Jumb MadC Rook Bets Baga Lozz Dros Neme  
 1. Asymptote 0.4 64-bit        #### 1=00 =1=1 101= 11=1 1=11 0=== 0110 11== 0=1= 111= =111  67%  29.5 (938.0, 616.3)
 2. Topple 0.3.3 64-bit         0=11 #### ==10 0=11 1=01 0111 ==0= 0111 0011 ==1= 11=1 1111  66%  29.0 (940.0, 601.8)
 3. Dorky 4.8 64-bit            =0=0 ==01 #### 1011 000= 111= 1111 1110 0111 0110 1001 ==11  61%  27.0 (948.0, 562.5)
 4. Ghost 3.1 64-bit            010= 1=00 0100 #### 1=01 0101 010= 1101 =110 1==1 1001 11=1  55%  24.0 (960.0, 494.8)
 5. Jumbo 0.6.96 64-bit         00=0 0=10 111= 0=10 #### 0=== ==11 =1== 101= 0==0 1111 1==0  53%  23.5 (962.0, 495.8)
 6. MadChess 2.2 64-bit         0=00 1000 000= 1010 1=== #### 1010 010= 0100 1111 1=11 1=1=  49%  21.5 (970.0, 426.3)
 7. RookieMonster 1.6.6 64-bit  1=== ==1= 0000 101= ==00 0101 #### ===0 110= ===1 0==1 1010  48%  21.0 (972.0, 458.3)
 8. Betsabe II 1.84             1001 1000 0001 0010 =0== 101= ===1 #### ==== 10== 1110 1010  47%  20.5 (974.0, 432.5)
 9. Bagatur 1.6 64-bit          00== 1100 1000 =001 010= 1011 001= ==== #### 1=1= ===0 =01=  45%  20.0 (976.0, 428.3)
10. Lozza 1.18 64-bit           1=0= ==0= 1001 0==0 1==1 0000 ===0 01== 0=0= #### =0=0 ==1=  40%  17.5 (986.0, 395.8)
11. Drosophila 1.5.1 64-bit     000= 00=0 0110 0110 0000 0=00 1==0 0001 ===1 =1=1 #### 1100  36%  16.0 (992.0, 336.0)
12. Nemeton 1.8                 =000 0000 ==00 00=0 0==1 0=0= 0101 0101 =10= ==0= 0011 ####  33%  14.5 (998.0, 303.5)

Games

MadChess 3.0 Beta Build 103 (Passed Pawns)

I added passed pawn evaluation to MadChess 3.0 Beta. The passed pawn evaluation code scores the following features:

  • Passed Pawns
  • Free Passed Pawns (no pieces blocking promotion path)
  • King Escorted Passed Pawns
  • Unstoppable Passed Pawns (Rule of the Square)

Middlegame Passed Pawns:            000  000  003  008  015  024  034  000
Endgame Passed Pawns:               000  004  018  042  075  118  170  000
Endgame Free Passed Pawns:          000  008  034  077  138  216  311  000
Endgame King Escorted Passed Pawn:  11
Unstoppable Passed Pawn:            775

 

This code improved the engine’s understanding of threats created by pushing passed pawns. It increased the playing strength of MadChess 3.0 Beta by 119 Elo.

 

Feature Category Date Rev1 WAC2 Elo Rating3 Improvement
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. Subversion source code revision
  2. Win At Chess position test, 3 seconds per position
  3. Bullet chess, 2 min / game + 1 sec / move

MadChess 3.0 Beta Build 093 (Staged Move Generation)

I increased the speed at which MadChess 3.0 Beta examines nodes by implementing staged move generation. Previously, in the main search, the chess engine would generate all pseudo-legal moves, sort them by move priority, then iterate through them: testing move legality (does move expose own king to check) and playing the legal moves. This is wasteful if a beta cutoff occurs early in the move list. Usually a capture is responsible for a beta cutoff, so time is wasted generating non-captures. Now the chess engine generates moves in stages.

I could have implemented more stages (QueenCaptures, RookCaptures, BishopKnightCaptures, etc) but I wanted to keep the code simple. Implementing a stage for captures of each piece type involves calculating all attacks to a square, not from a square as the engine already does. To test move legality I have already implemented an IsSquareAttacked(int Square) method that returns a boolean value. This does not generate moves though. If I were to implement a GetAttackingMoves(int Square) method I’d need to write debug code that validates the captures generated by calling GetAttackingMoves for all enemy pieces matches the captures generated by calling GenerateMoves(MoveGeneration.OnlyCaptures). Perhaps I’ll investigate this more fine-grained staged move generation later. For now, the code remains simple.

Search.cs

Search.cs GetDynamicScore

Search.cs GetQuietScore

This improved MadChess 3.0 Beta’s move generation speed (Nodes Per Second) while searching and gained 39 Elo points. MadChess 3.0 Beta searches typical middlegame positions at > 5 million NPS. The evaluation function still is limited to material, piece location, draw detection, and checkmate.

 

Feature Category Date Rev1 WAC2 Elo Rating3 Improvement
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. Subversion source code revision
  2. Win At Chess position test, 3 seconds per position
  3. Bullet chess, 2 min / game + 1 sec / move

MadChess 3.0 Beta Build 084 (History Heuristics)

I increased the playing strength of MadChess 3.0 by improving the history heuristics used by Late Move Reductions (LMR).

First, I added a flag that indicates if a move was played during search (indicated below with “!”). This implies the move is legal (doesn’t expose own king to check) and search examined it (as opposed to moves appearing in the move list after a move that causes a beta cutoff). Moves are encoded as ulong primitives like so:

Next, I altered the search function to flag played moves.

Then I modified the search function so it not only increments move history for quiet moves that cause a beta cutoff, but also decrements move history for quiet moves that failed to cause a beta cutoff. The decrement is applied only if a later quiet move actually caused a beta cutoff.

Finally, I modified the Move class to allow negative history values (though stored internally as a positive value to avoid complications with twos complement bit notation used by the .NET Core runtime to represent negative integers).

The listmoves command demonstrates the search function will assign negative history values.

listmoves
Rank   Move  Best  Cap Victim  Cap Attacker  Promo  Killer  History              Priority
====  =====  ====  ==========  ============  =====  ======  =======  ====================
  01   d7d4  True       Queen         Queen              0       -1  12141986070363407779
  02   f6d5                                              2     2857    433752951094266523
  03   h7h5                                              1      -56    433189988923033503
  04   f8e7                                              0    15940    432627106061501068
  05   e8e7                                              0     7705    432627071521931788
  06   a8b8                                              0     2985    432627051724292097
  07   d7d6                                              0      794    432627042534573459
  08   c6c5                                              0       -1    432627039200168218
  09   d7d5                                              0       -6    432627039179130267
  10   a8a7                                              0       -8    432627039170740232
  11   f6g4                                              0       -9    432627039166548646
  12   f6g8                                              0      -10    432627039162354310
  13   f6e4                                              0      -11    432627039158160036
  14   f6h5                                              0      -13    432627039149771423
  15   f8d6                                              0      -13    432627039149769363
  16   d7e7                                              0      -20    432627039120409996
  17   d7c7                                              0      -20    432627039120409994
  18   d7b7                                              0      -21    432627039116215689
  19   f8c5                                              0      -24    432627039103632026
  20   c8b7                                              0      -24    432627039103631625
  21   d7a7                                              0      -34    432627039061689736
  22   d7d8                                              0      -34    432627039061689731
  23   g7g5                                              0      -41    432627039032526622
  24   e6e5                                              0      -44    432627039019813404
  25   g7g6                                              0      -53    432627038982063894
  26   b4b3                                              0      -56    432627038969483433
  27   a6a5                                              0      -56    432627038969481240
  28   h7h6                                              0      -56    432627038969481111
  29   h8g8                                              0      -56    432627038969414534

29 legal moves

This improved MadChess 3.0 Beta’s tactical awareness and gained 28 Elo points. The evaluation function still is limited to material, piece location, draw detection, and checkmate.

I made two other changes that did not greatly affect the strength of MadChess 3.0 Beta. I added detection of drawish pawnless endgames. This may have contributed 5 of the 28 Elo, but I don’t really know because the error margins for 4,000 games are +/- 20 Elo. If a drawish endgame is encountered, MadChess 3.0 Beta assigns a zero score but allows the search to continue (as opposed to dead drawn endgames such as Kk, KBk, or KNk; threefold repetition; 50 moves without a capture or pawn move; or insufficient material to checkmate, where the search is terminated).

  • KQkq
  • KQkrr
  • KRRkrr
  • KRBkrb
  • KRBkrn
  • KRNkrn
  • KRBkr
  • KRNkr
  • KRBNkr
  • KRkr
  • KRkb
  • KRkn
  • KNNkb
  • KNNkn
  • KNNk

Also, I changed the Board.IsMoveLegal function so it plays a null move when determining if a move checks the enemy king. Previously, Board.IsMoveLegal had determined check without actually playing a null move. This caused a subtle bug, though. As a consequence of this change, move legality checking searches an additional node, so the engine reports increased search speed in Nodes Per Second (NPS). This of course is an artificial speed increase, but it does align MadChess 3.0 Beta’s node counting with MadChess 2.x’s. MadChess 3.0 Beta searches the WAC position test at 4.31 million NPS on my PC.

 

Feature Category Date Rev1 WAC2 Elo Rating3 Improvement
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. Subversion source code revision
  2. Win At Chess position test, 3 seconds per position
  3. Bullet chess, 2 min / game + 1 sec / move