WB II programs -> extended search info under Arena

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

WB II programs -> extended search info under Arena

Postby José Carlos » 27 Sep 2004, 22:35

Hi there fellow programmers. Arena has a nice feature that shows current move being searched, that can be used in WBII programs. Everytime you start searching a new root move you send the command "stat", which works as follows:

Code: Select all
      #if defined(ARENA)
         if (TimeElapsed > 3 || Depth > 4)
         {
            printf("\nstat01: %u %u %d %u %u %s%s\n",
               (UINT32)(TimeElapsed * 100),
               TotalNodes,
               Depth,
               MoveIndex,
               TotalRootMoves,
               MoveInAlgebraicNotation);
         }
      #endif


MoveIndex stands for the "3" in: 3/47.
It is a nice feature and it's implemented in five minutes.

Jos? C.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

can we identify arena at runtime?

Postby David Weller » 28 Sep 2004, 15:17

Thanks Jose'.

How can we identify Arena at runtime?
User avatar
David Weller
 
Posts: 135
Joined: 26 Sep 2004, 20:30
Location: USA

This dosen't seem to be a part of WB2 Protocol..

Postby Pallav Nawani » 28 Sep 2004, 19:51

This method is used in analysis mode to show regular updates, but not when engine is thinking/pondering during a match!

Pallav
User avatar
Pallav Nawani
 
Posts: 147
Joined: 26 Sep 2004, 20:00
Location: Dehradun, India

Re: WB II programs -> extended search info under Arena

Postby José Carlos » 29 Sep 2004, 00:20

It works during thinking/pondering. Try it!
You can't detect you're under Arena. I just have a compilation #define and build two versions. I always release the version with the switch on because it only marginally hurts performance under Winboard (sending a command tha Winboard ignores).
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Re: can we identify arena at runtime?

Postby Odd Gunnar Malin » 29 Sep 2004, 08:15

David Weller wrote:Thanks Jose'.

How can we identify Arena at runtime?


I have had this feature for a few year now, since ChessPartner also can show this info.

What I did to turn this on/off was to make a new command 'autostat on/off' that I can put into an 'InitString' or on the command line in the GUI setup.

Odd Gunnar
Odd Gunnar Malin
 
Posts: 9
Joined: 29 Sep 2004, 08:10
Location: Vads?, Norway

Re: WB II programs -> extended search info under Arena

Postby Anonymous » 03 Oct 2004, 19:24

Jos? Carlos wrote:It works during thinking/pondering. Try it!
You can't detect you're under Arena. I just have a compilation #define and build two versions. I always release the version with the switch on because it only marginally hurts performance under Winboard (sending a command tha Winboard ignores).


I had suggested to Tim Mann some years ago a new WB command "GUI". For example the engine could send "feature GUI=1\n" and then the GUI would reply: "GUI Winboard 4.3.5\n" or something like this.

Some nitpicks to your original post: the format string looked wrong to me (one %s too much). The cast is dubious at best. A better cast would be to unsigned int. (One could start an endless discussion about the doubtful merit of user defined types in C here, but in this case cast to some user defined type clearly is not asked for - there is no user defined format specifier accompaning it ...). I guess the original type is some floating point type - using %.0f instead of the cast might also be a good alternative, that is portable.

Regards,
Dieter
Anonymous
 

Re: WB II programs -> extended search info under Arena

Postby José Carlos » 03 Oct 2004, 23:49

Some nitpicks to your original post: the format string looked wrong to me (one %s too much). The cast is dubious at best. A better cast would be to unsigned int. (One could start an endless discussion about the doubtful merit of user defined types in C here, but in this case cast to some user defined type clearly is not asked for - there is no user defined format specifier accompaning it ...). I guess the original type is some floating point type - using %.0f instead of the cast might also be a good alternative, that is portable.


I copied and pasted too fast. Actually, I posted the code as an example of the format, not trying to write perfect code, because I translated all variables to english and more readable names. The double %s is there because I use "from" and "to" in my code, but then I translated to a single variable name. As for the cast, I have a #define unsigned __int32 UINT32 in my code. I have one of those for every integer size, signed and unsigned.
But you're right, I should have been more carefull with the code I posted. Thanks for the remarks.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Re: WB II programs -> extended search info under Arena

Postby Anonymous » 04 Oct 2004, 23:29

Jos? Carlos, I fear I was not so clear. It is a minor point anyway. But compare:

typedef unsigned int UINT32;

...

double time_used; /* in seconds */

/* need to print centiseconds to WB */

printf("%u\n", (UINT32)(time_used*100));

Now one can ask, why use a user defined type here? IMO it only has disadvantages. Say on Borland-C 3.0 (I still have it and use it now and then), the typedef would be to unsigned long. And now the printf is wrong (you need %lu and not %u then). Alternative

printf("%lu\n", (unsigned long)(time_used*100));

will work anywhere (at least for 1 1/2 years or so, after which it can have undefined behaviour). Or

printf("%.0f\n", time_used*100);

So, my point was: use the basic types for such stuff. BTW. using unsigned int, as I wrote wrongly in my other post, would not be such a good idea, because it will overflow pretty fast (in 10 minutes) on some systems.

Regards,
Dieter
Anonymous
 

Re: WB II programs -> extended search info under Arena

Postby Tony van Roon-Werten » 05 Oct 2004, 08:13

Jos? Carlos wrote:Hi there fellow programmers. Arena has a nice feature that shows current move being searched, that can be used in WBII programs. Everytime you start searching a new root move you send the command "stat", which works as follows:

Code: Select all
      #if defined(ARENA)
         if (TimeElapsed > 3 || Depth > 4)
         {
            printf("\nstat01: %u %u %d %u %u %s%s\n",
               (UINT32)(TimeElapsed * 100),
               TotalNodes,
               Depth,
               MoveIndex,
               TotalRootMoves,
               MoveInAlgebraicNotation);
         }
      #endif


MoveIndex stands for the "3" in: 3/47.
It is a nice feature and it's implemented in five minutes.

Jos? C.



A small addition. To get the 3 in 3/47 you actually have to send (47-3)-1.

So, amount of remaining moves.

Tony
Tony van Roon-Werten
 
Posts: 99
Joined: 02 Oct 2004, 15:31
Location: 's Hertogenbosch, Netherlands


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 0 guests