Code examples of saving evaluations

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
mhalstern
Posts: 484
Joined: Wed Nov 18, 2009 12:09 am

Code examples of saving evaluations

Post by mhalstern » Wed Nov 25, 2009 3:03 am

I have a lot of ideas and intend to have code save evaluations and proposed continuations to a file. Some of the challenges will how much information is relevant to output, and how to output not too verbosely, but to have a parser or a program translate the information.

Here is an example:

My engine defines open files and gives a certain positive value to having a Rook on an open file. In a position, cxb5 is a legal move that would result in the C1 rook being on an open file. Assuming this analysis would meet criteria that would save it, I would want to specifically output that factor and the score that it added to the total evaluation.

The goal is to be able to look at the game logs and see what factors were involved in critical evaluations. If I only output the evaluations, then it is my job to look at the positions and figure this out myself. Are there code examples of this being done neatly?

Thanks

bob
Posts: 20916
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: Code examples of saving evaluations

Post by bob » Wed Nov 25, 2009 6:18 am

mhalstern wrote:I have a lot of ideas and intend to have code save evaluations and proposed continuations to a file. Some of the challenges will how much information is relevant to output, and how to output not too verbosely, but to have a parser or a program translate the information.

Here is an example:

My engine defines open files and gives a certain positive value to having a Rook on an open file. In a position, cxb5 is a legal move that would result in the C1 rook being on an open file. Assuming this analysis would meet criteria that would save it, I would want to specifically output that factor and the score that it added to the total evaluation.

The goal is to be able to look at the game logs and see what factors were involved in critical evaluations. If I only output the evaluations, then it is my job to look at the positions and figure this out myself. Are there code examples of this being done neatly?

Thanks
I don't go too far, but in crafty, there is a "score" command, and I can tell it to execute this command after every move in a real game. The output looks like this:

Code: Select all

note: scores are for the white side
                        +-----------white----------+-----------black----------+
material.......   0.05  |    comp     mg      eg   |    comp     mg      eg   |
pawns..........   0.21  |    0.38    0.36    0.48  |   -0.17   -0.14   -0.32  |
passed pawns...   0.00  |    0.00    0.00    0.00  |    0.00    0.00    0.00  |
knights........   0.13  |    0.31    0.31    0.31  |   -0.18   -0.18   -0.18  |
bishops........  -0.43  |    0.00    0.00    0.00  |   -0.43   -0.40   -0.58  |
rooks..........  -0.15  |    0.05    0.06    0.01  |   -0.20   -0.23   -0.11  |
queens.........   0.05  |    0.02    0.02    0.02  |    0.03    0.03    0.03  |
kings..........  -0.20  |   -0.33   -0.32   -0.40  |    0.13    0.07    0.40  |
development....   0.00  |    0.00    0.00    0.00  |    0.00    0.00    0.00  |
pawn races.....   0.00  +--------------------------+--------------------------+
total..........  -0.34
the "comp" is the composite score interpolated between the MG and EG scores. I give them for black and white, for major categories. This doesn't result in excessive logfile growth yet lets me look for some scoring component that seems out of whack with reality.

mhalstern
Posts: 484
Joined: Wed Nov 18, 2009 12:09 am

Re: Code examples of saving evaluations

Post by mhalstern » Wed Nov 25, 2009 1:19 pm

Thank you,

I'll look at some Crafty Source Code.

Post Reply