Hi Steven,
Thanks for the interaction.
Yes, the code is a mess. Very much so.
I think I found the major source of trouble.
And it is not so much an administration thing, but rather a state
machine issue.
By way of synopsis:
In any case, comments must only follow a move once a comparison of
evaluations can be done on the positions before and after this move is
played.
Nothing special, except at the start of the analysis. Here the engine
must be given the opportunity to assess the initial position for itself
without spitting comments. Just setting the inital "previous"
evaluation, as it were.
When doing batch analysis, this situation occurs in the very beginning
and after each transition into the next game of the batch.
The current implementation has several problems:
1) In the very beginning (in analysis/configAnnotation) the engine is
not given any time to assess the initial position. Note that
toggleAutoplay calls the autoPlay handler immediately, instead of
applying a defined initial delay. This will more or less randomize the
engine's initial assessment.
1a) Note that the analysis in the engine is not restarted. This means
that the initial assessment by the engine depends on the time it was
already looking at the current position.
2) The autoPlay handler does _not_ enter addAnnotation when we are at
the start of the game. This is fine as far as the annotation itself is
concerned. But addAnnotation has the additional job of shifting the
current evaluation into the past! This means that white's very first
move will be annotated randomly (as there is no previous evaluation
available).
2b) Note that annotation of the first game of the batch is started at
its current position (there is no repositioning). This means that the
behavior varies, depending on where we start the analysis.
3) After loading the next game in the batch (in main/autoPlay),
addAnnotation is called straightway. It is fully unclear what the engine
will have made of the initial position at that time, but at least we
have a (random) initial assessment. Only then the engine is given time
to assess the start position of the game (once more!), but, as we have
seen, addAnnotation is not called again.
I will first repair this state machine.
That is:
* correct initial timing
* always call AddAnnotation
* make addAnnotation aware of initial versus follow-up analysis
(independent of the position on the board). Only for follow-up analysis,
comments should be produced.
Maybe ( = maybe not) the administration itself needs some additional
flushing as well. Stack operations are implemented correctly, but I have
the feeling that the stack size could be growing and growing if the user
does not allow autoPlay to finish a game until the very end. (I could
not find a stack reset operation, so stack cleanup entirely depends on a
correct sequence of push/pop operations).
Cheers,
Joost.
On 10/31/2010 12:45 PM, Steven wrote:
> Can you be a bit more specific on the complications you see, by
extending my simple
> use case (with some variation)?
Truth is... I've had trouble testing it even. Even the simple three
game DB you supplied
seems to give me varying results sometime, with different engines too,
and had me scratching my head. Your fix does have the nice effect of
stopping engine analysis
when batch processing is finished... something previously requested i
think.
I'm kind-of happy with what i've added to scid-vs-pc this evening
[Apart from the fact i realised annotation was broken for all engines
except the first one!] which is something like your fix , slightly
moved, plus a new proc nextgameAutoplay which includes:
+ set ::stack {}
+ set analysis(prevscore1) 0
+ set analysis(score1) 0
+ set analysis(prevmoves1) 0
+ set analysis(prev_depth1) 0
My hunch is this fixes things but probably breaks some annotation of
variations
at game end, but i'm not testing it further. Here it is in more detail
http://scidvspc.svn.sourceforge.net/viewvc/scidvspc/tcl/main.tcl?r1=267&r2=245
Re, finding a proper fix. This code is quite deep, and a mess imho.
Program flow is all over the place. I've given up on this one :-(
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Scid-users mailing list
Scid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scid-users