Chess Tools

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

Moderators: hgm, Rebel, chrisw

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

Re: Chess Tools

Post by main line »

:D Thank you very much
I got it.
I find in Start Menu\Programs\System Tools - Command promt.exe, click on it,
than in Command promt black window I see this:
C:\Users\"My name">
I copy "truncate.exe" and games.pgn to this folder (C:\Users\"My name"), rename games.pgn to alpha.pgn,
and
in the command window, execute the command :
truncate alpha.pgn 44
and all games lost moves after 22nd move.

I did like this because I don't know how to:
"in command window, go to the folder where truncate.exe is located."???
"in command window, copy "truncate.exe" to folder where you have pgn file games.pgn"???
Probably it's easy but I never do this so far :oops:
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Chess Tools

Post by Ras »

main line wrote:I did like this because I don't know how to:
"in command window, go to the folder where truncate.exe is located."???
In the command window, you first type "c:" or whichever drive you put truncate.exe to. Then, you use the "cd" command (change directory). "cd " brings you to the top of the directory structure in that drive. From there on, you can use "cd directoryname" to go into directories. Use the "tab" key for autocompletion. Use it multiple times if you have several directories starting with the same name.

The other method is to use a text batch file (some_name.bat) that contains the call to truncate.exe with the proper parameters, i.e. one line:
truncate alpha.pgn 44

Copy that batch file into the directory where truncate.exe is and copy your PGN with the name "alpha.pgn" into the same directory, using the Explorer.

You may want to add a second line in that batch file:
pause

"pause" will keep the text window open until you press a key so that you can see error messages from truncate.exe.

You can click the .bat file in the Explorer without opening a command window.
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Chess Tools

Post by MikeGL »

MikeGL wrote:
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?
Nordlandia wrote:Mike: i prefer HH:MM:SS format :)
Here's the CLI utility:
http://www.mediafire.com/file/pa0y0as66m56i1j/clkc.exe

Coded in C under Win32. File I/O is raw and unbuffered but I think it's good enough.
Needs to be verified if this compile would work on Win64 versions.
Run like so:

Code: Select all

clkc [InputPGN]  [OutputFile]
MikeGL wrote:
Nordlandia wrote:Is there any existing tools that can calculate total game duration based on pgn clock information?

Code: Select all

[Event "CCRL 40/40"]
[Site "CCRL"]
[Date "2005.12.25"]
[Round "1.1.28"]
[White "Fritz 9"]
[Black "Gandalf 6"]
[Result "1/2-1/2"]
[ECO "D95"]
[Opening "Gruenfeld"]
[Variation "Botvinnik variation"]
[PlyCount "140"]
[WhiteElo "2742"]
[BlackElo "2632"]

