Release of my Aggressive Game Search Tools

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
pohl4711
Posts: 2845
Joined: Sat Sep 03, 2011 7:25 am
Location: Berlin, Germany
Full name: Stefan Pohl

Release of my Aggressive Game Search Tools

Post by pohl4711 »

I proudly release 2 tools, which investigate a pgn-file for games with aggressive play and/or interesting sacrifices. They can be used on engine games as well as on human chessgames. I believe, that the AGS-tools are very helpful, because of the many engine games, played today and the huge databases of human- and engine-games. A lot of these games are not so interesting IMO, so a tool, which filters the really spectacular games out of these huge gamebases, is a very useful thing...but I could not find such a tool, so I did it by myself.

Download on my website: https://www.sp-cc.de/files/aggressive_g ... ol_v3.8.7z


Here the complete ReadMe-file for further information:

Aggressive Games Search Tools (AGS-Tools)
by Stefan Pohl (C) 2022, www.sp-cc.de
using pgn-extract (C) David J.Barnes

This little batch-tool uses the fantastic pgn-extract tool by David Barnes to investigate a pgn-file for games with aggressive play and/or interesting sacrifices. It can be used on engine games as well as on human chessgames. I believe, that the AGS-tools are very helpful, because of the many engine-games, played today and the huge databases of human- and engine-games. A lot of these games are not so interesting IMO, so a tool, which filters the really spectacular games out of these huge gamebases, is a very useful thing...but I could not find such a tool, so I did it by myself.

Important: The AGS-tools need the bin-folder in the working-folder, because the bin-folder contains pgn-extract and some figure-pattern files, which are needed for the detection of sacrifices. Additionally, the tool stores some temporary files in the bin-folder, while it is running. So do not change anything in the bin-folder and dont move it away!!!

How does the AGS-tool work:
It has 2 different filters (it filters only the non-draw games, the draws are sorted out completely): The first one is a filter for pieces of the winning color on the last 3 ranks of the opponent board-side after move 14, at least 3 times until move 60 and the Queen and rooks (ore one rook and some knights or bishops) are still on the board. Example: White wins the game and has 3 times a non-pawn piece on the rank 6,7 or 8.
The second one is a filter for sacrifices, means, that the loosing color has more material after move 14 and before the endgame (Queen, 2 rooks of the same color (or one rook and some bishops/knights) have to be still on the board) for at least 5 consecutive moves (7 moves, if the loosing color is only one pawn ahead).

If you start the AGS-tool, you first have to enter the name of your pgn-file, without the .pgn-ending (the file must be in the folder of the AGS-tool (NOT in the bin-folder!!!)).
Then, you can choose, which one (of 3) sacrifice-filters you want to use:
Enter 1 (or press just return key): Search for all sacrifices
Enter 2: Search for big sacrifices, where the loosing color has at least 2 pawns more temporaly (a rook for a knight or a bishop for a pawn for example or just 2 pawns more).
Enter 3: Same as 2, but the big sacrifices are non-pawn sacrifices, only (example: 2 pawns more for loosing color is not allowed (see option 2), but a rook for a knight is...)
Finally, you have to enter, how long the non-draw games may be, which the AGS-tool should investigate. You can choose from 80 up to 250 moves. If you just press return, 80 moves are chosen. For human games and engine-games played with adjudication-rules (not until mate), 80 is a good choice. For engine-games played until mate or technical draw, 100 is recommended. If you want to investigate all non-draw games, then choose 250.

Then, the AGS-tool starts working. If the work is done, you will hear a short melody and the filtered games are stored in the files:
aggressive_no_sacrifices.pgn and aggressive_with_sacrifices.pgn

