Page 1 of 1

WB II programs -> extended search info under Arena

PostPosted: 27 Sep 2004, 22:35
by José Carlos
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.

can we identify arena at runtime?

PostPosted: 28 Sep 2004, 15:17
by David Weller
Thanks Jose'.

How can we identify Arena at runtime?

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

PostPosted: 28 Sep 2004, 19:51
by Pallav Nawani
This method is used in analysis mode to show regular updates, but not when engine is thinking/pondering during a match!

Pallav

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

PostPosted: 29 Sep 2004, 00:20
by José Carlos
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).

Re: can we identify arena at runtime?

PostPosted: 29 Sep 2004, 08:15
by Odd Gunnar Malin
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

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

PostPosted: 03 Oct 2004, 19:24
by Anonymous
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

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

PostPosted: 03 Oct 2004, 23:49
by José Carlos
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.

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

PostPosted: 04 Oct 2004, 23:29
by Anonymous
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

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

PostPosted: 05 Oct 2004, 08:13
by Tony van Roon-Werten
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