Looking for PGN sorting but in order of my choice

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

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
PaulieD
Posts: 205
Joined: Tue Jun 25, 2013 6:19 pm

Re: Looking for PGN sorting but in order of my choice

Post by PaulieD » Mon Jan 19, 2015 3:53 am

Ferdy wrote:
PaulieD wrote:What happened is it put them in all A00 then all A01 and so on
I should have been more specific possibly.
Game 1 any A Eco code
Game 2 any B Eco code
Game 3 any C Eco code

It was quick I hope that file can be modified to accomplish my request.
Many Thanks.

Edit:
I tried the E1 switch and all it did was jumble all the A's to the top of the pgn.
I thought I also need this tool to my test sets, so I have done a python script together with pgn-extract to do this. Install python and rename your original pgn file to src.pgn. The script also uses system cmd and tested to work in windows 7. Note there is a sample src.pgn in the download file as a sample. Also pgn-extract-17-14 is already included.

Sample run. I use your uploaded pgn file.

Code: Select all

found src.pgn !!
Deleting existing a.pgn ... e.pgn files ...
pgn-extract-17-14 running to get a.pgn ... e.pgn ...
Count games in a.pgn ... e.pgn to get max games ...
a numgames 1458
b numgames 1100
c numgames 622
d numgames 1088
e numgames 732
max value 1458
total games 5000
Writing games please wait this may take time ...
Fixing spaces between games in output pgn file ...
Deleting unwanted files ...
time: 52.2 sec
done!! look at out.pgn

press any key to exit
Download:
http://www.mediafire.com/download/tk996 ... _games.rar
Wow,
I'm getting an overwhelming amout of help with this from so many people.
Ferdinand thanks for the creation of this tool on my behalf, it will be a nice addition to my toolbox.

I did what you instructed and installed python3.4.2. I put your package in its own directory. When I click on the.py file nothing happens, I thought it would be have like a batch file but it did not.
What am I doing wrong? Do I have to put it all into the Python directory?

Ferdy
Posts: 4079
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Looking for PGN sorting but in order of my choice

Post by Ferdy » Mon Jan 19, 2015 4:36 am

PaulieD wrote:
Ferdy wrote:
PaulieD wrote:What happened is it put them in all A00 then all A01 and so on
I should have been more specific possibly.
Game 1 any A Eco code
Game 2 any B Eco code
Game 3 any C Eco code

It was quick I hope that file can be modified to accomplish my request.
Many Thanks.

Edit:
I tried the E1 switch and all it did was jumble all the A's to the top of the pgn.
I thought I also need this tool to my test sets, so I have done a python script together with pgn-extract to do this. Install python and rename your original pgn file to src.pgn. The script also uses system cmd and tested to work in windows 7. Note there is a sample src.pgn in the download file as a sample. Also pgn-extract-17-14 is already included.

Sample run. I use your uploaded pgn file.

Code: Select all

found src.pgn !!
Deleting existing a.pgn ... e.pgn files ...
pgn-extract-17-14 running to get a.pgn ... e.pgn ...
Count games in a.pgn ... e.pgn to get max games ...
a numgames 1458
b numgames 1100
c numgames 622
d numgames 1088
e numgames 732
max value 1458
total games 5000
Writing games please wait this may take time ...
Fixing spaces between games in output pgn file ...
Deleting unwanted files ...
time: 52.2 sec
done!! look at out.pgn

press any key to exit
Download:
http://www.mediafire.com/download/tk996 ... _games.rar
Wow,
I'm getting an overwhelming amout of help with this from so many people.
Ferdinand thanks for the creation of this tool on my behalf, it will be a nice addition to my toolbox.

I did what you instructed and installed python3.4.2. I put your package in its own directory. When I click on the.py file nothing happens, I thought it would be have like a batch file but it did not.
What am I doing wrong? Do I have to put it all into the Python directory?
It should have worked like that (double-clicking) but anyway, try to right-click the extract_games.py, then Edit with IDLE, then click the run menu then run module.
I have tested here that script in python 3.4.1., I also have 2.7.2 and it worked also.

PaulieD
Posts: 205
Joined: Tue Jun 25, 2013 6:19 pm

Re: Looking for PGN sorting but in order of my choice

Post by PaulieD » Mon Jan 19, 2015 4:44 am

Ferdy wrote:
PaulieD wrote:
Ferdy wrote:
PaulieD wrote:What happened is it put them in all A00 then all A01 and so on
I should have been more specific possibly.
Game 1 any A Eco code
Game 2 any B Eco code
Game 3 any C Eco code

It was quick I hope that file can be modified to accomplish my request.
Many Thanks.

Edit:
I tried the E1 switch and all it did was jumble all the A's to the top of the pgn.
I thought I also need this tool to my test sets, so I have done a python script together with pgn-extract to do this. Install python and rename your original pgn file to src.pgn. The script also uses system cmd and tested to work in windows 7. Note there is a sample src.pgn in the download file as a sample. Also pgn-extract-17-14 is already included.

Sample run. I use your uploaded pgn file.

Code: Select all

found src.pgn !!
Deleting existing a.pgn ... e.pgn files ...
pgn-extract-17-14 running to get a.pgn ... e.pgn ...
Count games in a.pgn ... e.pgn to get max games ...
a numgames 1458
b numgames 1100
c numgames 622
d numgames 1088
e numgames 732
max value 1458
total games 5000
Writing games please wait this may take time ...
Fixing spaces between games in output pgn file ...
Deleting unwanted files ...
time: 52.2 sec
done!! look at out.pgn