Mention, that the stored games have no comments anymore and 7 basic tags. That has to be done, because comments can lead to mismatches in the search and this leads to a tool-malfunction. If you want to run more than one AGS-tool at the same time on your PC, you have to copy the AGS-tool completely (with the bin-folder) as often as you want to start it. Because, otherwise, the AGS-tools would share the same bin-folder, which would lead to chaos, because of the temporary files, the tool uses in the bin-folder (=collision!).
Mention, not to click with your mouse in the black window, where AGS-tool is running. That freezes the processing. This is not a bug of the AGS-tool but a „feature“ of windows...Because the AGS-tool plays a short melody, when it is finished, you can hide the working-window, when the tool is running and use your PC for other things.
Mention, that the AGS-tool is quite slow and should be used for smaller pgn-files, only. For big pgn-files,it is strongly recommended to use the special turbo-version for filtering a pgn-database for sacrifices, only:

I created a very fast running special turbo-version for filtering a pgn-database for sacrifices, only:
AGS_Sacrifices_Only_Turbo.bat

It searches the games from move 1 until the end of the game. This tool does not delete the tags and comments of the games, which is good, but in the output.pgn file, the games are sorted by white wins, followed by black wins, which is not so good. But it is not possible to avoid this. But this tool is running much, much faster and allows, to filter huge pgn-databases with 10.000 or more (or 100.000 or millions...) games in a short time, which would take a very long time, using the normal AGS-tool... The needed inputs at the start are identical with the slow-running AGS-tool - see above...
The AGS_sacrifices_only_turbo tool stores the found sacrifice games in the file:
games_with_sacrifices.pgn

On a "normal" PC of 2021, the AGS-tool investigates around 3 games per second. But only, when it is runningon a SSD. On a magnetic HDD it will run much slower. On a RAMdisc it will run clearly faster. That is because the tool writes and deletes a lot of temporary files (in the bin folder) while it is running. The AGS-turbo-tool investigates more than 150 games per second (!!!) - so it can investigate even big pgn-files very quickly.

Enjoy!

Bonus:
For programmers of GUIs or chess-tools, I created a special-version of the AGS_Sacrifices_Only_Turbo tool:
AGS_Sacrifices_Turbo_function.bat
This version does not require inputs on the keyboard by the user and prints nothing on the screen. It awaits 4 parameters and can be called out of any program/GUI or batch-file (in batch-files: Use CALL for this!)
%1 = filename of pgn-file to search in
%2 = Search option (1-3)
Option 1: All sacrifices
Option 2: All sacrifices with at least 2 pawns more for loosing color
Option 3: All non-only-pawns sacrifices with at least 2 pawns more for loosing color
%3 = movelimit (80-250 moves (not plies)) of the non-draw games in the pgn-file, which the tool has to investigate
%4 = name of the pgn-file, where the tool stores the found sacrifice-games in

If you look into the source-code, you will see, that the tool is very simple. The really complex parts are the piece-patterns for recognizing sacrifices, stored in the bin-folder...

Idea and all work done by Stefan Pohl (SPCC)
www.sp-cc.de
(C) 2022, S.Pohl
User avatar
pohl4711
Posts: 2845
Joined: Sat Sep 03, 2011 7:25 am
Location: Berlin, Germany
Full name: Stefan Pohl

Re: Release of my Aggressive Game Search Tools

Post by pohl4711 »

From now, I use the AGS-turbo-tool for filtering short games with big sacrifices out of the games of the latest ratinglist-testrun (filter-option 3, see the ReadMe-file of the AGS-tool download). These games are presented in the "View games with sacs"- section on my website, using the pgn-replayer tool by ChessBase. Take a look - it is spectacular!!!

https://www.sp-cc.de/view-games-with-sacs.htm

(I believe, without this tool, nobody would ever see these great games!)

If you are more interested in human games, you can use the AGS-tools to investigate them, too. Could be interesting, to look at all M.Tal games and compare them with M.Carlsen games (or Kasparov?): Who has played more sac-games (a higher percentage of found games by the AGS-tool compared to the number of all games investigated).
Limitless possibilities!
User avatar
pohl4711
Posts: 2845
Joined: Sat Sep 03, 2011 7:25 am
Location: Berlin, Germany
Full name: Stefan Pohl

Re: Release of my Aggressive Game Search Tools

Post by pohl4711 »

