Crafty's - alternative move storage[pgn]

Discussion of chess software programming and technical issues.

Moderator: Ras

jhaglund
Posts: 173
Joined: Sun May 11, 2008 7:43 am

Crafty's - alternative move storage[pgn]

Post by jhaglund »

Dear Readers,

I am working on a new pgn generating fuction/program for Crafty.

Basically, I made two of each log_file(log.nnn), log_filename, log, logpath, etc., and put it with history_file(game.nnn) also.

I want to use something like this:

fprintf(pgn_file, "%s\n", searched_line);

Coming up with "searched_line" is trouble-some for me. Crafty's output && search are way to big for me to study.

I don't want it to be "best_search_line" that is displayed in the log.nnn. I need ALL the moves searched for every ply.

It has to be pretty simple though, I just cannot find or figure which variable(s)... to output to file.

Please help,

Joshua
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty's - alternative move storage[pgn]

Post by bob »

jhaglund wrote:Dear Readers,

I am working on a new pgn generating fuction/program for Crafty.

Basically, I made two of each log_file(log.nnn), log_filename, log, logpath, etc., and put it with history_file(game.nnn) also.

I want to use something like this:

fprintf(pgn_file, "%s\n", searched_line);

Coming up with "searched_line" is trouble-some for me. Crafty's output && search are way to big for me to study.

I don't want it to be "best_search_line" that is displayed in the log.nnn. I need ALL the moves searched for every ply.

It has to be pretty simple though, I just cannot find or figure which variable(s)... to output to file.

Please help,

Joshua
Have you looked at "annotate.c" which probably has everything you need...
jhaglund
Posts: 173
Joined: Sun May 11, 2008 7:43 am

Re: Crafty's - alternative move storage[pgn]

Post by jhaglund »

No, but thanks Bob for pointing me to "annotate.c". It does save me some time it looks like.

However, "annotate" reads stored files already in pgn format. This only stores the moves in the game.001... to "game.001.can

I would like to generate/store all the moves searched(evals) by Crafty in PGN format, with -N, N being all the nodes for every PV for every ply. I need the search tree-> stored in PGN format

annotate game.001 w 1 -.5 10 -N

to make it search all of them I doubled the first moves...
game.001

e4
e4
d4
d4
c4
c4
Nf3
Nf3
Nc3
Nc3
a3
a3
a4
a4
b3
b3
b4
b4
c3
c3
d3
d3
e3
e3
f3
f3
f4
f4
g3
g3
g4
g4
h3
h3
h4
h4
Na3
Na3
Nh3
Nh3

12-> 0.97 0.17 1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e6 4. d4
Bb4 5. Bd3 Bxc3+ 6. bxc3 d5 7. exd5
exd5

13-> 2.48 0.27 1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e5 4. d4
exd4 5. Nxd4 Bb4 6. Nxc6 Bxc3+ 7. bxc3
dxc6 8. Qxd8+ Kxd8


I am looking to get each full variation and everyone inbetween to output to file like:

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "unknown"]
[WhiteElo ""]
[Black "Crafty 22.7"]
[BlackElo ""]
[Result "*"]
[Annotator "Crafty v22.7"]

1. e4 *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "unknown"]
[WhiteElo ""]
[Black "Crafty 22.7"]
[BlackElo ""]
[Result "*"]
[Annotator "Crafty v22.7"]

1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e5 4. d4 exd4 5. Nxd4 Bb4 6. Nxc6 Bxc3+ 7. bxc3 dxc6 8. Qxd8+ Kxd8 *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "unknown"]
[WhiteElo ""]
[Black "Crafty 22.7"]
[BlackElo ""]
[Result "*"]
[Annotator "Crafty v22.7"]

1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e6 4. d4 Bb4 5. Bd3 Bxc3+ 6. bxc3 d5 7. exd5 exd5*

I will continue to look at "annotate.c"...

Joshua
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty's - alternative move storage[pgn]

Post by bob »

jhaglund wrote:No, but thanks Bob for pointing me to "annotate.c". It does save me some time it looks like.

However, "annotate" reads stored files already in pgn format. This only stores the moves in the game.001... to "game.001.can

I would like to generate/store all the moves searched(evals) by Crafty in PGN format, with -N, N being all the nodes for every PV for every ply. I need the search tree-> stored in PGN format

annotate game.001 w 1 -.5 10 -N

to make it search all of them I doubled the first moves...
game.001

e4
e4
d4
d4
c4
c4
Nf3
Nf3
Nc3
Nc3
a3
a3
a4
a4
b3
b3
b4
b4
c3
c3
d3
d3
e3
e3
f3
f3
f4
f4
g3
g3
g4
g4
h3
h3
h4
h4
Na3
Na3
Nh3
Nh3

