diff --git a/cutechess.py b/cutechess.py index f2a985c..b048c44 100644 --- a/cutechess.py +++ b/cutechess.py @@ -48,20 +48,20 @@ def run(self, params_a: list[str], params_b: list[str]) -> MatchResult: line = cutechess.stdout.readline().strip().decode('ascii') if line != '': print(line) - # Parse WLD score - if line.startswith("Score of"): - start_index = line.find(":") + 1 - end_index = line.find("[") - split = line[start_index:end_index].split(" - ") - - for i in range(3): - score[i] = int(split[i]) - - # Parse Elo Difference - if line.startswith("Elo difference"): - start_index = line.find(":") + 1 - end_index = line.find("+") - elo_diff = float(line[start_index:end_index]) else: cutechess.wait() return MatchResult(score[0], score[1], score[2], elo_diff) + # Parse WLD score + if line.startswith("Score of"): + start_index = line.find(":") + 1 + end_index = line.find("[") + split = line[start_index:end_index].split(" - ") + + for i in range(3): + score[i] = int(split[i]) + + # Parse Elo Difference + if line.startswith("Elo difference"): + start_index = line.find(":") + 1 + end_index = line.find("+") + elo_diff = float(line[start_index:end_index])