1. d4 {0s} Nf6 {0s} 2. c4 {0s} g6 {0s} 3. Nc3 {0s} d5 {0s} 4. Nf3 {0s} Bg7 {0s}
5. e3 {0s} O-O {0s} 6. Qb3 {0s} e6 {0s} 7. Bd2 {0s} b6 {Both last book move 0s}
8. Be2 {+0.20/12 116s} c5 {+0.25/12 245s} 9. O-O {(dxc5) +0.12/12 120s} Nc6
{+0.12/12 83s} 10. cxd5 {(dxc5) +0.30/12 107s} exd5 {+0.06/12 116s} 11. Rac1
{(Bb5) +0.15/12 177s} Bg4 {-0.03/12 76s} 12. Rfd1 {(Qa4) +0.18/12 137s} cxd4
{-0.09/11 194s} 13. Nxd4 {+0.01/14 139s} Nxd4 {+0.00/14 160s} 14. exd4
{+0.00/15 93s} Bxe2 {+0.00/14 103s} 15. Nxe2 {+0.01/15 109s} Re8 {+0.00/14
103s} 16. Nc3 {(Nf4) +0.01/14 81s} Qd7 {-0.06/13 103s} 17. Nb5 {(Re1) +0.04/15
392s} Rac8 {+0.00/13 102s} 18. Bf4 {(Rxc8) +0.04/14 133s} Rxc1 {+0.00/12 103s}
19. Rxc1 {+0.05/13 72s} Rc8 {+0.00/13 98s} 20. Rxc8+ {+0.08/14 73s} Qxc8
{+0.00/13 26s} 21. h3 {(Nxa7) +0.00/14 136s} Nh5 {(Qf5) +0.00/14 107s} 22. Be3
{+0.19/15 115s} Qd7 {+0.09/16 107s} 23. Qa4 {(Nc3) +0.63/16 181s} f5 {+0.00/14
107s} 24. Qa6 {(Bd2) +0.59/15 85s} f4 {+0.06/15 96s} 25. Bd2 {+0.09/15 131s}
Qe8 {(h6) +0.28/14 577s} 26. a4 {(Nxa7) +0.65/14 197s} h6 {+0.32/13 59s} 27.
Nxa7 {+0.61/13 82s} Bxd4 {+0.09/12 79s} 28. Qc8 {+0.32/13 69s} Kf8 {+0.16/13
65s} 29. Kf1 {+0.30/13 94s} Bxb2 {+0.03/12 91s} 30. Bb4+ {+0.32/14 129s} Kf7
{+0.09/12 92s} 31. Qb7+ {+0.37/13 64s} Kg8 {+0.16/13 230s} 32. Qxd5+ {+0.35/13
65s} Kh7 {(Kh8) +0.00/13 93s} 33. Nb5 {+0.14/14 137s} Bg7 {+0.00/14 80s} 34.
Bd2 {(Bd6) +0.14/14 77s} Nf6 {+0.00/14 61s} 35. Qd3 {(Qf3) +0.06/14 87s} Nh5
{(Qe5) +0.00/15 58s} 36. Kg1 {(Qd5) +0.19/14 65s} Qe7 {(Qg8) +0.00/13 37s} 37.
Bc3 {(Qd5) +0.20/13 43s} Qe6 {(Bxc3) +0.06/13 70s} 38. Bxg7 {+0.36/13 44s} Nxg7
{+0.00/14 39s} 39. Kh2 {(Nc7) +0.48/13 39s} Qe1 {(Qf6) +0.06/14 50s} 40. Qd4
{+0.51/14 46s} f3 {+0.00/14 40s} 41. gxf3 {+0.39/14 69s} Nf5 {+0.00/15 90s} 42.
Qd7+ {+0.41/14 86s} Kg8 {+0.00/14 99s} 43. Qc8+ {(Qd8+) +0.30/14 118s} Kf7
{+0.00/14 437s} 44. Qc2 {(Qc7+) +0.41/13 84s} Qe5+ {+0.00/13 80s} 45. Kg2
{+0.44/13 72s} Nh4+ {+0.00/12 94s} 46. Kf1 {+0.32/14 152s} Qa1+ {(Kg7) +0.00/12
180s} 47. Ke2 {+0.23/13 88s} Qe5+ {(Ng2) +0.00/12 109s} 48. Qe4 {+0.45/13 83s}
Qb2+ {+0.00/12 120s} 49. Kd3 {+0.39/13 100s} Qb1+ {(Qxf2) +0.00/12 160s} 50.
Kc3 {(Kc4) +0.37/14 87s} Qa1+ {(Qc1+) +0.00/12 112s} 51. Kb3 {(Kd2) +0.21/14
114s} Qd1+ {+0.00/12 252s} 52. Kb4 {(Kb2) +0.32/14 214s} Qd2+ {(Nxf3) +0.00/11
81s} 53. Nc3 {(Kb3) +0.38/14 217s} Qb2+ {(Qxf2) +0.19/12 608s} 54. Kc4
{+0.46/11 6s} Nf5 {(Qxf2) +0.19/13 138s} 55. Qd5+ {(Qb7+) +0.46/13 116s} Ke7
{+0.22/12 59s} 56. Qb7+ {(Qc6) +0.45/13 127s} Kf8 {+0.22/12 42s} 57. Qc8+
{(Qc6) +0.32/13 111s} Kf7 {+0.19/13 36s} 58. Qd7+ {+0.31/13 67s} Ne7 {+0.12/12
51s} 59. Ne4 {+0.26/14 135s} g5 {+0.03/12 87s} 60. Nd6+ {(Qd4) +0.31/13 95s}
Kf6 {+0.00/12 51s} 61. Ne8+ {(Kd3) +0.21/13 55s} Kf7 {+0.00/13 42s} 62. Nc7
{(Nd6+) +0.00/13 61s} Qe5 {+0.00/12 48s} 63. Qe8+ {(Kb4) +0.01/13 62s} Kg7
{+0.00/13 29s} 64. Qd8 {(Qd7) +0.00/13 87s} Kg6 {+0.00/11 39s} 65. Kb3 {(Qe8+)
+0.01/13 82s} Qe2 {+0.00/10 39s} 66. Qe8+ {(Qd6+) +0.00/13 82s} Kg7 {+0.00/13
29s} 67. Qd7 {+0.00/14 102s} Qxf3+ {+0.00/12 55s} 68. Kb4 {+0.00/14 118s} Qe2
{+0.00/12 48s} 69. Qd4+ {+0.00/13 107s} Kh7 {+0.00/12 38s} 70. Qxb6 {+0.00/13
100s} Qb2+ {Draw accepted +0.00/12 39s} 1/2-1/2
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: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Chess Tools

