Skip to content

Commit

Permalink
Pause before first move as white
Browse files Browse the repository at this point in the history
  • Loading branch information
qpwoeirut committed Jul 13, 2024
1 parent c503be4 commit 25eef42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions homemade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
import random
import time
from enum import Enum
from typing import Union, Any, override, cast

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 25eef42

Please sign in to comment.