-1

Merging two pgn files is an operation, that makes just one game variation, and the one of the game gets added as a variation to the other game. If both the games have similar opening, then the similar opening moves are eliminated and a variation is created at the point when both the games starts to differ.

In Chessbase software (or any other chess tools), it is easy to merge normal chess games, we just copy the game and paste it into another, and it gets added as a variation. If if we have to do this for multiple games, it get laborious and manual process of merging. It will be good if some automated script exists for this purpose.

1

A piece of code that works perfectly for merging pgns is.

https://github.com/permutationlock/merge-pgn

The code is not regex heavy, thanks to python-chess library. It can merge several pgn games into a single pgn with one game including all moves as variations.

All headers and comments are ignored as this is designed only to manipulate the move lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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