Chess Game Analyzer

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.
Post Reply
IGarcia
Posts: 543
Joined: Mon Jul 05, 2010 8:27 pm

Re: Chess Game Analyzer

Post by IGarcia » Sun Jul 31, 2016 3:09 pm

Hello

Thanks for great tool.

I managed to make it work in linux by commenting out the lines #535, #763, #820 as gbtami (Bajusz Tamás) mentioned


Still seems it not work for a game not starting from initial position, as an example, the following game cant be analyzed:

Code: Select all


[Event ""]
[Site ""]
[Date ""]
[Round ""]
[White ""]
[Black ""]
[Result "0-1"]
[FEN "8/3R1pk1/1p4p1/p2P4/5R1P/1r2r1PK/8/8 w - - 0 1"]

1.Rfxf7+ Kg8 2.Rg7+ Kf8 3.Rxg6 a4 4.Rb7 a3 5.d6 a2 6.Rh6 Kg8 7.d7 Rxg3+ 8.
Kh2 Rh3+ 9.Kg2 Rbg3+ 10.Kf2 Rf3+ 11.Ke2 Re3+ 12.Kd2 Rd3+ 13.Ke2 Rxd7 14.
Rb8+ Kg7 15.Rhxb6 a1=Q  0-1

Probably is not hard to implement a initial setup and make your analyzer even better.
Thanks any way.

Ignacio.

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

Re: Chess Game Analyzer

Post by Ferdy » Sun Jul 31, 2016 3:32 pm

IGarcia wrote:Hello

Thanks for great tool.

I managed to make it work in linux by commenting out the lines #535, #763, #820 as gbtami (Bajusz Tamás) mentioned


Still seems it not work for a game not starting from initial position, as an example, the following game cant be analyzed:

Code: Select all


[Event ""]
[Site ""]
[Date ""]
[Round ""]
[White ""]
[Black ""]
[Result "0-1"]
[FEN "8/3R1pk1/1p4p1/p2P4/5R1P/1r2r1PK/8/8 w - - 0 1"]

1.Rfxf7+ Kg8 2.Rg7+ Kf8 3.Rxg6 a4 4.Rb7 a3 5.d6 a2 6.Rh6 Kg8 7.d7 Rxg3+ 8.
Kh2 Rh3+ 9.Kg2 Rbg3+ 10.Kf2 Rf3+ 11.Ke2 Re3+ 12.Kd2 Rd3+ 13.Ke2 Rxd7 14.
Rb8+ Kg7 15.Rhxb6 a1=Q  0-1

Probably is not hard to implement a initial setup and make your analyzer even better.
Thanks any way.

Ignacio.
Thanks for the info. I will check that game.

Could you post your command line in linux?

I have linux mint installed in VM, I will try it.

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

Re: Chess Game Analyzer

Post by Ferdy » Sun Jul 31, 2016 3:51 pm

IGarcia wrote:Still seems it not work for a game not starting from initial position, as an example, the following game cant be analyzed:

Code: Select all

[Event ""]
[Site ""]
[Date ""]
[Round ""]
[White ""]
[Black ""]
[Result "0-1"]
[FEN "8/3R1pk1/1p4p1/p2P4/5R1P/1r2r1PK/8/8 w - - 0 1"]

1.Rfxf7+ Kg8 2.Rg7+ Kf8 3.Rxg6 a4 4.Rb7 a3 5.d6 a2 6.Rh6 Kg8 7.d7 Rxg3+ 8.
Kh2 Rh3+ 9.Kg2 Rbg3+ 10.Kf2 Rf3+ 11.Ke2 Re3+ 12.Kd2 Rd3+ 13.Ke2 Rxd7 14.
Rb8+ Kg7 15.Rhxb6 a1=Q  0-1
Probably is not hard to implement a initial setup and make your analyzer even better.
Thanks any way.

Ignacio.
Works fine in windows.

Code: Select all

[Event ""]
[Site ""]
[Date ""]
[Round ""]
[White ""]
[Black ""]
[Result "0-1"]
[FEN "8/3R1pk1/1p4p1/p2P4/5R1P/1r2r1PK/8/8 w - - 0 1"]
[Annotator "Stockfish 120716 64 POPCNT (0.300s/pos, thread=1, blunder_margin=15cp)"]