Post by Nordlandia »

Mike: how do i run the tool :?:

Please show example!
User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Chess Tools

Post by Nordlandia »

Try determine game duration of this pgn ->

Code: Select all

[Event "?"]
[Site "?"]
[Date "2018.03.31"]
[Round "?"]
[White "stockfish_18033101_x64_modern"]
[Black "komodo-11.3.1-64bit"]
[Result "1/2-1/2"]
[FEN "r4rk1/1p2pp1p/2bp2pb/2n5/1pP1P3/1P3P2/P1Q1B1PP/2R2RK1 w - - 0 1"]
[GameEndTime "2018-03-31T11:43:26.559 W. Europe Daylight Time"]
[GameStartTime "2018-03-31T10:50:51.239 W. Europe Daylight Time"]
[PlyCount "97"]
[SetUp "1"]
[Termination "adjudication"]
[TimeControl "900+15"]

1. Qb1 {+1.58/35 61s} Ra3 {-0.93/30 31s} 2. Rc2 {+1.73/34 18s}
Be3+ {-0.93/31 36s} 3. Kh1 {+2.23/30 9.9s} Rfa8 {-0.94/31 42s}
4. Rd1 {+1.44/33 34s} h5 {-0.95/31 37s} 5. Bf1 {+1.83/30 17s} Bg5 {-0.96/31 70s}
6. g3 {+1.59/34 88s} h4 {-0.94/30 51s} 7. Bg2 {+1.77/29 9.3s}
hxg3 {-1.15/30 72s} 8. hxg3 {+1.96/30 15s} Bf6 {-1.19/30 49s}
9. Kh2 {+2.00/32 49s} Kg7 {-1.18/31 151s} 10. Rf2 {+2.01/29 15s}
Bc3 {-0.83/28 37s} 11. f4 {+1.51/33 78s} Rh8+ {-0.84/28 35s}
12. Kg1 {+2.29/27 8.2s} Raa8 {-0.86/28 31s} 13. Re2 {+1.67/32 143s}
Rh7 {-0.80/28 27s} 14. Qc2 {+1.73/29 43s} Rah8 {-0.81/31 49s}
15. a3 {+1.69/28 14s} Rh2 {-0.82/28 17s} 16. Kf1 {+1.67/32 66s}
Ne6 {-0.82/27 23s} 17. axb4 {+1.41/32 30s} Bxb4 {-0.88/29 50s}
18. Rd5 {+1.75/30 29s} f6 {-0.72/28 34s} 19. Qb2 {+1.89/27 23s}
Kf7 {-0.65/27 33s} 20. Rb5 {+2.55/27 7.6s} Bxb5 {-0.68/27 40s}
21. cxb5 {+2.67/29 16s} Kg7 {-0.70/29 33s} 22. e5 {+2.59/31 28s}
dxe5 {-0.51/28 40s} 23. fxe5 {+2.81/32 11s} f5 {-0.42/29 26s}
24. Bxb7 {+2.87/32 35s} R2h3 {-0.21/31 41s} 25. Qc2 {+2.47/35 39s}
Nd4 {-0.24/29 29s} 26. Qc4 {+2.54/35 21s} Nxe2 {-0.30/29 28s}
27. Qxb4 {+1.73/39 151s} Nxg3+ {-0.32/28 25s} 28. Ke1 {+0.90/36 101s}
e6 {-0.24/28 20s} 29. Bg2 {+0.85/35 41s} Rh2 {-0.35/30 25s}
30. Kf2 {+0.89/31 14s} Ne4+ {-0.22/30 29s} 31. Kg1 {+0.88/32 10s}
R2h5 {-0.34/30 39s} 32. Qa3 {+0.95/34 30s} Re8 {-0.25/29 18s}
33. b6 {+0.16/37 83s} Rhh8 {-0.21/32 15s} 34. b7 {+0.16/34 27s}
Rb8 {0.00/33 14s} 35. Qa7 {+0.14/35 7.4s} Ng5 {-0.11/31 18s}
36. Qe3 {+0.14/37 18s} Ne4 {-0.11/32 35s} 37. Qa7 {+0.14/36 9.0s}
Ng5 {-0.06/29 12s} 38. Qe3 {+0.15/37 32s} Ne4 {-0.08/32 13s}
39. Qb6 {+0.14/36 9.9s} Rhf8 {-0.07/30 20s} 40. Qc7+ {+0.07/38 11s}
Kh6 {-0.03/32 12s} 41. Bf1 {+0.07/36 19s} f4 {-0.02/31 19s}
42. Qc6 {0.00/37 17s} Ng5 {0.00/32 14s} 43. b4 {0.00/35 6.0s} Kh5 {0.00/33 14s}
44. b5 {0.00/38 11s} Rbd8 {0.00/33 15s} 45. b8=Q {0.00/41 8.2s}
Rxb8 {0.00/38 12s} 46. Qh1+ {0.00/46 8.7s} Kg4 {0.00/39 13s}
47. Qg2+ {0.00/50 21s} Kh4 {0.00/41 14s} 48. Qh2+ {0.00/52 50s}
Kg4 {0.00/39 23s} 49. Qg2+ {0.00/59 27s, Draw by adjudication} 1/2-1/2

