Very Hot Topic (More than 25 Replies) Filter games according to my repertoire (Read 17496 times)
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #29 - 11/20/25 at 05:28:18
Post Tools
Tartakaviar wrote on 01/04/20 at 13:37:21:
Thanks a lot. Nice work. But then how can we use the output ? 

Jonathan003 wrote on 11/14/20 at 21:08:30:
How can I use the output to fill in the gaps of my repertoire?

Yes this was the problem with the scripts I provided before. Too clunky. After briefly experimenting with the Scid Annotate feature, I began a long and fruitless search for a tool which would fulfill the OP's request. But I was always unhappy with the "approximate" results given by existing tools. They were built for different purposes and all had some shortcomings for comparing a repertoire with another file.

In the end I wrote yet another script to do it. Once again it uses awk and pgn-extract, but this time it's much more intuitive. Smiley Well, not as intuitive as using a GUI, but at least the output is easier to work with.

On the command line you provide:
  • your repertoire.pgn (vrep);
  • any new.pgn (for example latest twic), or even more than one;
  • optionally beginning ply number (vplymin) and/or ending ply number (vplymax);
  • optionally a move output format (vW) exactly like the pgn-extract -W option ( sanBSLTDK for German pieces is the example from help.html).

The script scoops up all the moves from the repertoire, along with a limited number of nags (1-6 and 10-19) like so  : 
  "!"   "?"   "!!"   "??"   "!?"   "?!"   (=)   (~)   (+=)   (=+)   (+/-)   (-/+)   (+-)   (-+)
