Chess Tools

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
main line
Posts: 60
Joined: Thu Jul 07, 2016 8:15 pm

Re: Chess Tools

Post by main line » Fri Mar 30, 2018 6:38 am

Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database

User avatar
Guenther
Posts: 2825
Joined: Wed Oct 01, 2008 4:33 am
Location: Regensburg, Germany
Full name: Guenther Simon
Contact:

Re: Chess Tools

Post by Guenther » Fri Mar 30, 2018 6:52 am

main line wrote:Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
Use pgn extract.
Current foe list count : [84]
http://rwbc-chess.de/chronology.htm

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

Re: Chess Tools

Post by Ferdy » Fri Mar 30, 2018 6:56 am

main line wrote:Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
Delete after 22nd move.

Code: Select all

pgn-extract.exe --plylimit 44 --output out_22_mygames.pgn mygames.pgn
Delete after 35th move.

Code: Select all

pgn-extract.exe --plylimit 70 --output out_35_mygames.pgn mygames.pgn
mygames.pgn is your orig file.

Download pgn-extract.exe at:
https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/

Sample output of 22nd move, be aware of Result 0-1 and the * at the end of moves, they are not consistent, but it cuts the moves well.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2010.07.28"]
[Round "?"]
[White "www"]
[Black "bbb"]
[Result "0-1"]
[ECO "B18"]

1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Bf5 5. Ng3 Bg6 6. h4 h6 7. h5 Bh7 8.
Bd3 Bxd3 9. Qxd3 Nf6 10. Nf3 e6 11. c4 Bb4+ 12. Bd2 a5 13. Bc3 Nbd7 14. Rd1
O-O 15. O-O Qc7 16. Rfe1 Rfd8 17. Qe2 Qf4 18. Ne5 Nxe5 19. dxe5 Ng4 20.
Rxd8+ Rxd8 21. Qf3 Qg5 22. Re4 Bxc3 *

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

Re: Chess Tools

Post by Norm Pollock » Fri Mar 30, 2018 2:36 pm

main line wrote:Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
Using "truncate" from 40H-PGN tools in a command window:

truncate alpha.pgn 44

truncate alpha.pgn 70

use 44 because 22 moves translates to 44 plies, similar for 35 and 70

output is put into a temporary file "outU.pgn" which you will rename

download from
http://komodochess.com/pub/40H-pgn-utilities/
It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change. -- Charles Darwin

User avatar
MikeGL
Posts: 858
Joined: Thu Sep 01, 2011 12:49 pm

Re: Chess Tools

Post by MikeGL » Fri Mar 30, 2018 5:46 pm

Nordlandia wrote:
MikeGL wrote:I think this is an easy one even for a newbie/hobbyist programmer like me, as long as the format of clock contains a suffix 's' just like the below sample
PGN, all the program needs to do is collect all those numbers then add them up.
It's vital to include base time as well. For example "[TimeControl "300+5"]" in the pgn header. And add that time in the calculation too.
You mean an output that's something like:

Code: Select all

[TimeControl "300+5"] 9777  9788  19,565
for each game where:
Total Time used by White: 9777s
Total Time used by Black: 9788s
Total for this game: 19,565s

or in HH:MM:SS format?
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.

User avatar
Nordlandia
Posts: 2270
Joined: Fri Sep 25, 2015 7:38 pm
Location: Sortland, Norway

Re: Chess Tools

Post by Nordlandia » Fri Mar 30, 2018 5:54 pm

Mike: i prefer HH:MM:SS format :)

User avatar
MikeGL
Posts: 858
Joined: Thu Sep 01, 2011 12:49 pm

Re: Chess Tools

Post by MikeGL » Fri Mar 30, 2018 6:00 pm

Nordlandia wrote:Mike: i prefer HH:MM:SS format :)
Would try and then post around this Sunday (Easter) or on Monday.
Time and skill constraints :)
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.

main line
Posts: 60
Joined: Thu Jul 07, 2016 8:15 pm

Re: Chess Tools

Post by main line » Fri Mar 30, 2018 8:23 pm

Yes my file is "mygames.pgn", but what is the folder name where I need put this file "mygames.pgn" ?

main line
Posts: 60
Joined: Thu Jul 07, 2016 8:15 pm

Re: Chess Tools

Post by main line » Fri Mar 30, 2018 8:30 pm

I downloaded it but when I press double click on trunkate.exe "command prompt" appears 0.1 second and gone and I can't put yours commands.
What is my mistake ? What do I do wrong?
Can you please tell me where I need put my file - games.pgn? in Document folder or in same folder where trunkate.exe is or maybe C:\Users\"My name" folder?

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

Re: Chess Tools

Post by Norm Pollock » Fri Mar 30, 2018 8:51 pm

main line wrote:I downloaded it but when I press double click on trunkate.exe "command prompt" appears 0.1 second and gone and I can't put yours commands.
What is my mistake ? What do I do wrong?
Can you please tell me where I need put my file - games.pgn? in Document folder or in same folder where trunkate.exe is or maybe C:\Users"My name" folder?
1. unzip the download "40H-PGN-xxxxxxxx".
2. in command window, go to the folder where truncate.exe is located.
3. in command window, copy "truncate.exe" to folder where you have pgn file games.pgn
(or if you prefer, copy games.pgn to folder where truncate.exe is located)
3. in the command window, execute the command
truncate games.pgn

truncate.exe works only in a command window. clicking, or double-clicking, on its icon in windows explorer will not get it to work. you have to enter a command in the command window.
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