1. Rfxf7+ Kg8 2. Rg7+ Kf8 3. Rxg6 a4 4. Rb7 a3 5. d6 a2 6. Rh6 Kg8 7. d7 Rxg3+ 8. Kh2 $8 Rh3+ 9. Kg2 $8 Rbg3+ 10. Kf2 $8 Rf3+ 11. Ke2 Re3+ 
12. Kd2 $4 $0 {Black will mate white in 10 moves} ({Excellent is} 12.Kf2 $1 Ref3+ 13.Kg2 Rfg3+ 14.Kf2 Rd3 15.Rg6+ $10 {+0.00/14}) Rd3+ $8 13. Ke2 
13... Rxd7 $6 $19 {-3.65/13} ({Excellent is} 13...a1=Q $1 {with mate attack} 14.Rg6+ Kf8 15.Rb8+ Kf7 16.d8=N+ Kxg6 17.Rxb6+ Kh7 18.Rh6+ Kxh6 19.Nf7+ Kh5 20.Ng5 Qd1+ 21.Kf2 Rh2# $0) 
({ Another interesting line is } 13...Rhe3+ 14.Kf2 a1=Q 15.Rg6+ Kf8 16.Rg8+ Kxg8 $19 {-55.03/16}) 
({White is threatening} 13... -- 14.Re6 Rxd7 15.Rxd7 Rh2+ 16.Kf3 Rh3+ 17.Kg4 $18 {+45.18/21}) 
14. Rb8+ $4 $19 {-11.46/13} ({A good alternative line is} 14.Rg6+ Kf8 15.Rb8+ Ke7 16.Rg1 Rd6 17.Ra8 $17 {-2.51/10}) 
({Black is threatening mate in 8 with} 14. -- 14...Rxb7 15.Rg6+ Rg7 16.Re6 Rg2+ 17.Kf1 Rb2 18.Re8+ Kf7 19.Re2 Rh2 20.Re7+ Kxe7 21.Kg1 a1=Q#) Kg7 15. Rhxb6 a1=Q 0-1
Command line in batch file I use.

Code: Select all

game_analyzer_v38.py --file "problematic_pgn_to_ga.pgn" ^
--engine "stockfish_120716_x64_modern.exe" ^
--eoption "Hash value 128, Threads value 1" ^
--movetime 300 --startmove 8 --endmove 80 ^
--blundermargincp 15 --bookfile "book.bin" --outfile "out1-problematic_pgn_to_ga.pgn"

IGarcia
Posts: 543
Joined: Mon Jul 05, 2010 8:27 pm

Re: Chess Game Analyzer

Post by IGarcia » Sun Jul 31, 2016 4:36 pm

the command i use is:

Code: Select all

python game_analyzer_v38.py --file "game.pgn" --engine "stockfish" --eoption "Hash value 256, Threads value 8" --movetime 3000   --blundermargincp 35 --bookfile "book.bin" --outfile "anagames.pgn"
the error I get is:

Code: Select all

hess Game Analyzer v38

No handlers could be found for logger "chess.pgn"

Game 1

FEN: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Player move: a4
Traceback (most recent call last):
  File "game_analyzer_v38.py", line 1390, in <module>
    main&#40;sys.argv&#91;1&#58;&#93;)
  File "game_analyzer_v38.py", line 1196, in main
    f.write&#40;'%d. %s  &#123;%+0.2f/%d&#125;' %&#40;fmvn, game_node.board&#40;).san&#40;next_node.move&#41;,  gameMoveValue, gameMoveDepth&#41;)
UnboundLocalError&#58; local variable 'gameMoveDepth' referenced before assignment


Edit: Also tried a more similar to your options and I get same error as before: (adding startmove and endmove, 128 hash, less movetime)

Code: Select all


python game_analyzer_v38.py --file "game.pgn" --engine "stockfish" --eoption "Hash value 128, Threads value 8" --movetime 2000  --startmove 8 --endmove 80  --blundermargincp 15 --bookfile "book.bin" --outfile "anagames.pgn"

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

Re: Chess Game Analyzer

Post by Ferdy » Sun Jul 31, 2016 6:15 pm

I am able to run it in linux without error, when commenting out the p.stdin.close() as suggested by Bajusz Tamás.

Even this,

Code: Select all

&#91;Event ""&#93; 
&#91;Site ""&#93; 
&#91;Date ""&#93; 
&#91;Round ""&#93; 
&#91;White ""&#93; 
&#91;Black ""&#93; 
&#91;Result "0-1"&#93; 
&#91;FEN "8/3R1pk1/1p4p1/p2P4/5R1P/1r2r1PK/8/8 w - - 0 1"&#93; 

1.Rfxf7+ Kg8 2.Rg7+ Kf8 3.Rxg6 a4 4.Rb7 a3 5.d6 a2 6.Rh6 Kg8 7.d7 Rxg3+ 8. 
Kh2 Rh3+ 9.Kg2 Rbg3+ 10.Kf2 Rf3+ 11.Ke2 Re3+ 12.Kd2 Rd3+ 13.Ke2 Rxd7 14. 
Rb8+ Kg7 15.Rhxb6 a1=Q  0-1 
also works without problem.





Regarding the following could you post the game.pgn? as referenced here --file "game.pgn"
the command i use is:

Code: Select all

python game_analyzer_v38.py --file "game.pgn" --engine "stockfish" --eoption "Hash value 256, Threads value 8" --movetime 3000   --blundermargincp 35 --bookfile "book.bin" --outfile "anagames.pgn"
the error I get is:

Code: Select all

hess Game Analyzer v38

No handlers could be found for logger "chess.pgn"

Game 1

FEN&#58; rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Player move&#58; a4
Traceback &#40;most recent call last&#41;&#58;
  File "game_analyzer_v38.py", line 1390, in <module>
    main&#40;sys.argv&#91;1&#58;&#93;)
  File "game_analyzer_v38.py", line 1196, in main
    f.write&#40;'%d. %s  &#123;%+0.2f/%d&#125;' %&#40;fmvn, game_node.board&#40;).san&#40;next_node.move&#41;,  gameMoveValue, gameMoveDepth&#41;)
UnboundLocalError&#58; local variable 'gameMoveDepth' referenced before assignment

User avatar
PeterO
Posts: 120
Joined: Sun Jul 31, 2016 4:35 pm

Re: Chess Game Analyzer

Post by PeterO » Mon Aug 01, 2016 5:21 pm

Great tool!

My native language is german. Is it possible to change the comments?
As far as I have seen there are just a few sentences. So I would change: "Better is" to "Besser ist:".

Peter

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

Re: Chess Game Analyzer

Post by Ferdy » Tue Aug 02, 2016 4:07 am

PeterO wrote:Great tool!

My native language is german. Is it possible to change the comments?
As far as I have seen there are just a few sentences. So I would change: "Better is" to "Besser ist:".

Peter
Try to translate the following comment the ones inside the {}.

Code: Select all

BAD_COMMENT = &#123;'Not good is',
               'But not',
               'Bad is',
               'Inferior is',
               'Not reliable is',
               'Incorrect is',
               'Unsatisfactory is'
               &#125;

Code: Select all

REASON_COMMENT = &#123;'due to',
                  'in view of',
                  'thanks to',
                  'considering',
                  'on the grounds of',
                  'because of',
                  'for the reason that',
                  &#125;

Code: Select all

GOOD_COMMENT = &#123;1&#58; 'A nice try could be',
                2&#58; 'Better is',
                3&#58; 'More accurate is',
                4&#58; 'Superior is',
                5&#58; 'Excellent is'
                &#125;

Code: Select all

ALTERNATIVE_COMMENT = &#123;'Also playable is',
               'Another interesting line is',
               'One that deserves attention is',
               'A good alternative is',
               'Also sufficient is',
               'Worthy of consideration is',
               'Also practical is',
               'A fine line worth of consideration is',
               'Also capable is',
               'Also promising is',
               'Another modest line is',
               'Another possiblity is',
               'A good one too is',
               'Not to be underestimated is'
               &#125;
Then I will just add an option

Code: Select all

--lang german
Default is english when --lang is not defined.

User avatar
PeterO
Posts: 120
Joined: Sun Jul 31, 2016 4:35 pm

Re: Chess Game Analyzer

Post by PeterO » Tue Aug 02, 2016 1:34 pm

Bad_Commant: 'Nicht gut ist',

'Aber nicht ',

'Schlecht ist ',

'Schwächer ist ',

'Nicht zuverlässig ist ',

'Inkorrekt ist ',

'Unzulänglich ist ',




Reason_Commant: 'Wegen ',

'In Anbetracht von ',

'Aufgrund von ',

'Berücksichtigt ',

'Mit der Begründung ',

'Infolge von ',

'Aus dem einfachen Grund ',




Good_Comment: 'Ein guter Versuch wäre ',

'Besser ist ',

'Akkurater ist ',

'Viel besser ist ',

'Exzellent ist ',




Alternative_Comment: 'Ebenso spielbar ist ',

'Ein interessanter Zug ist ',

'Beachtung verdient auch ',

,Eine gute Alternative ist ',

'Ausreichend ist auch ',

'Eine Überlegung wert ist auch ',

'Spielbar ist auch ',

'Vielversprechend erscheint auch ',

'Ausreichend ist auch ',

'Chancenreich erscheint ',

'Ein anderer solider Zug ist ',

'Eine andere Möglichkeit ist ',

'Gut wäre auch ',

'Nicht zu unterschätzen ist ',

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

Re: Chess Game Analyzer

Post by Guenther » Tue Aug 02, 2016 1:59 pm

Hello Peter,

I think I have a few improvements:

Bad_Comment:

Code: Select all

'Nicht zuverlässig ist ',
=> 'Ungeeignet ist'

'Inkorrekt ist ',
=> 'Ungenau ist'
Good_Comment:

Code: Select all

'Akkurater ist ',
=> 'Genauer ist'
All other comments look good to me.

User avatar
PeterO
Posts: 120
Joined: Sun Jul 31, 2016 4:35 pm

Re: Chess Game Analyzer

Post by PeterO » Tue Aug 02, 2016 2:02 pm

Fine! Yes - its better.
I tried to make it as fast as possible

:D

Peter

Post Reply