Skip to content

Commit

Permalink
Merge pull request lichess-bot-devs#190 from MarkZH/xboard-clock-mana…
Browse files Browse the repository at this point in the history
…gement

Clock resent to Xboard engines after first move
  • Loading branch information
ShailChoksi authored Feb 11, 2020
2 parents 5da2543 + 2105d00 commit 72d5eb1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions engine_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,19 @@ def _handle_options(self, options):
pass

def set_time_control(self, game):
minutes = game.clock_initial / 1000 / 60
seconds = game.clock_initial / 1000 % 60
inc = game.clock_increment / 1000
self.engine.level(0, minutes, seconds, inc)
self.minutes = game.clock_initial / 1000 / 60
self.seconds = game.clock_initial / 1000 % 60
self.inc = game.clock_increment / 1000
self.send_time()

def send_time(self):
self.engine.level(0, self.minutes, self.seconds, self.inc)

def first_search(self, board, movetime):
self.engine.setboard(board)
self.engine.st(movetime / 1000)
bestmove = self.engine.go()
self.send_time()

return bestmove

Expand Down

0 comments on commit 72d5eb1

Please sign in to comment.