Jnrolfe / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

[CECP] PyChess doesn't send "new" for initialization of the first game #625

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Now this is a tough one. The specs are hard to understand on this and actually 
they don't seem to clearly specify this at all. Here they are for anyone who 
wants to have a read:

http://home.hccnet.nl/h.g.muller/engine-intf.html#8

PyChess doesn't send "new" before the first game, I guess it only sends this 
command to reset previous games.

'new' is specified in the specs to do the following things: "Reset the board to 
the standard chess starting position. Set White on move." (and other things 
which follow)

It is not specified that an engine shall have the board reset to the standard 
chess position initially without that command being sent (but then again, it 
doesn't seem totally wrong to assume this).

It is also not specified whether that command MUST be sent before the first 
game or just to reset previous games. It is mentioned though that xboard does 
indeed send "new" in its init string, always. But it doesn't really read like 
an official requirement :-/

Since all frontends I know (that includes xboard and if I remember correctly, 
also Arena) do send a "new" before each game (even the first) and it occured to 
me my little engine relied on this (although I will probably change that now), 
I'd like to suggest to send "new" before each game - including the first, since 
the specs HINT that this might be a good idea for proper initialization. Or 
actually just state that is how xboard does it (but that can't be a bad thing 
either).

Original issue reported on code.google.com by jonas.thiem@gmail.com on 31 Dec 2010 at 10:24

GoogleCodeExporter commented 8 years ago

Original comment by gbtami on 4 Jan 2011 at 4:41

GoogleCodeExporter commented 8 years ago
I'd like to add while this is a minor change (I added it to my local pychess 
version by replacing "nopost" with "nopost\nnew"), it is definitely a blocker 
for the engine I write (at least for all currently released versions).

Original comment by jonas.thiem@gmail.com on 5 Mar 2011 at 11:46

GoogleCodeExporter commented 8 years ago
Actually I'm surprised we don't already do this.
Would you like "new" to be sent just after "xboard", or rather after features 
have been sorted out?
If you create a patch, we'll probably include it. It doesn't really hurt 
anything.

Original comment by lobais on 6 Mar 2011 at 11:12

GoogleCodeExporter commented 8 years ago
My fix was rather a dirty 2 seconds hack, I am not really familiar enough with 
PyChess to write a clean one easily (I think mine might cause "new" to get sent 
more often than necessary since it is just hacked into another sequence that 
was actually not intended to include it).

new should be really send after the features have been sorted out. Doing it 
earlier could make an engine think that the GUI doesn't support the feature 
procedure at all (not uncommon, e.g. old PyChess or old Arena only partially) 
and might break things consequently. Also I think the specs want "xboard", 
"feature" etc to happen first before anything else, so I'd not do it 
differently if not really necessary.

Original comment by jonas.thiem@gmail.com on 7 Mar 2011 at 1:35

GoogleCodeExporter commented 8 years ago
Yes. We don't need no time hacks, CECP initing is messy enough already ;)
"new" seams like it should fire just before CECPEngine emits "readyForMoves". 
This is the state, where features have just been sorted out, and we haven't yet 
started playing.

So.. Try putting it in the middle of __onReadyForMoves. I'm pretty sure that 
should work.

Original comment by lobais on 7 Mar 2011 at 2:24

GoogleCodeExporter commented 8 years ago

Original comment by jonas.thiem@gmail.com on 18 Sep 2012 at 2:39