Skip to content

Commit

Permalink
clear up code
Browse files Browse the repository at this point in the history
  • Loading branch information
jnlt3 committed Feb 21, 2022
1 parent e9329e7 commit 7026b82
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cutechess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

0 comments on commit 7026b82

Please sign in to comment.