(The tilde is Scid's symbol for $13 (unclear).) 

Then for every move in new.pgn (or every move between vplymin and vplymax if provided) it creates a comment, one of these three:
  1. { non-book position }
    The game position is not in the repertoire pgn.
  2. { book position moves Move1 Move2"?"(-+) ... }
    The game position is in the repertoire pgn, but the game move is not. So the comment lists all the moves that ARE in the repertoire and if they have any nags those are shown as well. Nags 1-6 are in quotes and nags 10-19 are in parentheses.
  3. { book move }
    The game position and the game move are both in the repertoire. No "Move" is shown in the comment, because it's the same as the move before the comment. If the book move has any nags in the repertoire pgn, those are shown as well, similar to #2 but different whitespace.

It all goes to STDOUT where you can redirect it to a file. Very much like pgn-extract itself. In my test with the Dearing Nimzo repertoire I posted in another thread, the script processed an 8000-game Twic in 31 seconds. Of course it's a little silly to annotate so many non-Nimzo games with a Nimzo repertoire, but I was curious how long it would take.

On Linux it's simple, awk is included and pgn-extract can be installed from the repositories. Plus Linux users need to be using the terminal, it's part of the culture.

For Windows users everything is a little harder. (1) Getting awk and pgn-extract set up on a Windows machine in some sensible way. (2) Working with the old-school cmd.exe, especially when the executables and the pgn-files are in different locations on the PC (as they should be). I happen to have a fresh Windows 11 partition for testing, so I wrote down my steps for setting everything up and running the script on Windows. There is a bit of nastiness with a Windows error message when I try to detect the OS, but I have a good workaround. I will write up my Windows steps if there is any interest.

I no longer have a Mac for testing. I did my best, but if any Mac users have complaints I am willing to work with them to fix any issues.

As usual I had to rename the script from .awk to .awk.txt in order to post it to the forum. Should not affect the usage at all.
  

book-pgn-annotate_awk.txt ( 13 KB | 45 Downloads )
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #28 - 11/20/25 at 03:16:59
Post Tools
brabo wrote on 06/07/19 at 12:52:16:
I don't believe there is a tool which does exactly what you want but you can get something very close to it.

In the recent versions of the Fritz interface you can ask to analyze a batch of games (so x number of games at once). You define the time of the analysis (I would put it as fast as possible in your case) and you also activate the openingreference function in which you specify in which database should be looked for the games.

If you have a hundred of your own games to check then I would let it run overnight so in the morning you have it ready. I know some players do that for their online blitzgames.


Scid also has the same function, but it can't be found in the menu. You have to open an analysis engine. At the bottom toolbar hover over the notepad icon and the tooltip says Annotate.... Click on it to open the Annotate window. There's all kinds of parameters you can change, the most important ones are
  • Time per move in sec.
    - The smallest time you can set is 0.1 sec.
  • Use book
    - Here you can select a polyglot bin book from the /Books folder.
  • From actual game to game
    - That's the batch feature, "from actual game" is the one you have open, when done with that one it will go on to the next game in the current filter and stop at the "to game" number you enter here.

It's perfect if you want to analyze the games with an engine, but if you only want to check them against a book 0.1 sec is too long. 20 opening moves for each side x 0.1 second per move is 4 seconds per game and say 5000 games in Twic gives 5.6 hours for the batch.

Of course 0.1 sec per move is not serious analysis. As you say, this kind of tool  is for analyzing own games which are in the hundreds not thousands.
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #27 - 11/19/25 at 08:35:28
Post Tools
Jonathan003 wrote on 10/29/20 at 18:23:45:
I can't post a weblink here, but if you search in YouTube for: 'Outil gratuit de recherche dans une base pgn'
You find a video in French explaining how to build repertoire with pgn-extract.
I don't understand French and I think you need a Unix system to do what he discribes.

I watched the video. It's not about building a repertoire. And he is on Windows.
Outil gratuit de recherche dans une base pgn (Nov 30, 2017)
https://www.youtube.com/watch?v=ssj24c3XhPs

I do understand French, but he speaks a little fast for me. He is using pgn-extract to "select" TWIC games that match his repertoire. But I think he doesn't know precisely how a pgn-extract "positions" file works. A quick read of the help.html suggests it only looks at the final position, but since I never used a positions file I decided to verify that.

Illustration of the problem with a single line from Dearing's Nimzo-Indian repertoire. Let's see the results of the next command depending on the contents of positions.txt.

Code
Select All
$ pgn-extract -xpositions.txt twic1579.pgn 



positions.txt
Code
Select All
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3 Qf5 7.Qxf5 exf5 


0 games matched out of 8602.

It's only trying to match the final position of the line. But I wager most people don't think of their repertoire as a set of final positions only! They are also interested in the earlier deviations.

positions.txt
Code
Select All
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3 Qf5 7.Qxf5 exf5
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3 Qf5 7.Qxf5
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3 Qf5
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5 6.Nf3
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5 Qxd5
1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 d5 5.cxd5  


6 games matched out of 8602.

All of those 6 are with 5...exd5. Dearing advocates 5...Qxd5 so the line ending 5.cxd5 should not be in the file. I just went back that far because it was the only way to get a non-zero result. But you get the point -- positions.txt needs to carefully include all the intermediate positions of interest. The commands he used to get a list of positions from his repertoire don't accomplish that.

Even so, the approach is not too bad. It wouldn't be too hard to write a script to "explode" the first positions.txt file so it looks like the second one. The tricky part would be knowing when to stop, because going too far back towards 1.d4 will eventually include non-repertoire games. And how far back to go / not go / varies from line to line. Maybe set up some kind of "rules" file for each line in the repertoire, and an exception handler in case you added a line to the repertoire that's not in the rules file. Or just maintain positions.txt by hand, but that way leads into the dark forest.
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #26 - 11/15/20 at 18:36:39
Post Tools
Jonathan003 wrote on 11/14/20 at 21:08:30:

I managed to do what you described.
How can I use the output to fill in the gaps of my repertoire?

Yes! 
For each move in the new pgn, it steps through your repertoire pgn and finds the place where it matches. Look for the far right column having a "0". If there is a long run of "0" on the right, that represents a "novelty" for your repertoire. A short run of "0" represents a transposition.

Code
Select All
rnbqkbnr/pp3ppp/4p3/2ppP3/3P4/2P5/PP3PPP/RNBQKBNR b KQkq -;hmvc 0;fmvn 4;id 1;fk 2;fmvnmax 4;
rnb1kbnr/pp3ppp/1q2p3/2ppP3/3P4/2P5/PP3PPP/RNBQKBNR w KQkq -;hmvc 1;fmvn 5;id 1;fk 0;fmvnmax 0;
rnb1kbnr/pp3ppp/1q2p3/2ppP3/3P4/2P2N2/PP3PPP/RNBQKB1R b KQkq -;hmvc 2;fmvn 5;id 1;fk 0;fmvnmax 0;
r1b1kbnr/pp3ppp/1qn1p3/2ppP3/3P4/2P2N2/PP3PPP/RNBQKB1R w KQkq -;hmvc 3;fmvn 6;id 1;fk 2;fmvnmax 6; 


Opcode translations
  • hmvc - half-move clock, number of ply since the last pawn move or capture in the new game
  • fmvn - full move number, number of moves so far in the new game
  • id - identity, game number in the new pgn
  • fk - foreign key, game number(s) in the repertoire pgn
  • fmvnmax - full move number max, (largest) number of moves so far in the repertoire game(s)

In the sample output above
  • fmvn 4;id 1;fk 2;fmvnmax 4; - new game 1 move 4 matches repertoire game 2 move 4
  • fmvn 5;id 1;fk 0;fmvnmax 0; - new game 1 move 5 does not match the repertoire 
  • fmvn 5;id 1;fk 0;fmvnmax 0; - new game 1 move 5 does not match the repertoire 
  • fmvn 6;id 1;fk 2;fmvnmax 6; - new game 1 move 6 matches repertoire game 2 move 6

So on move 4 black played a "new" move (reached a position not in the repertoire), then on move 5 white played a "new" move (in reply to black's "new" move), then on move 5 black played a "non-new" move. Therefore black's "new" move on move 4 was a simple transposition. Whether the transposition is important for your repertoire is up to you. The simple idea is you open the new pgn, scroll down to game number id, scroll across to move number fmvn (having fmvnmax = 0), then use your brain (or engine) to decide whether or not to import that game to your repertoire. Software can only automate things up to a certain point.

Jonathan003 wrote on 11/14/20 at 21:08:30:

For my white repertoire, I only want to find the games in the new database, with moves for black, where I don't already have a reply for. 
And I want to do the same for my black repertoire.
I think that was also the question of the original poster of this topic.

You do realize that all the games in the new database will have a move you don't already have a reply for. Unless one of them is an exact duplicate of a repertoire game that will always be the case. There is no way around the fact that you will have to look at every game. But it's not hopeless. You can use the fmvn/fmvnmax to reject some of the "novelties". Most people do an arbitrary cut-off at move 15 or 20. Only in certain critical lines would you go much beyond that.

Jonathan003 wrote on 11/14/20 at 21:08:30:

I basically want to do what's described here:

See attachment

Under the title Book Merging

I'm not sure about the polyglot book idea. Those are designed for engines. You might find some use for practicing against an engine, but otherwise I would look at different avenues. There are good reasons for tracking more than one move for your side in a repertoire, but there's no way to tell the polyglot book what that reason is. To the engine, every move in a polyglot book is the same.

Jonathan003 wrote on 11/14/20 at 21:08:30:

I can import the best moves from the merged bin books to Opening Lines in Lucas Chess, and then export to pgn.
But I want to be able to do this directly with pgn games, so the game data information gets preserved. There is also some weird explosion of number of games if I use Lucas Chess for this.

Exactly. Most repertoire tools have some facility for importing pgn, but when it comes to exporting pgn, the situation is, shall we say, lossy. As an example, I think Chess Openings Wizard (Bookup) is a great piece of software, as long as you only intend to use COW exclusively. But I use lots of other software, so any effort I put into COW is wasted when I switch to another tool.

I haven't used Lucas Chess, so I don't know how it handles these things. You say it can "import the best moves", but I rather doubt that. Isn't it going to import "all" the moves? I recommend you search on brabo's blog for "green moves" where he uses a ChessBase tree. The idea is that a repertoire should show best moves and second-best moves, and a way to know which is which. After all, theory changes and today's best move can become tomorrow's second-best. Or you may decide second-best is less work while still being good enough. You should also look at Scid's "tree mask" feature -- very cool. I don't like the ChessBase tree at all, and I do like the Chess Assistant tree very much. But all these tools can only give ideas for how to handle your own repertoire. 

I strongly believe that keeping the repertoire in pgn in a form that allows for easy import to your repertoire tool of choice is, in the long run, the only way to avoid significant pain. By all means import to the tool, but consider it to be read-only, and make any changes to the repertoire in the original pgn. Otherwise, at some point, you are going to end up with information you can't export. The farther in the future that point is, the more information you will have lost.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #25 - 11/14/20 at 21:08:30
Post Tools
I managed to do what you described.
How can I use the output to fill in the gaps of my repertoire?
For my white repertoire, I only want to find the games in the new database, with moves for black, where I don't already have a reply for. 
And I want to do the same for my black repertoire.
I think that was also the question of the original poster of this topic.
I basically want to do what's described here:

See attachment

Under the title Book Merging

I can import the best moves from the merged bin books to Opening Lines in Lucas Chess, and then export to pgn.
But I want to be able to do this directly with pgn games, so the game data information gets preserved. There is also some weird explosion of number of games if I use Lucas Chess for this.
  

Manual_Polyglot.txt ( 19 KB | 167 Downloads )
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #24 - 11/03/20 at 19:55:27
Post Tools
Jonathan003 wrote on 11/03/20 at 19:06:49:
Can you please make some video capture. From beginning to end so I understand wat to do on a windows 10 64 bit system.

Not happening.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #23 - 11/03/20 at 19:16:25
Post Tools
an ordinary chessplayer wrote on 11/02/20 at 18:05:08:
Well actually there is dedicated software, but the OP mentioned freeware. I haven't looked closely at Scid, but maybe it has this capability. If you don't mind paying then CPT was mentioned earlier, and ChessBase also has a repertoire and "find novelty" feature.

I have all count off chess software on my windows 10 pc you can think of, both commercial as free . I really don't know of a tool to do this efficient. Lucas Chess comes closed by importing best moves from a a merged bin book.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #22 - 11/03/20 at 19:06:49
Post Tools
Ok I have downloaded the arhive.txt file
I really don't understand what to do.
Can you please make some video capture. From beginning to end so I understand wat to do on a windows 10 64 bit system.
Maybe also for others ho have little experience with command line tools and want to try this.
I think a video capture with mouse capture and maybe audio is the easiest way to explain something.
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #21 - 11/02/20 at 20:32:52
Post Tools
Jonathan003 wrote on 11/02/20 at 17:07:28:
an ordinary chessplayer wrote on 10/30/20 at 05:46:29:
It's the PATH environment variable that allows cmd.exe to find pgn-extract and awk (or gawk). The easiest way to find the other files is to run cmd.exe from the same folder as the files (not the same folder as awk or pgn-extract). Put these four files all by themselves in their own folder ...
  • fencomments.awk
  • epdcompare.awk
  • rep.pgn
  • new.pgn

Where can I find the files 'fencomments.awk'
and 'epdcompare.awk'?
Should I find them somewhere on my computer or do I have to make them myself?

They are in the file archive.txt which I attached at Reply #16. Look for, e.g., [fencomments.awk] and then copy from below that and down to the next section. The "[fencomments.awk]" is not part of the file fencomments.awk, hope that makes sense.

Jonathan003 wrote on 11/02/20 at 17:16:36:
I have little experience with command line tools. 
If I type cmd in the adress C:Program Files (x86)GnuWin32
in
where awk is installed, and I type 'awk --version' I get the message GNU Awk 3.1.6
You talk about GNU Awk 3.1.3
Will this make any difference?

No, that version is about the same. There were some changes but my script does not use any of the changed features. The --re-interval option requires 3.0 or greater so you are good. The --version command was less to verify the version number, than to verify that cmd.exe could find awk.exe. I often find myself making typos on the command line, leaving out options, forgetting the differences between linux / windows / and now mac, etc. Doing things step-by-step like that just makes it easier to find out exactly where things went wrong. Shell admins do "ls" first and then "rm". Database admins do "select" first and then "update". It's a good habit to take baby steps even when you are sure you know what you are doing.
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #20 - 11/02/20 at 18:05:08
Post Tools
Jonathan003 wrote on 10/29/20 at 18:02:46:
I don't understand why there exist no dedicated chess software to do this.
It's a big gap in the chess market I think.

Well actually there is dedicated software, but the OP mentioned freeware. I haven't looked closely at Scid, but maybe it has this capability. If you don't mind paying then CPT was mentioned earlier, and ChessBase also has a repertoire and "find novelty" feature.

Jonathan003 wrote on 10/29/20 at 18:02:46:
Chess is not only for programmers I hope Smiley

I'm not a programmer, just a business analyst, but I also spend time trying to learn some programming skills. It's an attitude not just towards computers but towards everything. You don't need to be a chef in order to cook, an electrician to do household wiring, an auto mechanic to repair your vehicle, etc., etc. (Well that last one is changing as the automobile evolves into a computer on wheels, but the simplest repairs can still be do-it-yourself.)

Quote:
recognize programming as the new literacy of the digital age
--Rushkoff (2011) Program or Be Programmed

There is some argument for sticking to what you do best and leaving everything else to an expert -- provided what you do best pays well enough that you can afford the expert's pay scale. Personal chef, anyone? If you want to go that route, ChessBase is the program for you. It has a feature to do almost anything you can think of (although it won't do it quite the way you want!). Its feature set makes it the MS Excel of the chess world, complete with the lock-in to Windows (actually not true of Excel anymore), the upgrade pains, and being expensive. I'm not against it, having paid for ChessBase and competing products many, many times over the decades. I'm just listing the pros and cons.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #19 - 11/02/20 at 17:16:36
Post Tools
I have little experience with command line tools. 
If I type cmd in the adress C:\Program Files (x86)\GnuWin32\bin
where awk is installed, and I type 'awk --version' I get the message GNU Awk 3.1.6
You talk about GNU Awk 3.1.3
Will this make any differense?
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #18 - 11/02/20 at 17:07:28
Post Tools
an ordinary chessplayer wrote on 10/30/20 at 05:46:29:
It's the PATH environment variable that allows cmd.exe to find pgn-extract and awk (or gawk). The easiest way to find the other files is to run cmd.exe from the same folder as the files (not the same folder as awk or pgn-extract). Put these four files all by themselves in their own folder ...
  • fencomments.awk
  • epdcompare.awk
  • rep.pgn
  • new.pgn

Where can I find the files 'fencomments.awk'
and 'epdcompare.awk'?
Should I find them somewhere on my computer or do I have to make them myself?

  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #17 - 10/30/20 at 05:46:29
Post Tools
Jonathan003 wrote on 10/29/20 at 13:22:47:
For step two I have some problems. I downloaded and installed Gawk Complete package, except sources from here: gnuwin32.sourceforge.net/packages/gawk

I first tried to copy the pgn repertoire1.pgn create with Pgn-Extract to the folder where a installed Gawk C:\Program Files (x86)\GnuWin32\bin
Than if I click the adres bar and type cmd for the command prompt, and I enter this line: 'awk -f fencomments.awk repertoire1.pgn > repertoire1.epd'
I get the message 'Access is denied'
So I copied the folder  'C:\Program Files (x86)\GnuWin32' to my documents folder and tried to do the same.
But then I get this message:
awk: fatal: can't open source file `fencomments.awk' for reading (No such file or directory)

What do I do wrong?


You want to keep your programs and your data files separate. So undo the copy of "GnuWin32" to my documents. You can use the executable as installed in "C:\Program Files (x86)\GnuWin32\bin", and use your data files in Documents together in one command. But cmd.exe has its own ideas about where things are located, and needs some help finding things. cmd.exe looks for things in the following rough order:
  1. absolute or relative path on the command line
  2. current directory
  3. path specified in the registry
  4. PATH environment variable

It's the PATH environment variable that allows cmd.exe to find pgn-extract and awk (or gawk). The easiest way to find the other files is to run cmd.exe from the same folder as the files (not the same folder as awk or pgn-extract). Put these four files all by themselves in their own folder ...
  • fencomments.awk
  • epdcompare.awk
  • rep.pgn
  • new.pgn

... then start cmd.exe in that folder using your method from above. After that the commands I gave in the post just before this one should work.
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #16 - 10/30/20 at 05:26:30
Post Tools
I managed to update the scripts I provided before. In fact I did do the earlier work on Linux, and "forgot" to check whether they would work on Windows, which of course they did not. They didn't run on macOS either, but I only got the Mac recently so did not have an opportunity to test that before. It was quite a chore getting these to work on Windows, I won't bore you with the details.

Here is my command session on Windows 10.
Code
Select All
$ dir /b
epdcompare.awk
fencomments.awk
new.pgn
rep.pgn

$ awk --version
GNU Awk 3.1.3

$ pgn-extract --version
pgn-extract v19-04

$ pgn-extract -w200 --fencomments -orep1.pgn rep.pgn
Processing rep.pgn
- - - Edited game W3Q689U4ZN 2019.06.08
- - - Edited game W3Q689U4ZN 2019.06.08
2 games matched out of 2.

$ awk --re-interval -f fencomments.awk rep1.pgn > rep1.epd

$ pgn-extract -w200 --fencomments -onew1.pgn new.pgn
Processing new.pgn
- - - Edited game W3Q689U4ZN 2019.06.08
1 game matched out of 1.

$ awk --re-interval -f fencomments.awk new1.pgn > new1.epd

$ awk --re-interval -f epdcompare.awk CMP=rep1.epd new1.epd > cmp.epd

$
 



And attached is a single text-file "archive" of all the files from that session. To run on Windows, use the scripts as-is and the commands above. To run on Linux or macOS, comment the Windows-specific grepcmd on line 23, uncomment the Unixish grepcmd on line 22, and leave off the `--re-interval` switch from the command line.
  

archive.txt ( 16 KB | 188 Downloads )
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #15 - 10/30/20 at 04:28:09
Post Tools
Jonathan003 wrote on 10/29/20 at 18:23:45:
I think you need a Unix system to do what he discribes.

Too bad it's a video, I'm not going to watch it. But if he's just using pgn-extract and other command line utilities, it can no doubt be done on Windows as well.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #14 - 10/29/20 at 18:23:45
Post Tools
I can't post a weblink here, but if you search in YouTube for: 'Outil gratuit de recherche dans une base pgn'
You find a video in French explaining how to build repertoire with pgn-extract.
I don't understand French and I think you need a Unix system to do what he discribes.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #13 - 10/29/20 at 18:02:46
Post Tools
an ordinary chessplayer wrote on 10/29/20 at 17:44:08:
We'll get it working, but not right now. I want to get back to you on this. I thought I should test my own steps, but here at work gawk is choking on the FEN regular expression in my scripts. It's a little strange, because I did use these exact scripts, but probably did it on linux with a different version of gawk. And while looking at it I noticed that I also used grep but didn't mention that.

So let me rewrite the script to not use grep, and get the regular expression working in all versions of gawk, and test that it all works on windows/linux/macos. I can't do all that right now, but should be able to do it this weekend.

Thanks I'm looking forward to this.
I don't understand why there exist no dedicated chess software to do this.
It's a big gap in the chess marked I think. Chess is not only for programmers I hope Smiley
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #12 - 10/29/20 at 17:44:08
Post Tools
Jonathan003 wrote on 10/29/20 at 13:22:47:

... Than if I click the adres bar and type cmd for the command prompt, ...

I learned something today.  Smiley

You're almost there. You just don't have enough experience with the command line to help it find the files it needs.

We'll get it working, but not right now. I want to get back to you on this. I thought I should test my own steps, but here at work gawk is choking on the FEN regular expression in my scripts. It's a little strange, because I did use these exact scripts, but probably did it on linux with a different version of gawk. And while looking at it I noticed that I also used grep but didn't mention that.

So let me rewrite the script to not use grep, and get the regular expression working in all versions of gawk, and test that it all works on windows/linux/macos. I can't do all that right now, but should be able to do it this weekend.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #11 - 10/29/20 at 13:22:47
Post Tools
Hi,
Thanks for the explanation and willing to help me with this.
I try to follow your steps:

1.      pgn-extract -w200 --fencomments -orepertoire1.pgn repertoire.pgn
2.      gawk -f fencomments.awk repertoire1.pgn > repertoire1.epd
3.      pgn-extract -w200 --fencomments -onew1.pgn new.pgn
4.      gawk -f fencomments.awk new1.pgn > new1.epd
5.      gawk -f epdcompare.awk -v CMP=repertoire1.epd new1.epd > cmp.epd

Step one I completed. For step two I have some problems. I downloaded and installed Gawk Complete package, except sources from here: gnuwin32.sourceforge.net/packages/gawk

I first tried to copy the pgn repertoire1.pgn create with Pgn-Extract to the folder where a installed Gawk C:\Program Files (x86)\GnuWin32\bin
Than if I click the adres bar and type cmd for the command prompt, and I enter this line: 'awk -f fencomments.awk repertoire1.pgn > repertoire1.epd'
I get the message 'Access is denied'
So I copied the folder  'C:\Program Files (x86)\GnuWin32' to my documents folder and tried to do the same.
But then I get this message:
awk: fatal: can't open source file `fencomments.awk' for reading (No such file or directory)

What do I do wrong?

Regards Jonathan
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #10 - 10/25/20 at 21:02:11
Post Tools
Jonathan003 wrote on 10/25/20 at 13:29:10:

I want to try this.

I admire your sense of adventure.

Jonathan003 wrote on 10/25/20 at 13:29:10:

I have a windows 10 64 bit system.
Can you tell me how exactly to do it please maybe with some screenshots or video capture?

I do detailed steps with screenshots for users at work, but then I am paid for it. Since you installed pgn-extract on Windows already, I know for a fact you can do the rest of the steps. 

Jonathan003 wrote on 10/25/20 at 13:29:10:

I try to follow these steps:

$ pgn-extract -w200 --fencomments -orepertoire1.pgn repertoire.pgn
$ gawk -f fencomments.awk repertoire1.pgn > repertoire1.epd
$ pgn-extract -w200 --fencomments -onew1.pgn new.pgn
$ gawk -f fencomments.awk new1.pgn > new1.epd
$ gawk -f epdcompare.awk -v CMP=repertoire1.epd new1.epd > cmp.epd

I have pgn-extract but I have no idea what's gawk?
You give this link for windows users to this website: gnuwin32.sourceforge.net/packages
What am I supposed to download there and how to use it?

Gawk is GNU awk. Awk is a pattern-matching language for dealing with text files, similar to grep and sed but more suitable for scripting. To be honest most people these days would prefer python or php or even perl. I use awk at work (for getting work done!) because they can stop me from installing the p's, but they can't stop me from installing gawk.

Gawk and pgn-extract are both command-line programs which you use by entering commands in a command interpreter -- cmd.exe on Windows. The command-line is very practical for text processing, but it's not visual like a GUI. It's more like walking around your house with a blindfold on, and you only navigate successfully because you already know where everything is.
  • http://gnuwin32.sourceforge.net/packages
  • Click on the "Gawk" link.
  • Click on the "General Installation Instructions" link, which also includes usage instructions, and read up.
  • Go back to the Gawk page.
  • Probably you want the "Complete package, except sources" Setup option. 
  • Click on that to download the setup.exe.
  • Ideally you would verify the download with the provided md5sum, but I'm not going to describe how to do that.
  • Finally, follow the previous General Installation Instructions to install.

There is a big caveat to all of the above gawk installation steps. I have gawk working on a couple of Windows 10 machines, but I didn't use the setup method (it's exactly this that is blocked at my work), so I'm not really sure if it will succeed. The setup.exe on sourceforge was created for Windows Vista, and might not work on Windows 10. Or it might partially succeed but require tweaks after.

