Fix saving games as book
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 26 Oct 2025 18:29:48 +0000 (19:29 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 26 Oct 2025 18:29:48 +0000 (19:29 +0100)
The last move of each game would never be added to the book,
due to use of < instead of <= when testing for the game end.

book.c

diff --git a/book.c b/book.c
index 5caea0f..f0b8c74 100644 (file)
--- a/book.c
+++ b/book.c
@@ -1061,7 +1061,7 @@ AddGameToBook (int always)
     }
 
     if(appData.debugMode) fprintf(debugFP, "add game to book (%d-%d)\n", backwardMostMove, forwardMostMove);
-    for(i=backwardMostMove; i<forwardMostMove && i < 2*appData.bookDepth; i++)
+    for(i=backwardMostMove; i<=forwardMostMove && i < 2*appData.bookDepth; i++)
        AddToBook(i, WhiteOnMove(i) ? result : 2-result); // flip result when black moves
 }