Skip to content

Commit 1a50a2f

Browse files
Copilotfsmosca
andcommitted
Refine adviser queue fallback
Agent-Logs-Url: https://github.com/fsmosca/Python-Easy-Chess-GUI/sessions/bd37aa40-7697-4a58-83fa-686e0e9b2592 Co-authored-by: fsmosca <22366935+fsmosca@users.noreply.github.com>
1 parent f032983 commit 1a50a2f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

python_easy_chess_gui.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,8 @@ def play_game(self, window: sg.Window, board: chess.Board):
20982098
except queue.Empty:
20992099
continue
21002100
except Exception:
2101-
logging.exception('Failed to read adviser queue.')
2101+
logging.exception(
2102+
'Unexpected error reading adviser queue.')
21022103
continue
21032104

21042105
if 'bestmove' in msg:
@@ -2108,8 +2109,10 @@ def play_game(self, window: sg.Window, board: chess.Board):
21082109
adviser_line.split()[0:3])
21092110
else:
21102111
bestmove_parts = msg.split(maxsplit=1)
2111-
bestmove = bestmove_parts[1] \
2112-
if len(bestmove_parts) > 1 else '(none)'
2112+
if len(bestmove_parts) > 1:
2113+
bestmove = bestmove_parts[1]
2114+
else:
2115+
bestmove = '(none)'
21132116
adviser_line = f'bestmove {bestmove}'
21142117
adviser_line += ' - ' + self.adviser_id_name
21152118
window.Element('advise_info_k').Update(adviser_line)

0 commit comments

Comments
 (0)