User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: Chess Tools

Post by Ovyron »

MikeGL wrote:Nice pun. Sounds like "I Query" which is what the adapter really does.
Gotta love serendipities like that :)

I've noticed that when set to 10 seconds/move Aiquiri will play most of them in 8 (because both engines agree on a move), I wonder if in a time control with that average it'd be able to increase its performance as 20% of its time accumulates, or if lone engines would play fast anyway so it'll be 20% of a fraction of a second to not make a difference.
Your beliefs create your reality, so be careful what you wish for.
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Chess Tools

Post by MikeGL »

Nordlandia wrote:Try determine game duration of this pgn ->

Code: Select all

[Event "?"]
[Site "?"]
[Date "2018.03.31"]
[Round "?"]
[White "stockfish_18033101_x64_modern"]
[Black "komodo-11.3.1-64bit"]
[Result "1/2-1/2"]
[FEN "r4rk1/1p2pp1p/2bp2pb/2n5/1pP1P3/1P3P2/P1Q1B1PP/2R2RK1 w - - 0 1"]
[GameEndTime "2018-03-31T11:43:26.559 W. Europe Daylight Time"]
[GameStartTime "2018-03-31T10:50:51.239 W. Europe Daylight Time"]
[PlyCount "97"]
[SetUp "1"]
[Termination "adjudication"]
[TimeControl "900+15"]

1. Qb1 {+1.58/35 61s} Ra3 {-0.93/30 31s} 2. Rc2 {+1.73/34 18s}
Be3+ {-0.93/31 36s} 3. Kh1 {+2.23/30 9.9s} Rfa8 {-0.94/31 42s}
4. Rd1 {+1.44/33 34s} h5 {-0.95/31 37s} 5. Bf1 {+1.83/30 17s} Bg5 {-0.96/31 70s}
6. g3 {+1.59/34 88s} h4 {-0.94/30 51s} 7. Bg2 {+1.77/29 9.3s}
hxg3 {-1.15/30 72s} 8. hxg3 {+1.96/30 15s} Bf6 {-1.19/30 49s}
9. Kh2 {+2.00/32 49s} Kg7 {-1.18/31 151s} 10. Rf2 {+2.01/29 15s}
Bc3 {-0.83/28 37s} 11. f4 {+1.51/33 78s} Rh8+ {-0.84/28 35s}
12. Kg1 {+2.29/27 8.2s} Raa8 {-0.86/28 31s} 13. Re2 {+1.67/32 143s}
Rh7 {-0.80/28 27s} 14. Qc2 {+1.73/29 43s} Rah8 {-0.81/31 49s}
15. a3 {+1.69/28 14s} Rh2 {-0.82/28 17s} 16. Kf1 {+1.67/32 66s}
Ne6 {-0.82/27 23s} 17. axb4 {+1.41/32 30s} Bxb4 {-0.88/29 50s}
18. Rd5 {+1.75/30 29s} f6 {-0.72/28 34s} 19. Qb2 {+1.89/27 23s}
Kf7 {-0.65/27 33s} 20. Rb5 {+2.55/27 7.6s} Bxb5 {-0.68/27 40s}
21. cxb5 {+2.67/29 16s} Kg7 {-0.70/29 33s} 22. e5 {+2.59/31 28s}
dxe5 {-0.51/28 40s} 23. fxe5 {+2.81/32 11s} f5 {-0.42/29 26s}
24. Bxb7 {+2.87/32 35s} R2h3 {-0.21/31 41s} 25. Qc2 {+2.47/35 39s}
Nd4 {-0.24/29 29s} 26. Qc4 {+2.54/35 21s} Nxe2 {-0.30/29 28s}
27. Qxb4 {+1.73/39 151s} Nxg3+ {-0.32/28 25s} 28. Ke1 {+0.90/36 101s}
e6 {-0.24/28 20s} 29. Bg2 {+0.85/35 41s} Rh2 {-0.35/30 25s}
30. Kf2 {+0.89/31 14s} Ne4+ {-0.22/30 29s} 31. Kg1 {+0.88/32 10s}
R2h5 {-0.34/30 39s} 32. Qa3 {+0.95/34 30s} Re8 {-0.25/29 18s}
33. b6 {+0.16/37 83s} Rhh8 {-0.21/32 15s} 34. b7 {+0.16/34 27s}
Rb8 {0.00/33 14s} 35. Qa7 {+0.14/35 7.4s} Ng5 {-0.11/31 18s}
36. Qe3 {+0.14/37 18s} Ne4 {-0.11/32 35s} 37. Qa7 {+0.14/36 9.0s}
Ng5 {-0.06/29 12s} 38. Qe3 {+0.15/37 32s} Ne4 {-0.08/32 13s}
39. Qb6 {+0.14/36 9.9s} Rhf8 {-0.07/30 20s} 40. Qc7+ {+0.07/38 11s}
Kh6 {-0.03/32 12s} 41. Bf1 {+0.07/36 19s} f4 {-0.02/31 19s}
42. Qc6 {0.00/37 17s} Ng5 {0.00/32 14s} 43. b4 {0.00/35 6.0s} Kh5 {0.00/33 14s}
44. b5 {0.00/38 11s} Rbd8 {0.00/33 15s} 45. b8=Q {0.00/41 8.2s}
Rxb8 {0.00/38 12s} 46. Qh1+ {0.00/46 8.7s} Kg4 {0.00/39 13s}
47. Qg2+ {0.00/50 21s} Kh4 {0.00/41 14s} 48. Qh2+ {0.00/52 50s}
Kg4 {0.00/39 23s} 49. Qg2+ {0.00/59 27s, Draw by adjudication} 1/2-1/2