press any key to exit
Download:
http://www.mediafire.com/download/tk996 ... _games.rar
Wow,
I'm getting an overwhelming amout of help with this from so many people.
Ferdinand thanks for the creation of this tool on my behalf, it will be a nice addition to my toolbox.

I did what you instructed and installed python3.4.2. I put your package in its own directory. When I click on the.py file nothing happens, I thought it would be have like a batch file but it did not.
What am I doing wrong? Do I have to put it all into the Python directory?
It should have worked like that but anyway, try to right-click the extract_games.py, then Edit with IDLE, then click the run menu then run module.
I have tested here that script in python 3.4.1.
I have all the items in the PGN Extract directory plus a copy of extract_games.py in the Python\Tools\Scripts directory also.
When I right click the file it opens in notepad and the is no IDLE option and also no run menu.
I hate to sound stupid but I know nothing about this tool so need to be led step by step, if you choose to continue to help me.

I Got it !! I had to right click and choose to open it with Python it is running now.

PaulieD
Posts: 205
Joined: Tue Jun 25, 2013 6:19 pm

Re: Looking for PGN sorting but in order of my choice

Post by PaulieD » Mon Jan 19, 2015 5:24 am

This tool can handle an unlimited amout of games in the pgn. This opens up ideas for huge books that could be made sequentially and 5-10-15,000 games in size for ultra fast games.

I can't thank everyone enough for all their help. I will be sure to mention everyone when posting my tests to give proper credit where it is due.

User avatar
Graham Banks
Posts: 33017
Joined: Sun Feb 26, 2006 9:52 am
Location: Auckland, NZ

Re: Looking for PGN sorting but in order of my choice

Post by Graham Banks » Mon Jan 19, 2015 5:41 am

Here is the TopGM-8move.cgb book for ChessGUI.
There are 4991 lines in it.

http://kirill-kryukov.com/chess/discuss ... p?id=33706
My email addresses:
gbanksnz at gmail.com
gbanksnz at yahoo.co.nz

PaulieD
Posts: 205
Joined: Tue Jun 25, 2013 6:19 pm

Re: Looking for PGN sorting but in order of my choice

Post by PaulieD » Mon Jan 19, 2015 11:05 pm

Here I created some 10,000 game 2move,4move,6move and 8move pgn, all in perfect ECO order.
ECO contents;
A=2000
B=2000
C=2000
D=2000
E=2000
So equal amounts of all ECO codes. Also included is Norm Pollock's provided pgn (5000 games) but not all equal amounts of A,B,C,D,and E codes, but still sorted in perfect order.

http://www.solidfiles.com/d/3c30b3399c/ ... estsets.7z

PaulieD
Posts: 205
Joined: Tue Jun 25, 2013 6:19 pm

Re: Looking for PGN sorting but in order of my choice

Post by PaulieD » Sun Nov 12, 2017 4:35 am

Ferdinand,

I am hoping you can help me. I have a new win 10 computer and your tool here is no longer sorting the pgn.
It creates the A,B,C,D,E pgn in this directory:
C:\Users\Paul-PC\AppData\Local\VirtualStore\Program Files (x86)\Chess PGN Tools\Ferdinand PGN Sort

But your tool is here:
C:\Program Files (x86)\Chess PGN Tools\Ferdinand PGN Sort

It fails to create the results.pgn final result in any directory. Is it a Windows 10 problem?
Thanks

PaulieD
Posts: 205
Joined: Tue Jun 25, 2013 6:19 pm

Re: Looking for PGN sorting but in order of my choice

Post by PaulieD » Sun Nov 12, 2017 5:21 am

I figured it out, I had to put the tools into that "virtual store" directory and everything worked.

Norm Pollock
Posts: 1017
Joined: Thu Mar 09, 2006 3:15 pm
Location: Long Island, NY, USA
Contact:

Re: Looking for PGN sorting but in order of my choice

Post by Norm Pollock » Sun Nov 19, 2017 4:30 pm

I have been working on a direct tool that will merge pgn files.

Right now it only merges 2 files, 1 game from each, repeatedly. Hopefully I will be able to increase that number, but that will take awhile, if at all.

Here is the link:

http://www.mediafire.com/file/zo6ufedvkcacccr/merge.exe

Usage (in a command window in Windows):

merge file1.pgn file2.pgn

output file: outMR.pgn

Input files are not changed.
A second execution overwrites previous output, so it must be renamed to be saved.

This link is temporary. Eventually this tool will be included in my 40H-PGN tool box which can be freely downloaded. See www below.
It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change. -- Charles Darwin

Norm Pollock
Posts: 1017
Joined: Thu Mar 09, 2006 3:15 pm
Location: Long Island, NY, USA
Contact:

Re: Looking for PGN sorting but in order of my choice

Post by Norm Pollock » Mon Nov 20, 2017 5:24 am

I was able to extend "merge.exe" to merge 2 to 5 "pgn" files.

The link is still

http://www.mediafire.com/file/zo6ufedvkcacccr/merge.exe

Usage examples:

merge file1.pgn file2.pgn

merge file1.pgn file2.pgn file3.pgn

merge file1.pgn file2.pgn file3.pgn file4.pgn

merge file1.pgn file2.pgn file3.pgn file4.pgn file5.pgn
It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change. -- Charles Darwin

Post Reply