All non-draw games with sacrifices filtered (with AGS_sacrifices_only_turbo-tool (earlier V3.5 version, so using the latest version V3.8, the results could be a little different)) out of the gamebase of the FCP 2022 tourney. Filtering-option: 1 (= all sacs)
Elo-numbers are meanigless here. Interesting is, how many sac-games each engine played (each engine played 1200 games in the tourney), average value here is 77. And how much better or worse it is in the "ratinglist" of the sac-games...

Code: Select all

    Program                          Elo    +   -   Games   Score   Av.Op. Rank difference to tourney-
						(sac-games out		   result. + means better in the
						 of 1200 games		   sacrifice-ranking-list
						  average=77)

  1 Dragon 2.5.1 by Komodo NN AVX  : 2864    0 113   123    98.4 %   2264    +1
  2 Stockfish 151121 NN x64        : 2861    0   0   118   100.0 %   2261    -1
  3 Revenge 1.0 NN x64             : 2844    0 143   104    98.1 %   2244    +6
  4 Fire 8 NN MC.3 x64             : 2838   36 188    80    96.2 %   2275    -1
  5 SlowChess Blitz 2.8 NN AVX2 x  : 2815    0 131    95    98.9 %   2215    -1
  6 Igel 3.0.10 NN BMI2 x64        : 2655  142 121    85    90.6 %   2262    +5
  7 Ethereal 13.25 NN PEXT x64     : 2653  191 155    47    89.4 %   2283    -2
  8 Koivisto 7.5 NN AVX2 x64       : 2586  106  96    96    85.4 %   2279    -2
  9 Berserk 7 NN PEXT x64          : 2584  117 105    73    83.6 %   2301    -2
 10 Arasan 23.0.1 NN AVX2 x64      : 2574  136 118    68    86.8 %   2248    +4
 11 RubiChess 2.2 NN x64           : 2571  128 113    72    86.1 %   2254    -3
 12 Nemorino 6.09 NN x64           : 2515  106  97    72    79.2 %   2283    =
 13 Seer 2.4.0 NN AVX2 x64         : 2490  114 103    67    80.6 %   2242    -3
 14 rofChade 2.310 NN x64          : 2489   86  82    82    70.7 %   2336    -1
 15 Lc0 0.28.0 NN CPU-dnnl         : 2431   98  93    63    69.8 %   2285    =
 16 Booot 6.5 POPCNT x64           : 2417   96  96    53    49.1 %   2423    =
 17 Wasp 5.00 NN AVX2 x64          : 2399   92  91    59    54.2 %   2369    +1
 18 DanaSah 9.0 NN AVX2 x64        : 2361  101  99    50    58.0 %   2305    +13
 19 Fizbo 2.0 BMI2 x64             : 2352   88  89    63    42.9 %   2402    +11
 20 Minic 3.17 NN x64              : 2344   82  85    74    36.5 %   2441    -1
 21 Weiss 2.0 PEXT x64             : 2333   97 101    53    37.7 %   2420    -1
 22 Schooner 2.2 XB SSE x64        : 2314   87  92    70    31.4 %   2450    -1
 23 Andscacs 0.95.123 x64          : 2312   82  87    81    29.6 %   2462    +9
 24 Marvin 5.2.0 NN AVX2 x64       : 2312   82  85    74    36.5 %   2408    +3
 25 Xiphos 0.6 BMI2 x64            : 2309  100 107    57    28.1 %   2472    -8
 26 Clover 2.4 x64                 : 2291   94 100    63    28.6 %   2451    +2
 27 Dark Toga 1.1 NN AVX2 x64      : 2285   90  93    62    37.1 %   2377    +6
 28 Orion 0.8 NN FMA x64           : 2251  103 109    51    31.4 %   2387    +9
 29 Defenchess 2.3 dev BMI2 x64    : 2244   91  98    74    24.3 %   2441    -7
 30 Laser 1.7 BMI2 x64             : 2239   94 102    77    20.8 %   2472    -4
 31 Chiron 5 x64                   : 2239   94 102    76    21.1 %   2468    -2
 32 Winter 0.9 BMI2 x64            : 2218   91  97    68    27.9 %   2383    +2
 33 Zahak 8.6 AMD x64              : 2205   88  95    91    19.8 %   2448    -9
 34 Fritz 18 (Ginkgo) x64          : 2204  107 118    64    18.8 %   2459    -11
 35 Shredder 13 POPCNT x64         : 2184  103 115    89    13.5 %   2507    -10
 36 GullChess 3.0 Sy BMI2 x64      : 2132   98 110   101    12.9 %   2464    =
 37 Combusken 1.4.0 AMD x64        : 2124  101 114   106    11.3 %   2481    +3
 38 Nirvanachess 2.5 POPCNT x64    : 2110  101 114   104    11.5 %   2464    +1
 39 Stash 31.16 x64                : 2067  138 161    81     7.4 %   2506    -1
 40 Halogen 10 NN PEXT x64         : 2022  152 174    63     7.9 %   2448    -5
 41 Demolito 2021-07-09 x64        : 1922  163  36   107     3.7 %   2487    =


