Add failed-Exam loss switch; keep -3 and accept the length (6.11, D50)
RulesConfig.exam_failure_loss (bots aware) with the sim axis --exam-loss. Losing 1 or 0 stripes saves 3-5 minutes but weakens comebacks, so the rules keep -3. Default games are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
-5
@@ -68,7 +68,7 @@ def test_sim_prints_a_summary_per_scenario_and_writes_games(
|
||||
assert main([*argv, "--csv", str(games)]) == EXIT_OK
|
||||
|
||||
output = capsys.readouterr().out
|
||||
assert "== exam:none p3 kiai+2 start0 balanced,farmer,aggressive (2 games" in output
|
||||
assert "== exam:none p3 kiai+2 start0 fail-3 balanced,farmer,aggressive (2 games" in output
|
||||
assert "== exam:c p3 kiai+2 start0" in output
|
||||
rows = games.read_text(encoding="utf-8").splitlines()
|
||||
assert rows[0].startswith("scenario,seed,lineup,winner_seat")
|
||||
@@ -78,21 +78,25 @@ def test_sim_prints_a_summary_per_scenario_and_writes_games(
|
||||
def test_sim_writes_one_summary_row_per_scenario(tmp_path: Path) -> None:
|
||||
path = tmp_path / "summary.csv"
|
||||
argv = ["sim", "--games", "2", "--players", "3", "4", "--lineup", "casual", "--jobs", "1"]
|
||||
argv += ["--exam-loss", "3", "0"]
|
||||
|
||||
assert main([*argv, "--summary-csv", str(path)]) == EXIT_OK
|
||||
|
||||
with path.open(encoding="utf-8", newline="") as file:
|
||||
rows = list(csv.DictReader(file))
|
||||
assert [row["scenario"] for row in rows] == [
|
||||
"exam:c p3 kiai+2 start0 casual",
|
||||
"exam:c p4 kiai+2 start0 casual",
|
||||
"exam:c p3 kiai+2 start0 fail-3 casual",
|
||||
"exam:c p3 kiai+2 start0 fail-0 casual",
|
||||
"exam:c p4 kiai+2 start0 fail-3 casual",
|
||||
"exam:c p4 kiai+2 start0 fail-0 casual",
|
||||
]
|
||||
assert {"rounds_mean", "square_gain_per_turn", "win_rate_casual"} <= rows[0].keys()
|
||||
assert (rows[0]["seat3_win_rate"], rows[1]["seat3_win_rate"] != "") == ("", True)
|
||||
assert (rows[0]["seat3_win_rate"], rows[2]["seat3_win_rate"] != "") == ("", True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"bad", [["--lineup", "balanced,cheater"], ["--games", "0"], ["--exam", "b"]]
|
||||
"bad",
|
||||
[["--lineup", "balanced,cheater"], ["--games", "0"], ["--exam", "b"], ["--exam-loss", "-1"]],
|
||||
)
|
||||
def test_sim_rejects_bad_arguments(bad: list[str], capsys: pytest.CaptureFixture[str]) -> None:
|
||||
with pytest.raises(SystemExit) as exit_info:
|
||||
|
||||
Reference in New Issue
Block a user