Skip to content

Fight goldens in CI: a change that moves fight odds re-blesses them - #92

Merged
calebl merged 1 commit into
mainfrom
fm/ta-fight-sim-2
Oct 30, 2026
Merged

calebl merged 1 commit into
mainfrom
fm/ta-fight-sim-2

Conversation

@calebl

@calebl calebl commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Stage 2 of the fight simulator (stage 1: #91): ten standard fights are now checked against kept results in CI, so a change that moves fight odds has to show and re-bless the new table in the same PR.

  • sim/goldens/*.yml: ten standard matchups at fixed seeds (1..25 each). sim/goldens/*.txt holds the table each one prints.
  • fight --check sim plays them and fails on any table that moved, a table with no matchup, or a matchup with no table. fight --write sim re-blesses only the tables that moved (src/sim/golden.rs).
  • CI: a new step beside the parity check, cargo run --release --locked --bin fight -- --check sim. It plays 250 fights in about 2.6s on 2 cores; parity's check takes 2.7s on the same cores.
  • README, "Rules for changing it": a change that moves fight odds re-blesses the goldens in the same PR.
  • .gitattributes: sim/** -text, so Windows checks the tables out byte for byte.
  • fight MATCHUP.yml prints its text table through the same golden::table, so a golden matches what you see at the terminal.

Testing:

  • fmt and clippy -D warnings are clean, and tests/sim.rs passes.
  • --check passes on the current rules.
  • A hand-edited table fails with a kept/played diff and the re-bless hint.

The 25-seed tables are for detecting change, not for precision: every die is seeded, so any rule that moves a roll changes the text. Odds studies still use sim/matchups at 2,000 seeds. No rule or server change.

The golden tables

01-one-l1-d8: 25 fights, seeds 1..25, told driver, policy attack
              rate   95% interval
  won        1.000   [0.867, 1.000]
  died       0.000   [0.000, 0.133]
  fled       0.000   [0.000, 0.133]
  rounds         mean 2.28   1:4 2:12 3:7 4:2
  hp left        mean 12.12   2:1 4:1 5:1 7:1 10:3 11:2 12:5 13:2 14:1 15:3 16:1 18:4 (survivors)
  damage         taken 5.88, dealt 10.56 a fight
  blows          taken 1.28, struck 2.28 a fight
02-one-l3-d10: 25 fights, seeds 1..25, told driver, policy attack
              rate   95% interval
  won        0.320   [0.172, 0.516]
  died       0.680   [0.484, 0.828]
  fled       0.000   [0.000, 0.133]
  rounds         mean 4.08   3:4 4:15 5:6
  hp left        mean 3.50   1:1 2:2 3:3 5:1 9:1 (survivors)
  damage         taken 19.16, dealt 18.28 a fight
  blows          taken 3.76, struck 4.08 a fight
03-three-l1-d6: 25 fights, seeds 1..25, told driver, policy attack
              rate   95% interval
  won        0.160   [0.064, 0.347]
  died       0.840   [0.653, 0.936]
  fled       0.000   [0.000, 0.133]
  rounds         mean 2.92   1:1 2:9 3:9 4:4 5:1 6:1
  hp left        mean 2.75   2:2 3:1 4:1 (survivors)
  damage         taken 18.88, dealt 12.20 a fight
  blows          taken 5.20, struck 2.92 a fight
04-one-l2-d8-mechanics: 25 fights, seeds 1..25, mechanics driver, policy attack
              rate   95% interval
  won        0.840   [0.653, 0.936]
  died       0.160   [0.064, 0.347]
  fled       0.000   [0.000, 0.133]
  rounds         mean 3.16   2:8 3:6 4:10 5:1
  hp left        mean 8.86   1:1 2:1 4:3 6:5 7:1 10:2 11:1 13:2 14:1 15:2 16:1 17:1 (survivors)
  damage         taken 10.92, dealt 14.72 a fight
  blows          taken 2.32, struck 3.16 a fight
05-one-l2-d8-flee: 25 fights, seeds 1..25, told driver, policy flee_below
              rate   95% interval
  won        0.400   [0.234, 0.593]
  died       0.320   [0.172, 0.516]
  fled       0.280   [0.143, 0.476]
  rounds         mean 2.92   2:8 3:11 4:6
  hp left        mean 9.18   1:1 2:2 3:2 5:1 6:1 10:2 11:1 13:2 14:1 15:2 16:1 17:1 (survivors)
  damage         taken 12.32, dealt 11.20 a fight
  blows          taken 2.52, struck 2.32 a fight
06-two-l2-d10-flee: 25 fights, seeds 1..25, told driver, policy flee_below
              rate   95% interval
  won        0.000   [0.000, 0.133]
  died       1.000   [0.867, 1.000]
  fled       0.000   [0.000, 0.133]
  rounds         mean 2.72   2:12 3:8 4:5
  hp left        (nobody survived)
  damage         taken 27.36, dealt 3.12 a fight
  blows          taken 5.04, struck 0.72 a fight
  used           drinks 0.84, throws 1.00 a fight
07-one-l3-d10-drink: 25 fights, seeds 1..25, told driver, policy drink_below
              rate   95% interval
  won        0.560   [0.371, 0.733]
  died       0.440   [0.267, 0.629]
  fled       0.000   [0.000, 0.133]
  rounds         mean 5.04   3:1 4:7 5:10 6:4 7:3
  hp left        mean 5.50   1:2 2:2 3:1 5:3 8:3 9:2 11:1 (survivors)
  damage         taken 23.88, dealt 20.48 a fight
  blows          taken 4.48, struck 4.12 a fight
  used           drinks 0.92, throws 0.00 a fight
08-two-l1-rolled: 25 fights, seeds 1..25, told driver, policy attack
              rate   95% interval
  won        0.480   [0.300, 0.665]
  died       0.520   [0.335, 0.700]
  fled       0.000   [0.000, 0.133]
  rounds         mean 2.96   2:9 3:9 4:6 5:1
  hp left        mean 7.25   1:1 2:1 3:2 6:2 8:1 9:1 10:1 11:1 13:1 15:1 (survivors)
  damage         taken 15.68, dealt 13.92 a fight
  blows          taken 3.44, struck 2.96 a fight
09-careful: 25 fights, seeds 1..25, told driver, policy careful
              rate   95% interval
  won        0.160   [0.064, 0.347]
  died       0.360   [0.202, 0.555]
  fled       0.480   [0.300, 0.665]
  rounds         mean 2.24   1:8 2:5 3:11 5:1
  hp left        mean 7.69   1:1 2:2 4:3 5:1 7:1 8:1 11:3 12:1 13:2 15:1 (survivors)
  damage         taken 17.44, dealt 4.88 a fight
  blows          taken 3.52, struck 1.00 a fight
  used           drinks 0.40, throws 0.00 a fight
10-naive: 25 fights, seeds 1..25, told driver, policy naive
              rate   95% interval
  won        0.600   [0.407, 0.766]
  died       0.400   [0.234, 0.593]
  fled       0.000   [0.000, 0.133]
  rounds         mean 3.44   2:8 3:5 4:6 5:5 6:1
  hp left        mean 7.47   2:1 3:4 6:2 8:1 9:2 10:1 11:2 13:1 15:1 (survivors)
  damage         taken 18.36, dealt 13.88 a fight
  blows          taken 3.92, struck 2.92 a fight
  used           drinks 0.52, throws 0.00 a fight

@calebl
calebl merged commit b733917 into main Oct 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant