A question about a program to analyze pgn

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

Moderators: hgm, Rebel, chrisw

Dan Astrachan
Posts: 134
Joined: Fri May 28, 2010 11:07 am

Re: A question about a program to analyze pgn

Post by Dan Astrachan »

Uri Blass wrote:Is there is a program that I can use to analyze some pgn file in order to give me to think only about the positions when one side did a significant mistake?

The idea is that I can define what is a significant mistake(for example at least 0.5 pawns) and how much time to give the engine that I choose(stockfish) to analyze every position in the pgn to define the mistakes.
This is exactly what Scid's "Annotate" feature is for. I made a screencast for someone who asked exactly for the same thing as you. All instructions here => http://www.talkchess.com/forum/viewtopi ... 753#561753

:)
Computer used: Intel Core i7 875K @ 2.93GH, 4 cores, 12 Gb of RAM
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: A question about a program to analyze pgn

Post by Uri Blass »

Thanks
It seems that the instruction can help me to annotate games automatically but the question is if I can also get the positions when one side blundered without the best move in order to think about them by myself.
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: A question about a program to analyze pgn

Post by phenri »

Uri Blass wrote:Thanks
It seems that the instruction can help me to annotate games automatically but the question is if I can also get the positions when one side blundered without the best move in order to think about them by myself.
With some GUI (LucasChess, Fritz, perhaps Scidvspc and scid, etc) you can do this if you tick the training option when you check blunders
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: A question about a program to analyze pgn

Post by phenri »

Even with many GUI you can hide/unhide commentary (training mode)
User avatar
vittyvirus
Posts: 646
Joined: Wed Jun 18, 2014 2:30 pm
Full name: Fahad Syed

Re: A question about a program to analyze pgn

Post by vittyvirus »

Scid is perfect for this job
Jesse Gersenson
Posts: 593
Joined: Sat Aug 20, 2011 9:43 am

Re: A question about a program to analyze pgn

Post by Jesse Gersenson »

You can check my posts. I wrote a simple bash script a few weeks ago which does much of what you want and you could add in the fen extract bit and the simple math to set a move variance score.

It outputs data in this format:
13 Qb6 -0.14 -0.07
13 Kh1 0.13 -0.01
14 c5 -0.08 0.05
14 Ba2 -0.2 -0.28
15 Rac8 0.18 -0.02
15 dxc5 -0.42 -0.24
16 Qa6 -0.13 -0.55
16 Nb5 0.03 -0.1
17 Nxc5 -0.58 -0.55
17 Qe2 -0.34 -0.92
18 Kg7 -0.48 -0.82
18 e4 0.28 -0.2
19 fxe4 -0.29 -0.01
19 fxe4 -1.04 -1.33
20 Ncxe4 1.1 0.06
20 Bf4 -1.01 0.09
21 Rfe8 1.01 0
21 Qf3 -1.24 -0.23
22 Re7 1.21 -0.03
22 Qh3 -1.08 0.13
23 Rce8 1.04 -0.04
23 Be3 -1.05 -0.01
24 Ng3+ 0.13 -0.92
24 hxg3 0.13 0.26
25 Rxe3 0.12 0.25
25 Nc7 0.12 0.24
26 Qb6 0.12 0.24
26 Nxe8+ 0.11 0.23
27 Rxe8 0.11 0.22
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: A question about a program to analyze pgn

Post by Ferdy »

Uri Blass wrote:To be more specific I am interested in thinking by myself about the israeli chess championship games but not about every position(I have no time for it) but only about the positions when players did significant mistakes.

You can download the games in the following link

http://www.theweekinchess.com/chessnews ... ships-2014

Possible output that I would like to have is list of fen for all the positions when players did mistakes of at least 0.5 pawns(without best move)
when I simply think about diagram number 1 and later about diagram number 2 and later about diagram number 3...
and only after thinking about diagrams from the same game compare the move that I choose with the best move or the game move.

Of course if the evaluation is already +3.5 and a move drops the evaluation to 2.8 then it is not interesting so I would like to have only positions when the evaluation is smaller than 1.5 pawn advantage for one side before the move or after the move.
I get interested on this but using games from Philippine National Championships just held recently also.
I tried Fritz 13, but it has its own way of creating tactics positions even though you allowed to blunder check at 50 cp, and its format should also be in cb.

So here is what I tried, convert the pgn to epd lines using pgn2fen program, the output is like below, then create a python script to analyze those positions following some criteria that you specified, like 50cp minimum blunder threshold, and position should not be an obvious loss or win, by some threshold too.

Code: Select all

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQk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k1/pp2npbp/2p3p1/3pp3/4P3/3P1NP1/PPPN1PBP/R1BQ1RK1 w - - fmvn 8; hmvc 1; pm Qe2;
rnbq1rk1/pp2npbp/2p3p1/3pp3/4P3/3P1NP1/PPPNQPBP/R1B2RK1 b - - fmvn 8; hmvc 2; pm Qc7;
rnb2rk1/ppq1npbp/2p3p1/3pp3/4P3/3P1NP1/PPPNQPBP/R1B2RK1 w - - fmvn 9; hmvc 3; pm b4;
rnb2rk1/ppq1npbp/2p3p1/3pp3/1P2P3/3P1NP1/P1PNQPBP/R1B2RK1 b - - fmvn 9; hmvc 0; pm dxe4;
rnb2rk1/ppq1npbp/2p3p1/4p3/1P2p3/3P1NP1/P1PNQPBP/R1B2RK1 w - - fmvn 10; hmvc 0; pm dxe4;
rnb2rk1/ppq1npbp/2p3p1/4p3/1P2P3/5NP1/P1PNQPBP/R1B2RK1 b - - fmvn 10; hmvc 0; pm f6;
rnb2rk1/ppq1n1bp/2p2pp1/4p3/1P2P3/5NP1/P1PNQPBP/R1B2RK1 w - - fmvn 11; hmvc 0; pm Qc4+;
rnb2rk1/ppq1n1bp/2p2pp1/4p3/1PQ1P3/5NP1/P1PN1PBP/R1B2RK1 b - - fmvn 11; hmvc 1; pm Kh8;
rnb2r1k/ppq1n1bp/2p2pp1/4p3/1PQ1P3/5NP1/P1PN1PBP/R1B2RK1 w - - fmvn 12; hmvc 2; pm a4;
rnb2r1k/ppq1n1bp/2p2pp1/4p3/PPQ1P3/5NP1/2PN1PBP/R1B2RK1 b - - fmvn 12; hmvc 0; pm b6;
rnb2r1k/p1q1n1bp/1pp2pp1/4p3/PPQ1P3/5NP1/2PN1PBP/R1B2RK1 w - - fmvn 13; hmvc 0; pm Ba3;
rnb2r1k/p1q1n1bp/1pp2pp1/4p3/PPQ1P3/B4NP1/2PN1PBP/R4RK1 b - - fmvn 13; hmvc 1; pm a6;
[...]
The fmvn is the full move number, while the pm is the predicted move. That pm is the move played by the player.

Here is some sample output of the script, these positions are from chisr14.pgn

Code: Select all