Games        :   1578 (out of 24600 games = 6.4%)

White Wins   :    902 (57.2 %)
Black Wins   :    676 (42.8 %)
Draws        :      0 ( 0.0 %)
Unfinished   :      0

White Perf.  : 57.2 %
Black Perf.  : 42.8 %

ECO A =    339 Games (21.5 %)
ECO B =    342 Games (21.7 %)
ECO C =    358 Games (22.7 %)
ECO D =    225 Games (14.3 %)
ECO E =    314 Games (19.9 %)
As you can see, Wasp (which should play so interesting...) plays unspectacular. Not many sacs, no big success, when playing them. Best engine is Revenge: A lot of sac-games and +6 places better in the sac-games ratinglist. Nice! Danasah und Fizbo do not play many sacs, but when they do it, they are extremly sucessfull...
hafni
Posts: 30
Joined: Fri Nov 22, 2019 4:12 pm
Full name: Hafni Rojo

Re: Release of my Aggressive Game Search Tools

Post by hafni »

Thanks for sharing your work.

I have to probe it yet, but, in a glance, it's impressive! :shock:

Best regards
Leo
Posts: 1107
Joined: Fri Sep 16, 2016 6:55 pm
Location: USA/Minnesota
Full name: Leo Anger

Re: Release of my Aggressive Game Search Tools

Post by Leo »

Sounds great.
Advanced Micro Devices fan.
User avatar
Ozymandias
Posts: 1537
Joined: Sun Oct 25, 2009 2:30 am

Re: Release of my Aggressive Game Search Tools

Post by Ozymandias »

Looks neat.
User avatar
pohl4711
Posts: 2845
Joined: Sat Sep 03, 2011 7:25 am
Location: Berlin, Germany
Full name: Stefan Pohl

Re: Release of my Aggressive Game Search Tools

Post by pohl4711 »

Today, I updated the AGS-tools to V3.9

From Changelog.txt:
Version 3.9: The AGS-tool now keeps all TAGS and all comments of the games and stores them in the output.pgn-files. This is possible, because I found a way to search for the String: Result 0-1 (using the term "Result..0-1" in the findstr-command) Problem here were the "-characters in the Result-Tag [Result "0-1"] (which collides with the fact, that each search-string for findstr has to be in "")

So, in the old version V3.8, the tool searched for "0-1", only, which could lead to mismatches easily, because a "0-1" can be part of comments or other Tags (Player name (LiChess-Nicknames)) This made it necessary, to delete the comments. The new version does not have this problem anymore...

The 2 turbo-tools are unchanged.

Please download the AGS-tools again.

https://www.sp-cc.de/files/aggressive_g ... ol_v3.9.7z
User avatar
Rebel
Posts: 7435
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Release of my Aggressive Game Search Tools

Post by Rebel »

