diff --git a/whr/test_whr b/whr/test_whr new file mode 100644 index 0000000..85031dd Binary files /dev/null and b/whr/test_whr differ diff --git a/whr/whole_history_rating.py b/whr/whole_history_rating.py index e2ced19..9db7198 100644 --- a/whr/whole_history_rating.py +++ b/whr/whole_history_rating.py @@ -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 = [] @@ -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 @@ -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)