From 67930174b43e8e36217cd6e7b67433c06ff22a94 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 26 Oct 2025 19:58:08 +0100 Subject: [PATCH] Fix bok retrieval mov moves that could be KxR castling The probing code for the Polyglot book corrected moves like e1h1, which could be a castling in the KxR notation that UCI uses for Chess960, to compliant CECP notation (e1g1). But it also did that for Rook or Queen moves that were not castlings at all. Now we test for a King on the from-square before doing this. --- book.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/book.c b/book.c index f0b8c74..626c354 100644 --- a/book.c +++ b/book.c @@ -563,9 +563,10 @@ move_to_string (char move_s[20], uint16 move) } if(gameInfo.variant != VariantNormal) return; + p = boards[currentMove][fr][ff]; + if(p != WhiteKing && p != BlackKing) return; // not a castling // correct FRC-style castlings in variant normal. - // [HGM] This is buggy code! e1h1 could very well be a normal R or Q move. if(!strcmp(move_s,"e1h1")){ safeStrCpy(move_s,"e1g1", 6); }else if(!strcmp(move_s,"e1a1")){ -- 1.7.0.4