Register
It is currently Thu Nov 27, 2014 12:19 pm

Script to Analyze EPD files using a UCI chess engine


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Mon Nov 21, 2011 12:14 pm   

Joined: Mon Nov 21, 2011 12:06 pm
Posts: 1
I am looking for a script that will do the following:

Take the name of an EPD file as an input
Use a UCI chess engine to analyze the EPD file and save the evaluation of the position back to the original EPD file

EPD file is a text file that looks like the following:

rnbq1rk1/pp2ppbp/3p1np1/2p5/2PPP3/2N2N2/PP2BPPP/R1BQK2R w KQ - ce 0
r1bqnrnk/pp4bp/2pp2p1/2PPppN1/1P2P3/2N1BP2/P3B1PP/2RQR1K1 w - - ce 0
1nb1qrk1/r4pbp/pp1p2p1/2pP4/P1P1PpP1/2NB1N1P/1P1Q1P2/R3K2R w KQ - ce 0
r1bq1rk1/ppn3b1/3p2np/2pPppp1/2P1P3/2N3PP/PP1B1P1N/R2QRBK1 w - - ce 0
r1b2r1k/p2nq1b1/2p3pp/2p1pp1n/N3P3/4BN1P/PPQ1BPP1/R2R2K1 w - - ce 0
r2q1rk1/pp2n1b1/2ppPnpp/4p3/1PP1p3/B1N2B2/P4PPP/R2QR1K1 w - - ce 0

the UCI protocol is found at: http://wbec-ridderkerk.nl/html/UCIProtocol.html

After analysis the above lines would look something like:

rnbq1rk1/pp2ppbp/3p1np1/2p5/2PPP3/2N2N2/PP2BPPP/R1BQK2R w KQ - ce 92
r1bqnrnk/pp4bp/2pp2p1/2PPppN1/1P2P3/2N1BP2/P3B1PP/2RQR1K1 w - - ce 23
1nb1qrk1/r4pbp/pp1p2p1/2pP4/P1P1PpP1/2NB1N1P/1P1Q1P2/R3K2R w KQ - ce 21
r1bq1rk1/ppn3b1/3p2np/2pPppp1/2P1P3/2N3PP/PP1B1P1N/R2QRBK1 w - - ce 22
r1b2r1k/p2nq1b1/2p3pp/2p1pp1n/N3P3/4BN1P/PPQ1BPP1/R2R2K1 w - - ce 26
r2q1rk1/pp2n1b1/2ppPnpp/4p3/1PP1p3/B1N2B2/P4PPP/R2QR1K1 w - - ce -24

(the evaluation numbers are made up of course)
The script should have a flag to allow setting the analysis ply depth or analysis time for each position.

An example of what the output of a UCI engine looks like in command line mode for the first string in the above file is below (my input in red)

Dave-Laptop:~ David$ /Applications/Stockfish/stockfish-211-64
Stockfish 2.1.1 64bit by Tord Romstad, Marco Costalba and Joona Kiiski
position fen rnbq1rk1/pp2ppbp/3p1np1/2p5/2PPP3/2N2N2/PP2BPPP/R1BQK2R w KQ - ce 75
go depth 11

info depth 1
info depth 1 seldepth 1 multipv 1 score cp 133 nodes 233 nps 4396 time 53 pv e1g1 c5d4 f3d4
info depth 2
info depth 2 seldepth 2 multipv 1 score cp 101 nodes 355 nps 6228 time 57 pv e1g1 b8c6
info depth 3
info depth 3 seldepth 3 multipv 1 score cp 88 nodes 761 nps 12898 time 59 pv e1g1 b8c6 d4d5
info depth 4
info depth 4 seldepth 4 multipv 1 score cp 80 nodes 1136 nps 18933 time 60 pv e1g1 b8c6 d4d5 c6b4
info depth 5
info depth 5 seldepth 5 multipv 1 score cp 84 nodes 2354 nps 12793 time 184 pv d4c5 d6c5 e1g1 b8c6 c1f4
info depth 6
info depth 6 seldepth 6 multipv 1 score cp 80 nodes 3472 nps 9807 time 354 pv d4c5 d6c5 e1g1 d8d1 f1d1 b8c6
info depth 7
info depth 7 seldepth 8 multipv 1 score cp 80 nodes 8644 nps 16126 time 536 pv d4c5 d6c5 e1g1 b8c6 c1e3 b7b6 e4e5 f6g4
info depth 8
info depth 8 seldepth 12 multipv 1 score cp 88 nodes 27138 nps 24165 time 1123 pv d4d5 c8d7 e1g1 d8b6 e4e5 f6g4 e5d6 b6d6
info depth 9
info depth 9 seldepth 12 multipv 1 score cp 88 nodes 38071 nps 24737 time 1539 pv d4d5 c8d7 e1g1 b8a6 c1d2 d8b6 d1b1 f6g4 h2h3 g4e5
info depth 10
info currmove d4c5 currmovenumber 2
info currmove e1g1 currmovenumber 3
info currmove c1d2 currmovenumber 4
info currmove f3g5 currmovenumber 5
info currmove a2a3 currmovenumber 6
info currmove e1f1 currmovenumber 7
info currmove a1b1 currmovenumber 8
info currmove e2f1 currmovenumber 9
info currmove h1f1 currmovenumber 10
info currmove h1g1 currmovenumber 11
info currmove e1d2 currmovenumber 12
info currmove b2b4 currmovenumber 13
info currmove f3g1 currmovenumber 14
info currmove d1b3 currmovenumber 15
info currmove d1a4 currmovenumber 16
info currmove c1e3 currmovenumber 17
info currmove f3d2 currmovenumber 18
info currmove f3h4 currmovenumber 19
info currmove h2h3 currmovenumber 20
info currmove g2g3 currmovenumber 21
info currmove c3b1 currmovenumber 22
info currmove d1d2 currmovenumber 23
info currmove e4e5 currmovenumber 24
info currmove c1g5 currmovenumber 25
info currmove d1d3 currmovenumber 26
info currmove b2b3 currmovenumber 27
info currmove c1f4 currmovenumber 28
info currmove g2g4 currmovenumber 29
info currmove e2d3 currmovenumber 30
info currmove c3b5 currmovenumber 31
info currmove f3e5 currmovenumber 32
info currmove h2h4 currmovenumber 33
info currmove c3a4 currmovenumber 34
info currmove a2a4 currmovenumber 35
info currmove c1h6 currmovenumber 36
info currmove c3d5 currmovenumber 37
info currmove d1c2 currmovenumber 38
info depth 10 seldepth 13 multipv 1 score cp 92 nodes 82364 nps 36884 time 2233 pv d4d5 c8d7 e1g1 b8a6 c1f4 f6h5 f4d2 d8b6 d1c1 g7d4 d2h6
info depth 11
info currmove d4d5 currmovenumber 1
info currmove d4c5 currmovenumber 2
info currmove e1g1 currmovenumber 3
info currmove f3g5 currmovenumber 4
info currmove c1d2 currmovenumber 5
info currmove h2h3 currmovenumber 6
info currmove c3a4 currmovenumber 7
info currmove e1f1 currmovenumber 8
info currmove e4e5 currmovenumber 9
info currmove d1d2 currmovenumber 10
info currmove e2f1 currmovenumber 11
info currmove h1f1 currmovenumber 12
info currmove h1g1 currmovenumber 13
info currmove e1d2 currmovenumber 14
info currmove c1f4 currmovenumber 15
info currmove f3g1 currmovenumber 16
info currmove c1e3 currmovenumber 17
info currmove c3b5 currmovenumber 18
info currmove a2a3 currmovenumber 19
info currmove g2g4 currmovenumber 20
info currmove c1g5 currmovenumber 21
info currmove e2d3 currmovenumber 22
info currmove b2b4 currmovenumber 23
info currmove d1d3 currmovenumber 24
info currmove f3d2 currmovenumber 25
info currmove f3e5 currmovenumber 26
info currmove d1b3 currmovenumber 27
info currmove b2b3 currmovenumber 28
info currmove h2h4 currmovenumber 29
info currmove a2a4 currmovenumber 30
info currmove c3b1 currmovenumber 31
info currmove d1a4 currmovenumber 32
info currmove g2g3 currmovenumber 33
info currmove a1b1 currmovenumber 34
info currmove c3d5 currmovenumber 35
info currmove c1h6 currmovenumber 36
info currmove d1c2 currmovenumber 37
info currmove f3h4 currmovenumber 38
info depth 11 seldepth 13 multipv 1 score cp 92 nodes 96680 nps 37633 time 2569 pv d4d5 c8d7 e1g1 b8a6 c1f4 f6h5 f4d2 d8b6 d1c1 g7d4 d2h6
info nodes 96680 nps 37633 time 2569
bestmove d4d5 ponder c8d7
quit


That _92_ is the value I would want to capture


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP