From 25eef42b0b84e0bc5bfb6004091b677142f835b9 Mon Sep 17 00:00:00 2001 From: qpwoeirut Date: Sat, 13 Jul 2024 02:30:17 -0700 Subject: [PATCH] Pause before first move as white --- homemade.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homemade.py b/homemade.py index 01221be80..107689227 100644 --- a/homemade.py +++ b/homemade.py @@ -2,6 +2,7 @@ import logging import random +import time from enum import Enum from typing import Union, Any, override, cast @@ -70,6 +71,10 @@ def search(self, board: chess.Board, time_limit: chess.engine.Limit, ponder: boo :return: The move to play. """ + # Pause for a little so that any chat messages are processed before the start of the game. + if board.halfmove_clock == 0: + time.sleep(0.5) + time_left, increment = (time_limit.white_clock, time_limit.white_inc) if board.turn == chess.WHITE else ( time_limit.black_clock, time_limit.black_inc) if time_left is None or time_left > 10 or (increment is not None and increment >= 1):