To get the EPD predicted variation is GradualTest the best option?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Alex64
Posts: 10
Joined: Fri May 15, 2020 7:54 pm
Full name: Alex Toma

To get the EPD predicted variation is GradualTest the best option?

Post by Alex64 »

I have tried to use GradualTest 2.6 to analyse different EPD files (some with few hundreds FENs). I want to get the pv=predicted variation just to verify the solutions of tactical puzzles or get best plans in strategical type of positions according to the engine. The tool is old and could not find the author, Mr. Odd Gunnar Malin, anywhere to kindly ask for some help. I find the tool awesome, but it works flawless only with Crafty (the old stable 25.2 version). Anything else I tried I could get only partial results. For example Stockfish 11 runs like half of a file with 300 FENs when suddenly crash and stop analyzing further, despite the positions are legal and could not find any reason for failure. Other UCI new engines on same test crash on other positions. "Fire" engine runs all... but give me only the bm=best move and not the pv. When running UCI engines I use the instructions from the tool and make an "eng" file with full path for the engine location and a separate batch file to run it and I don't know where I do any mistake. Maybe I do not know to run the new engines with this tool, or the tool does not support the new engines.

If Gradualtest is not my best option is there any other tool that will do the job? I want to mention that I want to get the pv in short notation (SAN).
Ideally would be a tool that the output from the engine analysis would be a PGN with FENs instead of games and the chess moves (the solutions) would be numbered, but I guess this tool does not exist yet.

Any suggestions?
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Dann Corbit »

It is very hard to get what you want.
There are programs that will analyze an EPD record and decorate it with the analysis like Chess Assistant, but it is a commercial program and the format is a little strange.

I have modified stockfish based programs to write their analysis to disk. So to use them, I run the benchmark command giving whatever memory, threadcount, and other useful UCI parameters. I read the analysis that I wrote to disk with another program which writes out the analyzed EPD records. That program is called prse and it has some parameters to let me collect many rows of analysis or just the top row of analysis. I pipe the output of this program to another program that writes stored procedure calls and I pipe the output of this program to a program that runs the stored procedure calls in order to populate my database.

It's not exactly what you want and it only works with :
Stockfish
Mikes stockfish variants like Bluefish XI-LP FD
Sting

This idea can be adapted to other SF based programs like Corchess, Sugar, etc. but it takes programming work to do it.

I also have a routine to read arena logs and create analysis from that, but it is not very reliable and you have to check the results very carefully because Arena can become disconnected from the position it is analyzing and start writing really strange stuff into the log.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Dann Corbit »

The Windows version of the Shredder GUI was also able to create decorated EPD when analyzing, but the Linux version does not do it, and I do not know it the Windows version can still do that because I have not tried it in a long time
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Alex64
Posts: 10
Joined: Fri May 15, 2020 7:54 pm
Full name: Alex Toma

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Alex64 »

Thank you for the prompt replies.... so I should stick to GradulaTest with Crafty cause it does the "decorated EPD". :D
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Dann Corbit »

You can get my modified programs, including source code, if you like.
But they are command line tools, and you might not like using them.

You would only need the modified engines and the program called prse which eats the log file the engine writes and converts it into decorated EPD.
I suggest you might possibly like the fuss and bother of it, because SF has a higher Elo than Crafty (depending on what you want to do with the data).
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Alex64
Posts: 10
Joined: Fri May 15, 2020 7:54 pm
Full name: Alex Toma

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Alex64 »

I can give a try to use your tools, exactly cause SF is a much stronger engine than Crafty. For analyzing tactical puzzles Crafty should suffice, however for positional type of analysis SF would be a far better choice. The predicted variation in such positions would be similar to the best plan (I know, the plan that a computer would execute, but often is good for humans either).

I wonder even I let Crafty to think double or triple time than SF, it might not be enough to compensate for the ELO difference, or it requires much more time... (something similar to the infinite monkey theorem if you use even worse engines, are they ever able to compensate weakness with time?). Well, this idea can be experimented by making a tournament between those two engines and find the minimum time handicap that Crafty needs to beat SF on the same machine. :P This could be another interesting topic...