Great tool. Used a 1000 game PGN from the Rebel 14.1 testing, it created 31 games in aggressive_with_sacrifices.pgn

Code: Select all

Number of games found in the database: 1000
61 interesting games found and saved in:
aggressive_no_sacrifices.pgn AND aggressive_with_sacrifices.pgn
Press any key to continue . . .
The big fun was that all 31 games were won by Rebel, the first one only.

[pgn][Event "?"]
[Site "?"]
[Date "2022.01.25"]
[Round "3"]
[White "Rebel_14.1"]
[Black "Clover_2.4"]
[Result "1-0"]

1. e4 e5 2. f4 exf4 3. Nf3 g5 4. h3 h6 5. Nc3 Bg7 6. Bc4 c6 7. e5 Ne7 8.
Ne4 Nf5 9. Nd6+ Nxd6 10. exd6 O-O 11. d4 b5 12. Be2 Re8 13. h4 Ba6 14. Kf1
f6 15. b4 Re6 16. Bd3 Rxd6 17. c3 Bc8 18. g3 fxg3 19. Kg2 a5 20. hxg5 fxg5
21. Nxg5 Qf8 22. Be3 hxg5 23. Bh7+ Kh8 24. Bc2+ Bh6 25. Qd3 Qg7 26. Raf1
Qg6 27. Qd2 Qg7 28. Bxg5 Kg8 29. Bxh6 Rf6 30. Bxg7 Rxf1 1-0[/pgn]
Is it possible to annotate the sacrifice(s) with a comment, for instance:

18. g3 {!}
90% of coding is debugging, the other 10% is writing bugs.
User avatar
pohl4711
Posts: 2845
Joined: Sat Sep 03, 2011 7:25 am
Location: Berlin, Germany
Full name: Stefan Pohl

Re: Release of my Aggressive Game Search Tools

Post by pohl4711 »

Rebel wrote: Wed Feb 23, 2022 1:17 pm Great tool. Used a 1000 game PGN from the Rebel 14.1 testing, it created 31 games in aggressive_with_sacrifices.pgn

Is it possible to annotate the sacrifice(s) with a comment, for instance:

18. g3 {!}
I am honored, that you like my tool, Ed! You are one of my computerchess-heros! (2cents: I released a small update today (keeps the comments in the pgn, now). And if, you want to search sacrifices, only, you can use the much, much faster turbo-tool AGS_Sacrifices_Only_Turbo.bat)

Sadly, an annotation of sacrifices is not possible. To be 100% correct: It would be possible, but not at the correct position in the notation (were the sacrifice happend). The reason is, the tool (=pgn-extract) looks for material advantage for the loosing color in a game, and this material advantage has to be on the board for at least 5 consecutive moves (7 moves, if the loosing color is only one pawn ahead). So, the added comment would be always too late in the notation. At least 5 (or 7) moves. So, I decided, that this makes no sense.

I could insert a comment like "Sacrifice detected 5 moves earlier". But this looks strange to me. Additionally it is not possible, to detect more than one sac in game. Because, if a sac is found, the condition in pgn-extract is "true" and pgn-extract stops searching this game. So, if a game contains more than one sac, it would be impossible to mark it in the comments. In your game for example, there is a second sac: 22. Be3 h:g5 (black wins the knight on g5)

I use the FritzGUI - here you can scroll extremly fast through a notation, using the mouse-wheel and look at the material-balance in the notation-window (material-balance must be switched on). Then you can see very easy and fast, where the sac happend. I used this method for debugging, while writing the AGS-tools...

Sorry, but using pgn-extract sets some borders, even though the pgn-extract tool is really fantastic...
User avatar
Kirk
Posts: 5702
Joined: Sat Mar 11, 2006 3:44 am

Re: Release of my Aggressive Game Search Tools

Post by Kirk »

Hi!

Just wondering how this tool works. Thanks in advance!

"my Autoplayer Batch-Tool for automatic analyzing"
“He knew all the tricks, dramatic irony, metaphor, pathos, puns, parody, litotes and... satire. He was vicious”