The above program I uploaded only works on the PGN sample I provided, but on your PGN with a lot of messy data, this clkc.exe balks on the
header and cannot process it. Some minor tweaks needs to be done.

But I noticed that the total consumed time was already provided on your header:


[GameEndTime "2018-03-31T11:43:26.559 W. Europe Daylight Time"]
[GameStartTime "2018-03-31T10:50:51239 W. Europe Daylight Time"]


11:43:26 minus 10:50:51 = Is already the number you are looking for.
So I think the clkc.exe is moot and redundant on your PGN header.

But if you still need this tool, I will tweak and re-upload once time permits.
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: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Chess Tools

Post by Nordlandia »

The issue is that i have to do the calculation to get the precise time.

"[GameEndTime "2018-03-31T11:43:26.559 W. Europe Daylight Time"]
[GameStartTime "2018-03-31T10:50:51239 W. Europe Daylight Time"]"

It's open for discussion on cutechess github page.

https://github.com/cutechess/cutechess/issues/374

In the meantime this calculator work. https://www.timecalculator.net/
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Chess Tools // patcher for hardwired piece values

Post by MikeGL »

Ferdy wrote:You may describe here the chess tools/utilities that you need. If I have time and knowledge, I may create it. Or other programmers may also do it.
It can be FEN, EPD, and PGN processing, engine use, website scraping, data analysis and others.
SF, in my opinion, is not as flexible as other engines. Unlike TheKing, Critter,
Komodo, your engine Deuterium, and other engines where the user can freely set piece
values and other engine constants within engine config (UCI options).
On the other hand, these values were hardcoded in SF. True, I can change SF source and
recompile. But for mere mortals like me, recompiling is a heavy task.
Would be nice if there's a GUI patcher for official SF9 version where the
user can edit all those hardcoded piece values to tune SF engine for ones
taste.

For instance, I would like SF9 to always play NxP every time it has the
opportunity, so I would just set knight value equal to pawn. Ok I
made it weaker, but for me it would be a fun experience playing it, and would still be difficult to defeat .

Also, these patcher can tune SF piece values for those with extra time on their hands.
If I remember correctly, Critter programmer also built a similar GUI patcher around 7 years or 10 years ago.
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.
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Chess Tools

Post by MikeGL »

Nordlandia wrote:The issue is that i have to do the calculation to get the precise time.

"[GameEndTime "2018-03-31T11:43:26.559 W. Europe Daylight Time"]
[GameStartTime "2018-03-31T10:50:51239 W. Europe Daylight Time"]"

It's open for discussion on cutechess github page.

https://github.com/cutechess/cutechess/issues/374

In the meantime this calculator work. https://www.timecalculator.net/
Visited your github link, seems this problem was quickly resolved by pros.
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.