1

I'm using the --splitvariants flag to generate cards for anki, my problem is, how can i identify which line i'm playing? I though pgn-extract would have something like this, what i need is some way to append the variation name at the end of the line.

multiple chess lines

Please ignore the false keyword, what i need is to append a ;$VariantName at the end of each line

1
  • There currently isn't a mechanism in pgn-extract for arbitrary output formats, but if you would like to contact me (the author of pgn-extract) via the email address that goes with the program then I will see if a custom solution might be possible for you.
    – kentdjb
    Dec 15, 2022 at 17:40

1 Answer 1

1

For @kentdjb and anyone interesed I solved my issue by doing the following:

First I downloaded an eco.pgn containing the names of openings and variations. You can find it here

Then I created an args file containing the following options:

:-C
:-e
:-w1000
:--minmoves 2
:-ofull-vienna.pgn
:--splitvariants
:--detag Event
:--detag Site
:--detag Date
:--detag White
:--detag Black
:--detag Result
:--detag ECO
:--detag Round
:--detag UTCDate
:--detag UTCTime
:--detag Annotator
:--detag Variant

Finally I ran the following command in my two pgn files containing vienna lines:

$ pgn-extract {vienna-foobar1,vienna-foobar2}.pgn -Aargs the output will throw something like this:

[Opening "Vienna gambit"]
[Variation "Paulsen attack"]

1. e4 e5 2. Nc3 Nf6 3. f4 d5 4. fxe5 Nxe4 5. Qf3 Nxc3 6. bxc3 Be7 7. d4 O-O 8. Bd3 Be6 9. Ne2 c5 10. O-O Nc6 11. Be3 *
1. e4 e5 2. Nc3 Nc6 3. Bc4 Bc5 4. Qg4 Qf6 5. Nd5 Qxf2+ 6. Kd1 Kf8 7. Nh3 h5 8. Qg5 f6 9. Qg6 Rh6 10. Ne7 *
1. e4 e5 2. Nc3 Nc6 3. Bc4 d6 4. d3 *
...

To convert this lines to anki cards I just use a vim macro to insert the $Opening and the $Variation at the end of each line.

Hope this is useful

3
  • I'm glad you solved it. Often, post-processing pgn-extract output with another program is the best way to get exactly what you want.
    – kentdjb
    Dec 19, 2022 at 7:11
  • Thanks for creating such an amazing program, it would be good if you could allow the --detag flag to receive multiple tags at one, like this: --detag "tag1,tag2". At first i was using the -Rtags --xroster option but then i realize some games doesn't contain all the tags i specify inside the tags file
    – Carlos
    Dec 19, 2022 at 14:27
  • I'm glad you like the program. I could add something like that to --detag. I will put it on my list of improvements.
    – kentdjb
    Dec 20, 2022 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.