Extracting info from Critter session file

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

arturo100
Posts: 53
Joined: Thu Jun 25, 2009 10:34 am

Extracting info from Critter session file

Post by arturo100 »

I have been reading several interesting posts on this and other forums about Critter learning capabilities. For example, here some details on its usage are given along with comparison with the learning capabilities of other engines:

http://rybkaforum.net/cgi-bin/rybkaforu ... ?tid=25154

I tried myself to use Critter and I have generated a session file, but it is in a binary format and it is not human-readable as I open from reading the above link. Is there any way that I can extract text info from the session file or at least have a clue of the learning process that it is going on?

Thanks in advance.
Arturo
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Extracting info from Critter session file

Post by rvida »

arturo100 wrote:Is there any way that I can extract text info from the session file
No, because positions are not stored in the session file, only hash keys (like in polyglot opening books).
arturo100 wrote: or at least have a clue of the learning process that it is going on?
There is a console mode command that probes the session file for the current position - I used it for debugging. Open critter in a console window, setup the session file location, enter a position and type "sf probe".

Here is an example:

Code: Select all

setoption name session file value c:/chess/engines/critter16a/session.csf
position fen rnbqkbnr/ppp1pppp/8/3p4/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - 0 2
sf probe
If the position is found in the session file, the engine answers:

Code: Select all

depth score line
-------------------
 13   +0.18 Bf4
-------------------
1 entries found
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Extracting info from Critter session file

Post by hgm »

I have only a vague idea what such a session file would be used for, so please correct me if I am wrong: this session file contains only (position, score) pairs that can be assigned by the user? Or does it also contain other information about the positions?

The reason I ask is that I would like to allow the user to operate such a session file through the GUI. E.g. by setting up a position, and then allowing the user to type "=xxx" with xxx a score in centi-Pawn, to define the score of any position. This of course would require some standard protocol to communicate it to the engine. For WB protocol I proposed to use the 'setscore xxx' command for this.

How does this work in Critter now? Is there an engine-defined option that can be used to add positions to the session file?
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Extracting info from Critter session file

Post by rvida »

hgm wrote:I have only a vague idea what such a session file would be used for, so please correct me if I am wrong: this session file contains only (position, score) pairs that can be assigned by the user? Or does it also contain other information about the positions?
It is very much like a persistent hash table and each entry contains a hashkey, score, depth and the best move.
hgm wrote: How does this work in Critter now? Is there an engine-defined option that can be used to add positions to the session file?
for storing a position:

Code: Select all

position fen <fen-string>
sf store <score> <best_move> <depth>
Score is from point of view of the side to move with 2 decimal places (eg -4.28, +0.15). Mate scores are in the +/-Mnn format. (e.g +M8, -M10)

for deleting:

Code: Select all

position fen <fen-string>
sf delete &#91;n&#93;
If the optional [n] parameter is provided, Critter performs a perft(n) deleting every visited position.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Extracting info from Critter session file

Post by hgm »

Are there GUIs that support this format? Or must people that want to use the session file always run Critter from the command line?

If the latter is the case, would you have any objection to (also) support the session file through commands that fit better in the existing UCI option framework? Like defining "sf store" and "sf delete" as UCI string options, and then respond to

Code: Select all

setoption name sf store value <score> <move> <depth>
?

This would also allow users of GUIs that have no special provision for these commands to emit them from the GUI. (Problem could be that they have no way to emit the "position fen" command other than actually starting a search / analysis on the position. Would Critter still remember the position after such a search, when it receives the sf command, or is it mandatory to set up the position again? I guess a convenient way for the user to store a position in the session file could be through a button option that stores the current analysis (i.e. the last PV info received from it) in the session file while the analysis is still going on).
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Extracting info from Critter session file

Post by rvida »

hgm wrote:Are there GUIs that support this format?
No.
hgm wrote: Or must people that want to use the session file always run Critter from the command line?
If they want to manually override/delete individual entries then yes. Otherwise it is fully transparent to the user.
hgm wrote: If the latter is the case, would you have any objection to (also) support the session file through commands that fit better in the existing UCI option framework? Like defining "sf store" and "sf delete" as UCI string options, and then respond to

Code: Select all

setoption name sf store value <score> <move> <depth>
?
I will implement this in the next version.
hgm wrote: This would also allow users of GUIs that have no special provision for these commands to emit them from the GUI. (Problem could be that they have no way to emit the "position fen" command other than actually starting a search / analysis on the position. Would Critter still remember the position after such a search, when it receives the sf command, or is it mandatory to set up the position again?
Yes, Critter remembers the last searched position.
hgm wrote: I guess a convenient way for the user to store a position in the session file could be through a button option that stores the current analysis (i.e. the last PV info received from it) in the session file while the analysis is still going on).
If the session file is enabled, current analysis result is being written to it on each completed iteration automatically. No extra user action is needed.