Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
fix a bug were you can't change w2 if you don't mention debug as well
add a trim to list given to load_games so that you can put space before or after the separator
  • Loading branch information
MONVILLE Pierre Francois committed Jul 7, 2018
1 parent 228d522 commit d043341
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Binary file added whr/test_whr
Binary file not shown.
8 changes: 5 additions & 3 deletions whr/whole_history_rating.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def __init__(self, config= None):
self.config = defaultdict(lambda: None)
else:
self.config = config
if self.config.get("debug") is None:
self.config["debug"] = False
if self.config.get("w2") is None:
self.config["w2"] = 300.0
self.games = []
Expand Down Expand Up @@ -256,7 +258,7 @@ def load_games(self, games, separator=' '):
for line in data:
handicap = 0
extras = None
arguments = line.split(separator)
arguments = [x.strip() for x in line.split(separator)]
is_correct = False
if len(arguments) == 6:
black, white, winner, time_step, handicap, extras = arguments
Expand Down Expand Up @@ -308,8 +310,8 @@ def load_base(path):


if __name__ == "__main__":
whr = Base()
games = ["shusaku;shusai;B;1", "shusaku;shusai;W;2;0", "shusaku;shusai;W;3;{'w2':300}", "shusaku;nobody;B;3;0;{'w2':300}"]
whr = Base(config={"w2":14})
games = ["shusaku; shusai; B; 1", "shusaku;shusai;W;2;0", " shusaku ; shusai ;W ; 3; {'w2':300}", "shusaku;nobody;B;3;0;{'w2':300}"]
# whr.create_game("shusaku", "shusai", "B", 1, 0)
# whr.create_game("shusaku", "shusai", "W", 2, 0)
# whr.create_game("shusaku", "shusai", "W", 3, 0)
Expand Down

0 comments on commit d043341

Please sign in to comment.