Moderators: hgm, Andres Valverde
if (sscanf(message, "%d%c %d %d %lu %[^\n]\n",
&plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5) {
I don't know enough about the scanf format to see it there need to be at least 2 spaces between the first and second number, or that a single space would do.
H.G.Muller wrote:This is the line in WB that tests if a line of engine output ('message') is to be considered thinking output:
- Code: Select all
if (sscanf(message, "%d%c %d %d %lu %[^\n]\n",
&plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5) {
So the condition seems to be that it should start with 4 integers, where an arbitrary character would be allowed to follow the first integer. (But better not put anything else than a space or tab there, as with other characters WB will assume you are GNU Chess, and multiplies the time by 100, as GNU Chess reports in seconds.)
If WB does not accept an engine line as thinking output, it must be because it does not contain 4 integers. I don't know enough about the scanf format to see it there need to be at least 2 spaces between the first and second number, or that a single space would do.
"%d%c %d %d %lu %[^\n]\n"
12629 >first : go
nps: w=-1, b=-1
12639 <first : [0 positions remaining in transposition table]
12639 <first :
12639 <first : h2-h3 ( 1/20)
12639 <first : g2-g4 ( 2/20)
12639 <first : 1 -0.016 0.01s 4 g2-g4 1
12639 <first : h2-h4 ( 3/20)
12639 <first : 1 -0.008 0.01s 12 c2-c4 1
12639 <first : d2-d3 (10/20)
12639 <first : 1 0.008 0.01s 15 d2-d4 1
12649 <first : e2-e3 (12/20)
12649 <first : d2-d4 ( 1/20)
12649 <first : c2-c4 ( 2/20)
12649 <first : d2-d4 ( 1/20)
12659 <first : c2-c4 ( 2/20)
12659 <first : d2-d4 ( 1/20)
12669 <first : c2-c4 ( 2/20)
12669 <first : d2-d4 ( 1/20)
12679 <second: pong 1
12679 <first : c2-c4 ( 2/20)
12689 <first : 5 -0.020 0.06s 13158 c2-c4 e7-e5 e2-e4 f8-c5 a2-a4 5
12719 <first : g2-g4 ( 3/20)
12809 <first : c2-c4 ( 1/20)
12929 <first : d2-d4 ( 2/20)
12989 <first : 6 -0.038 0.35s 106164 e2-e4 c7-c6 d2-d4 d7-d5 e4-d5 c6-d5 6
12999 <first : f2-f3 (14/20)
13440 <first : e2-e4 ( 1/20)
13440 <first : g1-e2 7
13800 <first : c2-c4 ( 2/20)
14932 <first : e2-e4 ( 1/20)
14932 <first : c3-e2 c7-c5 d2-d4 . c5-d4 d1-d4 11
16734 <first : c2-c4 ( 2/20)
16734 <first : 1345867 nodes (int:529716, leaf:816151, quies:364060), 327860 n/s
16744 <first : 132080 filled (25.19%), 1598758 reads, 81982 hits ( 5.13%) 165648 writes
16754 <first : 4356274 moves in 144165 times (30.22)
16754 <first : move e2-e4
Sven Schüle wrote:So the 's' character at the end of the "time" part (third number) in the PV seems to be the offending one.
Sven
printf( " %8.2fs ", timeUsed );
printf( " %d ", (int) (100 * timeUsed) );
printf("%i %+1.2f %.0f %i ", depth, best_score / 100.0, diff, nodes);
printf("%i %i %i %i ", depth, best_score, (int) (100 * diff), nodes);
Sven Schüle wrote:Sven Schüle wrote:So the 's' character at the end of the "time" part (third number) in the PV seems to be the offending one.
Sven
It is even more than that, the time is printed with decimal point instead of as an integer meaning "centiseconds". The problem (for Alibaba) is in macro.h, line 281 (in the version I downloaded from Jim's site), and a quick fix could be to replace
- Code: Select all
printf( " %8.2fs ", timeUsed );
by
- Code: Select all
printf( " %d ", (int) (100 * timeUsed) );
For MSKCP it is a similar problem. In mskcp.c, both lines 1991 and 2007 contain
- Code: Select all
printf("%i %+1.2f %.0f %i ", depth, best_score / 100.0, diff, nodes);
which should be changed into something like
- Code: Select all
printf("%i %i %i %i ", depth, best_score, (int) (100 * diff), nodes);
Sven
Jim Ablett wrote:I'm sure Sven's fix is correct so must be another issue that winboard doesn't like.
printf( "%7.3f ", value*1.0/pieceValue[ WhitePawn ] /5 )
printf( "%d ", value )
Sven Schüle wrote:Jim Ablett wrote:I'm sure Sven's fix is correct so must be another issue that winboard doesn't like.
It may be correct but incomplete
There is a second place for Alibaba that should be changed since I overlooked that also the score is printed with decimals, while the protocol requests an integer measured in centipawns.
"macro.h", line 240 (in the PrintValue() macro) contains:
- Code: Select all
printf( "%7.3f ", value*1.0/pieceValue[ WhitePawn ] /5 )
and should become something like:
- Code: Select all
printf( "%d ", value )
Try again, please ...
Sven
printf( "%9d ", value )
Jim Ablett wrote:I think this problem shows Winboard is very fussy in what it accepts.
It will refuse to show any pv line at all if one element of the line is slightly incorrect or doesn't use an integer.
Maybe this could be improved.
H.G.Muller wrote:Jim Ablett wrote:I think this problem shows Winboard is very fussy in what it accepts.
It will refuse to show any pv line at all if one element of the line is slightly incorrect or doesn't use an integer.
Maybe this could be improved.
I doubt if this is desirable. The WB protocol specs are very explicit in how the thinking output should be sent (centi-seconds and centi-Pawns). It is important that engines respect that, as the output is not merely for display, but WinBoard should actually understand it. (For the purpose of adjudication, or decrementing the clock in NPS mode.) The fact that engines use a floating-point format here is likely to be more than a problem of using a wrong format: with centi-Pawns there hardly would be need for any decimal places. So they probably use some wrong kind of unit, but which one?
I think it is in general much better to keep a tight standard, than accepting as much non-compliant output as possible. The latter just invites chaos.
<plyString><spaces><scoreString><spaces><timeString><spaces><nodesString> <spaces><pvString>
Return to WinBoard development and bugfixing
Users browsing this forum: No registered users and 4 guests