12-> 0.97 0.17 1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e6 4. d4
Bb4 5. Bd3 Bxc3+ 6. bxc3 d5 7. exd5
exd5

13-> 2.48 0.27 1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e5 4. d4
exd4 5. Nxd4 Bb4 6. Nxc6 Bxc3+ 7. bxc3
dxc6 8. Qxd8+ Kxd8


I am looking to get each full variation and everyone inbetween to output to file like:

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "unknown"]
[WhiteElo ""]
[Black "Crafty 22.7"]
[BlackElo ""]
[Result "*"]
[Annotator "Crafty v22.7"]

1. e4 *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "unknown"]
[WhiteElo ""]
[Black "Crafty 22.7"]
[BlackElo ""]
[Result "*"]
[Annotator "Crafty v22.7"]

1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e5 4. d4 exd4 5. Nxd4 Bb4 6. Nxc6 Bxc3+ 7. bxc3 dxc6 8. Qxd8+ Kxd8 *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "unknown"]
[WhiteElo ""]
[Black "Crafty 22.7"]
[BlackElo ""]
[Result "*"]
[Annotator "Crafty v22.7"]

1. e4 Nc6 2. Nc3 Nf6 3. Nf3 e6 4. d4 Bb4 5. Bd3 Bxc3+ 6. bxc3 d5 7. exd5 exd5*

I will continue to look at "annotate.c"...

Joshua
What I was thinking of was this:

1. annotate writes out all the headers for the PGN.

2. It also writes out each move as it is "played".

3. It also writes out analysis, enclosed in braces {} for each move that it disagrees with or for every move it told to do so, etc. It already is writing out the sort of stuff you want, you just need to modify it to behave exactly as you want probably without the "threshold" and such...
jhaglund
Posts: 173
Joined: Sun May 11, 2008 7:43 am

Re: Crafty's - alternative move storage[pgn]

Post by jhaglund »

You are correct :)
It already is writing out the sort of stuff you want, you just need to modify it to behave exactly as you want probably without the "threshold" and such...
jhaglund
Posts: 173
Joined: Sun May 11, 2008 7:43 am

Re: Crafty's - alternative move storage[pgn]

Post by jhaglund »

2. It also writes out each move as it is "played".
Could you point me to that variable please?

You should really have an index of all the variables and locations, in Crafty. It would be a great resource tool for educational purposes. It would be really helpful. :) Does someone need some extra credit?
3. It also writes out analysis, enclosed in braces {} for each move that it disagrees with or for every move it told to do so, etc. It already is writing out the sort of stuff you want, you just need to modify it to behave exactly as you want probably without the "threshold" and such...
Where is this "threshold" and such I need to modify?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty's - alternative move storage[pgn]

Post by bob »

jhaglund wrote:
2. It also writes out each move as it is "played".
Could you point me to that variable please?

You should really have an index of all the variables and locations, in Crafty. It would be a great resource tool for educational purposes. It would be really helpful. :) Does someone need some extra credit?
3. It also writes out analysis, enclosed in braces {} for each move that it disagrees with or for every move it told to do so, etc. It already is writing out the sort of stuff you want, you just need to modify it to behave exactly as you want probably without the "threshold" and such...
Where is this "threshold" and such I need to modify?
It really isn't a "variable" as such. The tree->path[1] structure has the results of a search. All the moves, the depth, the number of moves in the PV, etc...
jhaglund
Posts: 173
Joined: Sun May 11, 2008 7:43 am

Re: Crafty's - alternative move storage[pgn]

Post by jhaglund »

It really isn't a "variable" as such. The tree->path[1] structure has the results of a search. All the moves, the depth, the number of moves in the PV, etc...
How can I "print" them?

fprintf(pgn_file, " %s", tree->path); //incorrect

I figured it was tree-> something...
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: Crafty's - alternative move storage[pgn]

Post by Matthias Gemuh »

jhaglund wrote:
It really isn't a "variable" as such. The tree->path[1] structure has the results of a search. All the moves, the depth, the number of moves in the PV, etc...
How can I "print" them?

fprintf(pgn_file, " %s", tree->path); //incorrect

I figured it was tree-> something...



Even without looking at Crafty source code, I guess tree->path points to a structure that you must understand and then exploit.

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
jhaglund
Posts: 173
Joined: Sun May 11, 2008 7:43 am

Re: Crafty's - alternative move storage[pgn]

Post by jhaglund »

Even without looking at Crafty source code, I guess tree->path points to a structure that you must understand and then exploit.


From the looks of things... it's too inter-connected with outputmove(...); or DisplayPV(...);...

Looks like I'd have to rewrite too much

fprintf(pgn_file, "%s \n", buffer); ... gives me a little more of what I was
looking for...

I think someone should rewrite Crafty into C++ ;)