Bench questions a script answers from the code against the panel's hardest places

This commit is contained in:
2026-10-09 00:16:45 +02:00
parent 08c5625ac7
commit 083cc782d0
11 changed files with 507 additions and 7 deletions
+14 -2
View File
@@ -22,17 +22,29 @@ class ScoringRun:
heading: str
commit: str
places: list[Place]
overall: float | None
def scoring_runs(history: str) -> list[ScoringRun]:
"""Each scoring run in a comprehension history, with the places its seats named, as they wrote them; paired rulings name what changed, not what is hard, and are left out."""
"""Each scoring run in a comprehension history, with the places its seats named, as they wrote them, and the seats' mean overall score; paired rulings name what changed, not what is hard, and are left out."""
runs = []
for heading, bodies in sections(history).items():
if (named := RUN.match(heading)) and ", against " not in heading:
runs.append(ScoringRun(heading, named.group(3), [place for body in bodies for place in seat_places(body)]))
runs.append(ScoringRun(heading, named.group(3), [place for body in bodies for place in seat_places(body)], mean_overall("\n".join(bodies))))
return runs
def mean_overall(body: str) -> float | None:
"""The last cell of the table's `Mean` row."""
for line in body.splitlines():
if line.startswith("| Mean |"):
try:
return float(line.strip().strip("|").split("|")[-1])
except ValueError:
return None
return None
def seat_places(body: str) -> list[Place]:
places = []
listing = False