Aleks31 / pychess

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

[PATCH] Change UCI behavior to match other GUIs #647

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If PyChess's handles UCI more like other GUIs in the wild, it will run into 
fewer engine bugs. My changes are:

(1) In positions, encode the en-passant target like X-FEN: i.e., only list one 
if a pawn moved adjacent to an enemy pawn. Standard FEN's "extra" e.p. targets 
prevent some engines from recognizing positions in their hash tables or (worse) 
opening books. At least Stockfish <= 1.6.1 and Spark <= 1.0 have this bug.

Maybe you guys can think of a better function name, BTW: in FRC .asXFen() 
doesn't treat castling rights as in X-FEN. And if we make it do so, who knows 
whether all engines will understand? Stupid standards...

(2) Send the game history before every move. Otherwise, a UCI-compliant engine 
will "forget" the game history and be blind to repetition draws. In analysis 
mode, I keep the old behavior to prevent engines from claiming a 2-fold 
repetition as a draw (a common side effect of a common speed optimization).

The second patch also fixes toAN() in the case of Fischer random chess 
castling. Maybe that bit should make it into 0.10? (Without patch #2, this 
causes a bug iff a UCI engine is playing FRC, allowed to ponder, and expecting 
its opponent to castle.)

Minor detail: the second patch would be simpler if we could send an empty move 
list -- I'm not sure whether one can get away with that. At very least, the 
command "position startpos moves " (with trailing space) can crash older 
Stockfishes.

Original issue reported on code.google.com by Uncombed...@gmail.com on 5 Mar 2011 at 11:10

Attachments:

GoogleCodeExporter commented 8 years ago
This is a very good patch.
I've tested it and it improved stability.
I've commited it to trunk. Thanks.

Original comment by lobais on 7 Mar 2011 at 12:23