fix(official-bots): derive tournament game color from game endpoint (#79)
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
Tournament-server reports wrong color in pairings (everyone white), so auto-joined games could play with an inverted color and never move on their real turn. The game endpoint white/black ids are correct, so the poll loop now derives our color from it, falling back to the passed-in color. Both stream and auto-join entry paths are now immune to the bug. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Janis Eccarius <eccariusjanis@gmail.com> Reviewed-on: #79
This commit was merged in pull request #79.
This commit is contained in:
+9
-1
@@ -414,9 +414,17 @@ class TournamentBotGamePlayer:
|
||||
if gameTerminalStatuses.contains(status) then
|
||||
log.infof("Game %s ended — status=%s", gameId, status); done = true
|
||||
else
|
||||
// TEMP: tournament-server reports wrong color in pairings (everyone white).
|
||||
// The game endpoint white/black ids are correct, so derive our color from it.
|
||||
val whiteId = node.path("white").path("id").asText()
|
||||
val blackId = node.path("black").path("id").asText()
|
||||
val myColor =
|
||||
if whiteId == cfg.botId then "white"
|
||||
else if blackId == cfg.botId then "black"
|
||||
else color
|
||||
val turn = node.path("turn").asText()
|
||||
val fen = node.path("fen").asText()
|
||||
if turn == color && status == "ongoing" && fen.nonEmpty && fen != lastFen then
|
||||
if turn == myColor && status == "ongoing" && fen.nonEmpty && fen != lastFen then
|
||||
lastFen = fen
|
||||
log.infof("Our turn in game %s — computing move (fen=%s)", gameId, fen)
|
||||
computeUci(cfg, fen) match
|
||||
|
||||
Reference in New Issue
Block a user