rq2rb1k/7p/pn3pp1/Qb2p3/1P2P3/B1R2NP1/2P2PBP/R5K1 w - - fmvn 26; hmvc 7; pm Bf1; c0 "pm ce -72"; bm a3b2; c1 "bm ce -6"; c2 "atms 5000"; c3 "engine sf5";
r3rb1k/1q5p/p4pp1/Q3p3/1PN1P3/B1nB2P1/2P2P1P/R5K1 b - - fmvn 30; hmvc 4; pm Nxe4; c0 "pm ce 66"; bm e8b8; c1 "bm ce 143"; c2 "atms 5000"; c3 "engine sf5";
rr4k1/1nqbbppp/3p1n2/pp1Pp1B1/2p1P3/2P2NNP/PPB2PP1/R2QR1K1 w - - fmvn 17; hmvc 0; pm Nh4; c0 "pm ce -91"; bm d1d2; c1 "bm ce -22"; c2 "atms 5000"; c3 "engine sf5";
rr4k1/1nqbbppp/3p1n2/pp1Pp1B1/2p1P2N/2P3NP/PPB2PP1/R2QR1K1 b - - fmvn 17; hmvc 1; pm g6; c0 "pm ce 20"; bm f6d5; c1 "bm ce 91"; c2 "atms 5000"; c3 "engine sf5";
4r3/3br2k/3p2pp/pp1P1p2/2pBnQ1P/2P5/PP4PK/4R3 b - - fmvn 33; hmvc 5; pm Rg8; c0 "pm ce -221"; bm g6g5; c1 "bm ce -5"; c2 "atms 5000"; c3 "engine sf5";
6r1/3br2k/3p2pp/pp1P1p2/2pBnQ1P/2P5/PP2R1PK/8 b - - fmvn 36; hmvc 11; pm Rge8; c0 "pm ce -252"; bm g8f8; c1 "bm ce -88"; c2 "atms 5000"; c3 "engine sf5";
The script is appending these comments once a position is within the criteria.

Code: Select all

c0 "pm ce -72"; bm a3b2; c1 "bm ce -6"; c2 "atms 5000"; c3 "engine sf5";
Take sample 1.
[d]rq2rb1k/7p/pn3pp1/Qb2p3/1P2P3/B1R2NP1/2P2PBP/R5K1 w - -

Code: Select all

pm Bf1; c0 "pm ce -72"; bm a3b2; c1 "bm ce -6"; c2 "atms 5000"; c3 "engine sf5";
In this position the player played Bf1. I let sf analyzed this for 5 sec or "atms 5000" atms = analysis time millisec, and sf liked it with bm a3b2 with "bm ce of -6", ce = centipawn evaluation. But if Bf1 is played sf scored it at "pm ce -72", so -6 - (-72) = 66 cp hence this position is saved by the script. Those ce analysis figures can vary with analysis time, num threads and other factors of course.
Here is the sample script run. It will ask for the epd file, with fmvn, and pm, then ask some uci engine options.

Code: Select all

Please enter epd file to process: chisr14.epd
The filename of output file is  analysis-chisr14.epd

Please enter engine file name: sf5

Please enter search time in milli seconds: 5000

Please enter number of positions to analyze and saved: 6

Please enter hash size in mb: 64

Please enter number of Threads: 1

Analysing positions, please wait ...

This pos is skipped, fmvn is below 12
[...]
analyzing for saving pos  1
bestmove  a2a4
[...]
analyzing for saving pos  6
bestmove  e2e4

Done!!, number of positions analyzed and saved:  6
You can save the above script output as epd, then load it in arena gui (I use 3.5). Enable epd display list, and enable also the epd show in separate window. Once separated it is now convenient to hide and show the pm and bm from the epd list window. You may arrange as well the main window displaying the position on the board.
Let me know if you need the script, it requires installation of python in windows os.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: A question about a program to analyze pgn

Post by Ferdy »

Sample setup on arena with epd.
Image
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: A question about a program to analyze pgn

Post by phenri »

Ferdy wrote: Let me know if you need the script, it requires installation of python in windows os.
Ferdinand thank you for your offer, its always good to have a alternative.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: A question about a program to analyze pgn

Post by Ferdy »

phenri wrote:
Ferdy wrote: Let me know if you need the script, it requires installation of python in windows os.
Ferdinand thank you for your offer, its always good to have a alternative.
Scid vs PC has feature to analyze, but it has different way of flagging a tactical position, not as Uri wants it to be.