Skip to content

Commit

Permalink
Client support for non-increment time controls
Browse files Browse the repository at this point in the history
  • Loading branch information
kiudee committed Feb 2, 2020
1 parent cdf7660 commit 7155cf1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion tune/db_workers/tuning_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def adjust_time_control(self, time_control, lc0_nodes, sf_nodes):
tc_sf = parse_timecontrol(time_control.engine2)
tc_lc0 = [x * lc0_ratio for x in tc_lc0]
tc_sf = [x * sf_ratio for x in tc_sf]
# TODO: support non-increment time-control
if len(tc_lc0) == 1:
return TimeControl(
engine1=f"{tc_lc0[0]}", engine2=f"{tc_sf[0]}"
)
return TimeControl(
engine1=f"{tc_lc0[0]}+{tc_lc0[1]}", engine2=f"{tc_sf[0]}+{tc_sf[1]}"
)
Expand Down
5 changes: 3 additions & 2 deletions tune/db_workers/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from collections import namedtuple
import numpy as np

MatchResult = namedtuple("MatchResult", ["wins", "losses", "draws"])
TimeControl = namedtuple("TimeControl", ["engine1", "engine2"])


def parse_timecontrol(tc_string):
return tuple([float(x) for x in tc_string.split("+")])
if "+" in tc_string:
return tuple([float(x) for x in tc_string.split("+")])
return (float(tc_string),)

0 comments on commit 7155cf1

Please sign in to comment.