Anyway, fingers crossed, after installation open cmd.exe and type `gawk --version` (without the quotes), to verify that you can run it. With pgn-extract the command is `pgn-extract --version`.

Jonathan003 wrote on 10/25/20 at 13:29:10:

Maybe I can install a Unix system in Virtual Box on my Windows 64bit PC?

I hope you can help me with this.

Yes, that's another way, assuming Unix means a Linux distribution. But it's another can of worms. Your Linux will come with awk but not with pgn-extract. To install pgn-extract via the package manager means you need to connect the VM to the network, which is not a trivial step. The other option is to build pgn-extract from source, which is even more fun.

Edited:
Another option for you is Windows Subsystem for Linux (WSL). I knew about this but I didn't realise it's available on the Windows Store. Easy-peasy. Choose the Ubuntu version and install pgn-extract from Synaptic, and you will be good to go.
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #9 - 10/25/20 at 13:29:10
Post Tools
an ordinary chessplayer wrote on 06/08/19 at 21:06:11:
Easy on unix or mac. 
Only slightly less easy on windows. gnuwin32.sourceforge.net/packages
  1. convert your repertoire.pgn(s) to repertoire.epd (e.g. use pgn-extract)
  2. convert your new.pgn to new.epd
  3. for each line in new.epd 
    $ grep -F "fen" repertoire.epd

