How to annotate games in a pgn file with "{last book move}"

Discussion of chess software programming and technical issues.

Moderator: Ras

Jonathan003
Posts: 243
Joined: Fri Jul 06, 2018 4:23 pm
Full name: Jonathan Cremers

How to annotate games in a pgn file with "{last book move}"

Post by Jonathan003 »

I have a pgn database of about 80.000 games.
The games don't have any annotations.
I want to annotate the games, so there is an annotation "{last book move}", in the games.
I want to annotate the games with a CTG book or bin or abk book loaded.

Afterwards I want to search for games with this "{last book move}" annotation, truncate the moves after this annotation and remove duplicates (also games included in other games).

I can do it with Fritz from Chessbase by selecting al the games, and doing a blundercheck with the option depth = 0
But it is very slow. It will take more than 24 hours on my pc to complete the task.
I want it to be fast and I'm only interested to have this "{last book move}" annotation in the games.
Does anyone know of a better and faster approach?
Maybe with Scid or Arena or Banksia?
Or maybe with some simple Python script?
Jonathan003
Posts: 243
Joined: Fri Jul 06, 2018 4:23 pm
Full name: Jonathan Cremers

Re: How to annotate games in a pgn file with "{last book move}"

Post by Jonathan003 »

Here is a sample how I want the annotated games to look:
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
[PlyCount "13"]

1. d4 Nf6 2. c4 c6 3. Nc3 d5 4. cxd5 cxd5 5. Bf4 Nc6 6. e3 Bf5 {last book move} 7. Rc1 1/2-1/2

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
[PlyCount "17"]

1. d4 Nf6 2. c4 c6 3. Nc3 d5 4. cxd5 cxd5 5. Bf4 Nc6 6. e3 Bf5 7. Nf3 e6 {last book move} 8. Bb5 Nd7 9. Qa4 1/2-1/2

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
[PlyCount "22"]

1. d4 Nf6 2. c4 c6 3. Nc3 d5 4. cxd5 cxd5 5. Bf4 Nc6 6. e3 e6 7. Bd3 Be7 8. h3 O-O 9. Nf3 Bd7 10. O-O Qb6 {last book move} 11. Qe2 Rfc8 1/2-1/2

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1/2-1/2"]
[PlyCount "14"]

1. d4 Nf6 2. c4 c6 3. Nc3 d5 4. cxd5 cxd5 5. Bf4 Nc6 6. e3 a6 {last book move} 7. Be2 e6 1/2-1/2