Unfortunately I am not a programmer, so using your tools it should work for me only if I get an example and the steps to follow... then I can open Notepad++ and modify it to adjust the path and names of the files I have in my computer, modify a batch file. GradualTest is also demanding such manual tasks. Maybe run something inside the Windows Powershell or some Phyton command without much understanding it, if this is what you mean by using command lines. If it is more complicated than that, I might say "pass", but still should be worthy for other people that watch this thread and would give a try to your tools and solution.

So far I could find similar attempts to find the bm when analyzing an EPD file, not the pv. I can see you have been involved in this project:
http://rebel13.nl/download/tsc.html
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Dann Corbit »

Can you tell me what your processor is? I need to know this so that I can compile for the proper instruction set and also know how many threads it has.
I am assuming you run Windows, is that right? If not is it Linux? I can't compile for a Mac, but if you need that maybe something could be arranged.
I will try to construct a batch file that will simply do everything for you but I need to know how modern your processor is.
It would also be helpful to know how much memory is on your machine.

If you have windows and you type SET from the command prompt you will see (among other things) these:
Platform=x64
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=2d07
Which help explain what your CPU is.
You can also get a program called CPU-Z which will describe your CPU.

I guess you don't need these, but some of the projects are GPL so I should provide them:
Modified Sting with source code, make files, etc.

Modified Stockfish with source code, make files, etc:

Modified Bluefish with source code, make files, etc (if you use the makefile, you can build other versions):


This is probably what you want here, it has binaries and batch files:

I don't use it like this, but I made something that should be easy to use.

Here is what is in it:

Code: Select all

File:                         Purpose:
------------------------- ------------------------------
ana-all-30.bat           analyze all positions in file epd.epd to depth 30 with all engines
ana-all.bat                Analyze all positions in file epd.epd for a duration of 60 seconds with all engines and give the top analysis row for each position
ana-bl.epd                Analyzed EPD (created by blue) from running ana-blue-30.bat      
ana-blue-30.bat        Analyze all positions in file epd.epd for a depth of 30 plies with Blue and give the top analysis row for each position
ana-blue.bat             Analyze all positions in file epd.epd for a duration of 60 seconds with blue
ana-sf-30.bat            Analyze all positions in file epd.epd for a depth of 30 plies with stockfish
ana-sf.bat                 Analyze all positions in file epd.epd for a duration of 60 seconds with stockfish
ana-sf.epd                 Analyzed EPD (created by stockfish) from running ana-sf-30.bat
ana-st.epd                Analyzed EPD (created by sting) from running ana-st-30.bat
ana-sting-30.bat       Analyze all positions in file epd.epd for a depth of 30 plies with sting
ana-sting.bat            Analyze all positions in file epd.epd for 60 seconds with sting
bench.txt                 An input file used by  two of the batch processes.
bench30.txt             An input file used by  two of the batch processes.  
Bluefish-FD-XI.exe    Mike's Stockfish variant which is especially good at finding tricky tactical solutions
crlf.txt                     An input for batch processes
epd.epd                   The input file used by the batch processes.  You will copy the file you want to analyze in the exe folder and give it this name.
prse.exe                   Used by batch processes, it parses the log files and writes legal EPD.  There will be a lot of EPD records with low depth.
                                This process combines the EPD record with the analysis and optionally filters unwanted records.
root.epd                   Used by the batch files.  I had to make this file because I process the data differently
SearchLog.txt            This is a sample log file written by Stockfish and Blue
sl.epd                        This is something I forgot to delete ;-)
sting-sf-21.exe          This is the sting program
StingLog.txt               This is the log from the sting program (I change the original format)
stockfish-x64-mingw.exe  This is my customized SF binary.
Caveats:
1) No warranties expressed or implied.
2)The executables assume that your CPU has sse instructions. It if is newer than 1999 it probably has them, but I can make new binaries if you don't
3)Blue makes 3 rows for each input row with the same depth, so you get duplicated output when using 30 plies depth
4)sting makes odd output in top row only format which causes the last row in the batch to go missing

How to use it:
Expand the archive exe.7z using 7-zip or some other compatible archive tool.
Using file manager, copy the EPD file that you want to analyze into the exe folder over top of epd.epd
Run one of the batch files. Almost always, you probably want to run ana-sf-30.bat or ana-sf.bat. Run the others if it is a tricky test set and SF did not find the solution.
The stockfish batch files will create the file ana-sf.epd .
The sample input file looks like this:

Code: Select all

3rr3/5pk1/5q1p/1p1P4/1P3P1P/3Q4/5PB1/R5K1 w - -
rn1q1rk1/pbp2pp1/1p2pb1p/8/2BP4/P1N1PN2/1P3PPP/R2Q1RK1 w - -
The sample Stockfish output looks like this:

Code: Select all

3rr3/5pk1/5q1p/1p1P4/1P3P1P/3Q4/5PB1/R5K1 w - - acd 30; ce -121; acs 206; acn 1471000; pv Rd1 Qxf4 Qxb5 Qg4 Qd3 Qxb4 Qg3+ Kf8 Rd3 Rd6 Rf3 Rb6 Qc7 Qe1+ Kh2 Qe5+ Qxe5 Rxe5 Rc3 Ke8 Bf3 Kd7 Kg3 Re1 h5 Rg1+ Kf4 Rb4+ Ke3 Re1+ Kd2 Re8 Kc2 Rf4 Kd2 ; bm Rd1;
rn1q1rk1/pbp2pp1/1p2pb1p/8/2BP4/P1N1PN2/1P3PPP/R2Q1RK1 w - - acd 30; ce 40; acs 271; acn 1706000; pv e4 c5 d5 Bxc3 bxc3 exd5 exd5 Nd7 Be2 Nf6 c4 b5 Rb1 a6 Qc2 Re8 Rfd1 Rb8 cxb5 Bxd5 Bc4 Be4 Rxd8 Bxc2 Rxe8+ Nxe8 Rc1 axb5 Be2 Be4 Nd2 Nf6 Nxe4 Nxe4 f3 Nf6 Rxc5 b4 axb4 Rxb4 ; bm e4;
It is possible to change the time or change the depth to other values.
If you give this a try, I can help you make progress from there.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Alex64
Posts: 10
Joined: Fri May 15, 2020 7:54 pm
Full name: Alex Toma

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Alex64 »

I have Windows 10 (64 bit)... AMD Phenom II X4 B95 and 16 GB RAM. If you make a batch file that runs on Win10 (64bit) would not be good enough to run on any other computer with same OS assuming the CPU is not too old (has those sse instructions)? I'll give a feedback after trying your tools. Thank you!
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Dann Corbit »

I had the threads set too high for your machine (at what I thought would be a conservative 6). The new batch files use 4:
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Alex64
Posts: 10
Joined: Fri May 15, 2020 7:54 pm
Full name: Alex Toma

Re: To get the EPD predicted variation is GradualTest the best option?

Post by Alex64 »

Is have tested only the ana-sf.bat and the tool works like a charm! I can see that this file refers to the bench.txt file:

Code: Select all

bench 8192 4 60000 epd.epd movetime
quit
I could understand comparing with the version you resent after knowing my CPU that "4" stands for the number of the threads to use and "60000" means 60 seconds per move. So it is easy to modify those parameters according to needs. What is "8192"? I guess it is optimum setting - half of the RAM (from 16 GB I said I have installed)... right?

I tested for 1 sec per move, just to see it is working. So far all is perfect! I will try later a long task.

What will be in future when newer SF versions will be released? Do you regularly post your modified SF versions anywhere like GitHub or this forum? Is it hard to learn what to modify in the SF source-code?