I wrote a couple of helper awk scripts to somewhat automate this task, and combined them in one attachment. You would have to separate them again before using. WIth these scripts, the exact sequence of commands to reproduce the above steps would be:
  • $ pgn-extract -w200 --fencomments -orepertoire1.pgn repertoire.pgn
  • $ gawk -f fencomments.awk repertoire1.pgn > repertoire1.epd
  • $ pgn-extract -w200 --fencomments -onew1.pgn new.pgn
  • $ gawk -f fencomments.awk new1.pgn > new1.epd
  • $ gawk -f epdcompare.awk -v CMP=repertoire1.epd new1.epd > cmp.epd


With the following repertoire.pgn 
Code (Pascal)
Select All
[Event "rep game 1"]
[Result "*"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 g6
6. f4 Bg7 7. e5 dxe5 8. fxe5 Ng4 9. Bb5+ Kf8 10. Ne6+
*

[Event "rep game 2"]
[Result "*"]

1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Nc6 5. Nf3 Qb6
6. Bd3 cxd4 7. cxd4 Nxd4 8. Nxd4 Qxd4 9. Bb5+ Bd7 10. Bxd7+ Kxd7
11. Qxd4
* 


And the following new.pgn to compare it to:
Code (Pascal)
Select All
[Event "new game 1"]
[Result "*"]

1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Qb6 {N} 5. Nf3
5... Nc6 {transposition}
6. Bd3 cxd4 7. cxd4 Bd7 {N} 8. O-O Nxd4 9. Nxd4 Qxd4 10. Nc3 a6
* 


The output cmp.epd is below.
Code
Select All
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3;hmvc 0;fmvn 1;id 1;fk 1 2;fmvnmax 1;
rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq -;hmvc 0;fmvn 2;id 1;fk 2;fmvnmax 2;
rnbqkbnr/pppp1ppp/4p3/8/3PP3/8/PPP2PPP/RNBQKBNR b KQkq d3;hmvc 0;fmvn 2;id 1;fk 2;fmvnmax 2;
rnbqkbnr/ppp2ppp/4p3/3p4/3PP3/8/PPP2PPP/RNBQKBNR w KQkq d6;hmvc 0;fmvn 3;id 1;fk 2;fmvnmax 3;
rnbqkbnr/ppp2ppp/4p3/3pP3/3P4/8/PPP2PPP/RNBQKBNR b KQkq -;hmvc 0;fmvn 3;id 1;fk 2;fmvnmax 3;
rnbqkbnr/pp3ppp/4p3/2ppP3/3P4/8/PPP2PPP/RNBQKBNR w KQkq c6;hmvc 0;fmvn 4;id 1;fk 2;fmvnmax 4;
rnbqkbnr/pp3ppp/4p3/2ppP3/3P4/2P5/PP3PPP/RNBQKBNR b KQkq -;hmvc 0;fmvn 4;id 1;fk 2;fmvnmax 4;
rnb1kbnr/pp3ppp/1q2p3/2ppP3/3P4/2P5/PP3PPP/RNBQKBNR w KQkq -;hmvc 1;fmvn 5;id 1;fk 0;fmvnmax 0;
rnb1kbnr/pp3ppp/1q2p3/2ppP3/3P4/2P2N2/PP3PPP/RNBQKB1R b KQkq -;hmvc 2;fmvn 5;id 1;fk 0;fmvnmax 0;
r1b1kbnr/pp3ppp/1qn1p3/2ppP3/3P4/2P2N2/PP3PPP/RNBQKB1R w KQkq -;hmvc 3;fmvn 6;id 1;fk 2;fmvnmax 6;
r1b1kbnr/pp3ppp/1qn1p3/2ppP3/3P4/2PB1N2/PP3PPP/RNBQK2R b KQkq -;hmvc 4;fmvn 6;id 1;fk 2;fmvnmax 6;
r1b1kbnr/pp3ppp/1qn1p3/3pP3/3p4/2PB1N2/PP3PPP/RNBQK2R w KQkq -;hmvc 0;fmvn 7;id 1;fk 2;fmvnmax 7;
r1b1kbnr/pp3ppp/1qn1p3/3pP3/3P4/3B1N2/PP3PPP/RNBQK2R b KQkq -;hmvc 0;fmvn 7;id 1;fk 2;fmvnmax 7;
r3kbnr/pp1b1ppp/1qn1p3/3pP3/3P4/3B1N2/PP3PPP/RNBQK2R w KQkq -;hmvc 1;fmvn 8;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/1qn1p3/3pP3/3P4/3B1N2/PP3PPP/RNBQ1RK1 b kq -;hmvc 2;fmvn 8;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/1q2p3/3pP3/3n4/3B1N2/PP3PPP/RNBQ1RK1 w kq -;hmvc 0;fmvn 9;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/1q2p3/3pP3/3N4/3B4/PP3PPP/RNBQ1RK1 b kq -;hmvc 0;fmvn 9;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/4p3/3pP3/3q4/3B4/PP3PPP/RNBQ1RK1 w kq -;hmvc 0;fmvn 10;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/4p3/3pP3/3q4/2NB4/PP3PPP/R1BQ1RK1 b kq -;hmvc 1;fmvn 10;id 1;fk 0;fmvnmax 0;
r3kbnr/1p1b1ppp/p3p3/3pP3/3q4/2NB4/PP3PPP/R1BQ1RK1 w kq -;hmvc 0;fmvn 11;id 1;fk 0;fmvnmax 0; 


Note that it matches by position and not by move. The two "N" moves result in positions with "fk 0", and the transposition is also caught.
  • id - game number in the new.pgn
  • fk - array of matching game numbers in repertoire.pgn
    Note that the first position matched both games in the repertoire.
  • fmvn - full move number in new.pgn.
    Note that for black moves this is "off by one" from the last move played.
  • fmvnmax - the largest "repertoire" full move number where the id-game in new.pgn matched any fk-game in repertoire.pgn

I could have output the sm opcode as well (supplied move), and for openings work this would have made it a little easier to scan the final epd.  I didn't do that because I'm actually planning to use epdcompare with endgame epd-files (not pgn-files). As it stands, you will probably have to open both new.pgn and cmp.epd at the same time and scan two files together. But since the OP asked about ChessBase, I assume the plan is: once the interesting new games are identified, merge by dragging them onto the appropriate game in the repertoire.

I want to try this.
I have a windows 10 64 bit system.
Can you tell me how exactly to do it please maybe with some screenshots or video capture?

I try to follow these steps:

$ pgn-extract -w200 --fencomments -orepertoire1.pgn repertoire.pgn
$ gawk -f fencomments.awk repertoire1.pgn > repertoire1.epd
$ pgn-extract -w200 --fencomments -onew1.pgn new.pgn
$ gawk -f fencomments.awk new1.pgn > new1.epd
$ gawk -f epdcompare.awk -v CMP=repertoire1.epd new1.epd > cmp.epd

I have pgn-extract but I have no idea what's gawk?
You give this link for windows users to this website: gnuwin32.sourceforge.net/packages
What am I supposed to download there and how to use it?
Maybe I can install a Unix system in Virtual Box on my Windows 64bit PC?

I hope you can help me with this.
  
Back to top
 
IP Logged
 
Cesso
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 15
Joined: 04/29/20
Re: Filter games according to my repertoire
Reply #8 - 05/03/20 at 15:14:46
Post Tools
Jonathan003 wrote on 02/01/20 at 16:27:49:
I use polyglot_tolerant for this.
I use the book merging options. And In Lucas chess there is an option to import all best moves from a bin book to a repertoire. And the repertoire can be exported to pgn.
If you want to know how I make a repertoire send me a private message.



Hmmm, I will give it a try. Sounds interesting
  
Back to top
 
IP Logged
 
Ballantine
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 4
Joined: 04/29/20
Re: Filter games according to my repertoire
Reply #7 - 04/30/20 at 16:03:12
Post Tools
I know Chess Position Trainer (CPT) does just that. But its not freeware. It will compare your games against your repertoire you've built. If you already have your repertoire(s) in PGN you can just import it in CPT. Then load your game

I would post an image but I am new here and need 15 post before I can link images Cool
  
Back to top
 
IP Logged
 
Jonathan003
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 24
Location: Belgium
Joined: 01/29/20
Gender: Male
Re: Filter games according to my repertoire
Reply #6 - 02/01/20 at 16:27:49
Post Tools
I use polyglot_tolerant for this.
I use the book merging options. And In Lucas chess there is an option to import all best moves from a bin book to a repertoire. And the repertoire can be exported to pgn.
If you want to know how I make a repertoire send me a private message.

  
Back to top
 
IP Logged
 
Tartakaviar
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 3
Joined: 06/07/19
Re: Filter games according to my repertoire
Reply #5 - 01/04/20 at 13:37:21
Post Tools
Thanks a lot. Nice work. But then how can we use the output ? 
I discovered a very helpful feature on ChessTempo. You can enter your opening repertoire for white and black and then trainyourself on you repertoire. I'm currently working on this to complete my repertoire but it's a huge work. 
Once finished I will use your tools but I don't see for the moment how can I exploit it to merge the instresting games in my opening repertoire PGN
  
Back to top
 
IP Logged
 
an ordinary chessplayer
God Member
*****
Offline


I used to be not bad.

Posts: 1837
Location: Columbus, OH (USA)
Joined: 01/02/15
Re: Filter games according to my repertoire
Reply #4 - 06/08/19 at 21:06:11
Post Tools
Easy on unix or mac. 
Only slightly less easy on windows. http://gnuwin32.sourceforge.net/packages.html
  1. convert your repertoire.pgn(s) to repertoire.epd (e.g. use pgn-extract)
  2. convert your new.pgn to new.epd
  3. for each line in new.epd 
    $ grep -F "fen" repertoire.epd

I wrote a couple of helper awk scripts to somewhat automate this task, and combined them in one attachment. You would have to separate them again before using. WIth these scripts, the exact sequence of commands to reproduce the above steps would be:
  • $ pgn-extract -w200 --fencomments -orepertoire1.pgn repertoire.pgn
  • $ gawk -f fencomments.awk repertoire1.pgn > repertoire1.epd
  • $ pgn-extract -w200 --fencomments -onew1.pgn new.pgn
  • $ gawk -f fencomments.awk new1.pgn > new1.epd
  • $ gawk -f epdcompare.awk -v CMP=repertoire1.epd new1.epd > cmp.epd


With the following repertoire.pgn 
Code (Pascal)
Select All
[Event "rep game 1"]
[Result "*"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 g6
6. f4 Bg7 7. e5 dxe5 8. fxe5 Ng4 9. Bb5+ Kf8 10. Ne6+
*

[Event "rep game 2"]
[Result "*"]

1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Nc6 5. Nf3 Qb6
6. Bd3 cxd4 7. cxd4 Nxd4 8. Nxd4 Qxd4 9. Bb5+ Bd7 10. Bxd7+ Kxd7
11. Qxd4
* 


And the following new.pgn to compare it to:
Code (Pascal)
Select All
[Event "new game 1"]
[Result "*"]

1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Qb6 {N} 5. Nf3
5... Nc6 {transposition}
6. Bd3 cxd4 7. cxd4 Bd7 {N} 8. O-O Nxd4 9. Nxd4 Qxd4 10. Nc3 a6
* 


The output cmp.epd is below.
Code
Select All
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3;hmvc 0;fmvn 1;id 1;fk 1 2;fmvnmax 1;
rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq -;hmvc 0;fmvn 2;id 1;fk 2;fmvnmax 2;
rnbqkbnr/pppp1ppp/4p3/8/3PP3/8/PPP2PPP/RNBQKBNR b KQkq d3;hmvc 0;fmvn 2;id 1;fk 2;fmvnmax 2;
rnbqkbnr/ppp2ppp/4p3/3p4/3PP3/8/PPP2PPP/RNBQKBNR w KQkq d6;hmvc 0;fmvn 3;id 1;fk 2;fmvnmax 3;
rnbqkbnr/ppp2ppp/4p3/3pP3/3P4/8/PPP2PPP/RNBQKBNR b KQkq -;hmvc 0;fmvn 3;id 1;fk 2;fmvnmax 3;
rnbqkbnr/pp3ppp/4p3/2ppP3/3P4/8/PPP2PPP/RNBQKBNR w KQkq c6;hmvc 0;fmvn 4;id 1;fk 2;fmvnmax 4;
rnbqkbnr/pp3ppp/4p3/2ppP3/3P4/2P5/PP3PPP/RNBQKBNR b KQkq -;hmvc 0;fmvn 4;id 1;fk 2;fmvnmax 4;
rnb1kbnr/pp3ppp/1q2p3/2ppP3/3P4/2P5/PP3PPP/RNBQKBNR w KQkq -;hmvc 1;fmvn 5;id 1;fk 0;fmvnmax 0;
rnb1kbnr/pp3ppp/1q2p3/2ppP3/3P4/2P2N2/PP3PPP/RNBQKB1R b KQkq -;hmvc 2;fmvn 5;id 1;fk 0;fmvnmax 0;
r1b1kbnr/pp3ppp/1qn1p3/2ppP3/3P4/2P2N2/PP3PPP/RNBQKB1R w KQkq -;hmvc 3;fmvn 6;id 1;fk 2;fmvnmax 6;
r1b1kbnr/pp3ppp/1qn1p3/2ppP3/3P4/2PB1N2/PP3PPP/RNBQK2R b KQkq -;hmvc 4;fmvn 6;id 1;fk 2;fmvnmax 6;
r1b1kbnr/pp3ppp/1qn1p3/3pP3/3p4/2PB1N2/PP3PPP/RNBQK2R w KQkq -;hmvc 0;fmvn 7;id 1;fk 2;fmvnmax 7;
r1b1kbnr/pp3ppp/1qn1p3/3pP3/3P4/3B1N2/PP3PPP/RNBQK2R b KQkq -;hmvc 0;fmvn 7;id 1;fk 2;fmvnmax 7;
r3kbnr/pp1b1ppp/1qn1p3/3pP3/3P4/3B1N2/PP3PPP/RNBQK2R w KQkq -;hmvc 1;fmvn 8;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/1qn1p3/3pP3/3P4/3B1N2/PP3PPP/RNBQ1RK1 b kq -;hmvc 2;fmvn 8;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/1q2p3/3pP3/3n4/3B1N2/PP3PPP/RNBQ1RK1 w kq -;hmvc 0;fmvn 9;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/1q2p3/3pP3/3N4/3B4/PP3PPP/RNBQ1RK1 b kq -;hmvc 0;fmvn 9;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/4p3/3pP3/3q4/3B4/PP3PPP/RNBQ1RK1 w kq -;hmvc 0;fmvn 10;id 1;fk 0;fmvnmax 0;
r3kbnr/pp1b1ppp/4p3/3pP3/3q4/2NB4/PP3PPP/R1BQ1RK1 b kq -;hmvc 1;fmvn 10;id 1;fk 0;fmvnmax 0;
r3kbnr/1p1b1ppp/p3p3/3pP3/3q4/2NB4/PP3PPP/R1BQ1RK1 w kq -;hmvc 0;fmvn 11;id 1;fk 0;fmvnmax 0; 


Note that it matches by position and not by move. The two "N" moves result in positions with "fk 0", and the transposition is also caught.
  • id - game number in the new.pgn
  • fk - array of matching game numbers in repertoire.pgn
    Note that the first position matched both games in the repertoire.
  • fmvn - full move number in new.pgn.
    Note that for black moves this is "off by one" from the last move played.
  • fmvnmax - the largest "repertoire" full move number where the id-game in new.pgn matched any fk-game in repertoire.pgn

I could have output the sm opcode as well (supplied move), and for openings work this would have made it a little easier to scan the final epd.  I didn't do that because I'm actually planning to use epdcompare with endgame epd-files (not pgn-files). As it stands, you will probably have to open both new.pgn and cmp.epd at the same time and scan two files together. But since the OP asked about ChessBase, I assume the plan is: once the interesting new games are identified, merge by dragging them onto the appropriate game in the repertoire.
  

epdcompare_awk.txt ( 3 KB | 243 Downloads )
Back to top
 
IP Logged
 
JFugre
Junior Member
**
Offline


I Love ChessPublishing!

Posts: 89
Joined: 01/22/19
Re: Filter games according to my repertoire
Reply #3 - 06/07/19 at 21:15:42
Post Tools
https://sjeng.org/dl/pgnannotate.exe (source: https://sjeng.org/dl/pgnannotate.py)

I wrote this a while ago to do exactly this. You need to have a PGN file with your repertoire. These can be games, variation trees, etc. Black and white repertoire should be together in one file.

Then the program goes over the games PGN and IF there are 2 or less moves known for a position, but ANOTHER move was played, it will add an annotation noting the "known move(s)".

My use case was to go over large collections of games played online and quickly check where I forgot my theory. It may be too restricted for you.
  
Back to top
 
IP Logged
 
Tartakaviar
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 3
Joined: 06/07/19
Re: Filter games according to my repertoire
Reply #2 - 06/07/19 at 15:44:50
Post Tools
brabo wrote on 06/07/19 at 12:52:16:
I don't believe there is a tool which does exactly what you want but you can get something very close to it.

In the recent versions of the Fritz interface you can ask to analyze a batch of games (so x number of games at once). You define the time of the analysis (I would put it as fast as possible in your case) and you also activate the openingreference function in which you specify in which database should be looked for the games.

If you have a hundred of your own games to check then I would let it run overnight so in the morning you have it ready. I know some players do that for their online blitzgames.

Thanks for this interesting answer. Fritz is cheaper than chessbase so i'll probably buy it. The functionality you describe seems very interesting and as you said close to my need but I will realize  and perfectly understand it as soon as I will experiment this functionality.
Thanks again !
  
Back to top
 
IP Logged
 
brabo
God Member
*****
Offline


Welcome chessfriend

Posts: 1073
Joined: 02/02/07
Re: Filter games according to my repertoire
Reply #1 - 06/07/19 at 12:52:16
Post Tools
I don't believe there is a tool which does exactly what you want but you can get something very close to it.

In the recent versions of the Fritz interface you can ask to analyze a batch of games (so x number of games at once). You define the time of the analysis (I would put it as fast as possible in your case) and you also activate the openingreference function in which you specify in which database should be looked for the games.

If you have a hundred of your own games to check then I would let it run overnight so in the morning you have it ready. I know some players do that for their online blitzgames.
  
Back to top
WWW  
IP Logged
 
Tartakaviar
YaBB Newbies
*
Offline


I Love ChessPublishing!

Posts: 3
Joined: 06/07/19
Filter games according to my repertoire
06/07/19 at 10:44:19
Post Tools
Hello everyone,

Is there a tool - if possible a freeware -   
that from two repertoire databases for each color  (in Chessbase or PGN format) 
filters all games of another database or PGN (the target base) that are in my repertoire.

Ideally I'd like to know from what move me or my opponent are "out" of the repertoire.
I have never managed to do that with Chessbase 8 (yes I know I date).
And I hesitate to buy a newer version of Chessbase. 
Is there a version of Chessbase that manages to do it?

Thank you in advance for your help.
  
Back to top
 
IP Logged
 
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo