Not logged inRybka Chess Community Forum
Up Topic Rybka Support & Discussion / Rybka Discussion / Chess Engine Output
- - By gmeiner [us] Date 2015-04-09 00:38
I am a research assistant for an economics professor at Brigham Young University.
We are working on a game theory project and hoping to use chess to draw data for empirical justification.

We are amateur players, both under or around 2000, and have only basic knowledge of how chess engines work. We realize chess engines operate by move calculation and provide a score to each position and potential move for whether white or black is winning in pawn increments.

There must be some characteristics or patterns of the position which engines are using to construct these scores. (Because the only other way to get a score would be to solve the game completely).

We are looking for chess engine output which includes such scores for the characteristics and patterns in addition to the overall score.

Could anyone help us find an engine where such output is available or can you point us in the right direction?

We appreciate any help you can give us.
Parent - - By Banned for Life (Gold) Date 2015-04-09 01:30 Edited 2015-04-09 01:34
Chess engines have a component that performs static evaluation on a position. This is used in conjunction with a search of large tree of positions that can be reached from the current positions to play chess.

You can use the free, GPL (open source) chess engine Stockfish to get evaluations by running from the console, and using the command "eval". For example, the output from the starting position is shown below:

You can enter other chess positions, using FEN notation, and perform static eval on them as well. Finally, since Stockfish is open source, it's also not hard to modify it to feed it a large number of FEN positions, rather than entering them at the console.
Parent - - By gmeiner [us] Date 2015-04-11 16:13
This was really helpful, thanks for the reply.

It wasn't obvious to me how to interpret the output from Stockfish. Are there scores for the different characteristics in that output?
Parent - - By Banned for Life (Gold) Date 2015-04-11 16:24
There are scores in the table for MG (middle game) and EG (end game) for each side for each characteristic (material, imbalance, ..., space). The MG and EG values are blended by a formula available in the code. This is the opening position and the engine hasn't run yet, so the first three categories haven't been evaluated yet. The 0.07 (seven centepawns) value at the end is the value Stockfish gives to white being on move (i.e. one tempo).
Parent - - By gmeiner [us] Date 2015-04-12 16:14
There is an explanation for why I made such an idiotic reply last time, but it's not worth it.

This was remarkably helpful to getting us started. Much appreciated.
Parent - - By Banned for Life (Gold) Date 2015-04-12 21:14
No problem. I use modified variants of SF to help with my CC. My daughter is currently an undergrad student at BYU. I wish you the best of luck with your project.
Parent - - By gmeiner [us] Date 2015-04-14 18:29
Okay, so I figured out a little bit.

I don't know how similar running Stockfish is to Python.
What I'd like to do is write a script that enters moves one at a time (it looks like I'd need SAN notation which is fine), gets the evaluation for each position, then prints the evaluations to a .txt file or something.  I can bring that txt into Stata and clean it as needed.

In python I could write this in .txt, save it as .py and run it from the command window. Is such a script possible for stockfish?
Parent - By user923005 (****) [us] Date 2015-04-14 19:27
Here is what you want to do:
Format the moves you are interested as a pgn game.  This is the standard format for chess data.
For now, let's call the file pgn.pgn
Convert the pgn game to Epd with pgn2fen from here:
http://www.7sun.com/chess/
use it like this:
pgn2fen pgn.pgn -e -l > pgn.epd

Now you have a file of chess positions, which can be analyzed one at a time.
feed these positions to Stockfish.
You can use the stockfish bench command to do it.
You can also use a GUI to manage it such as Arena.

I suspect that you might find python tools to help you if you are more comfortable with python.  I would check on github.

HTH
Parent - - By Banned for Life (Gold) Date 2015-04-15 02:08
The post above mine has some excellent suggestions. But rather than using the bench command, which would be easy to do but wouldn't give you the detailed evaluation information you are seeking, you need to make use of the Stockfish eval command. I'm not a scripts guy, but here's what I think you would want to do:

1) Convert the games from pgn to fen, as suggested above.
2) Generate a fen file which uses Stockfish from the console and alternately feeds one fen, and then calls the Stockfish eval function, and pipes the output to a text file.
3) Repeat for each fen.

There are people that could do this in five minutes. I'm a little embarrassed to say I'm not one of them...
Parent - - By user923005 (****) [us] Date 2015-04-15 03:57
Eval does not do any search.  I doubt if that is what the OP wants (it is not even a zero depth search, which would be a quiescent search).
Of course, I could be wrong about it.

The bench command will write to a log file, if you choose a few versions back.
I modify the versions I use to write a detailed log file.
Parent - By Banned for Life (Gold) Date 2015-04-15 05:01
Eval does not do any search.

The Stockfish eval UCI command provides the static eval, which of course does not involve search.

I doubt if that is what the OP wants (it is not even a zero depth search, which would be a quiescent search).

My impression, based on the following, was that this was precisely what they wanted. But I could also be wrong about this.

There must be some characteristics or patterns of the position which engines are using to construct these scores. (Because the only other way to get a score would be to solve the game completely).

The 'patterns of the position' are, in my opinion, in the domain of the static eval.

The bench command will write to a log file, if you choose a few versions back.
I modify the versions I use to write a detailed log file.


Or the output of the bench command can be piped to a file. I have modified the bench defaults to more closely mimic the longer time controls I am interested in, without having to enter parameters each time.
Parent - - By lcfb [br] Date 2017-09-01 16:55
Do you know if Rybka or Houdini has the same or similar command like "eval" from stockfish to retrieve the score of a position?
Parent - - By Banned for Life (Gold) Date 2017-09-10 09:16
I do not remember Rybka having this command, or even being able to trick it into providing this output. I'm less sure about whether Houdini would provide this information as a zero depth search. Unfortunately, I don't have the most recent version of Houdini to test...
Parent - - By Eelco de Groot (***) Date 2017-09-12 18:43
There was a time before decompilers were in use, that commercial chess programmers would go to great lengths to hide this sort of information because it could be valuable to the competition, especially when everyone was on a deadline for Christmas. That is why Vas built in the practical joke that you had to give Rybka 1.0 Beta a 'go depth -3' command to get depth 0. It was discovered after half an hour I believe. That is what you get with free software that is stronger than anything you could buy. Vas of course knew everyone would be wanting to take it apart. He had not really anything to hide (It was more like an Easter Egg).

It is not really the same as the eval command because it will do a quiescence search if static eval is below or equal alpha. What alpha is on the beginning of the search probably depends on whether you want to hide te static eval again, if that really is the programmers goal to make things difficult.
Parent - By Sesse (****) [no] Date 2017-09-14 16:04
It's definitely not the same as eval, because eval in Stockfish will show a breakdown of the static eval into different parts :-)

/* Steinar */
Up Topic Rybka Support & Discussion / Rybka Discussion / Chess Engine Output

Powered by mwForum 2.27.4 © 1999-2012 Markus Wichitill