Commit 67c7736
committed
Abandon setups that are unlikely to win
2018 day 24 is somewhat input sensitive; on my machine, my input file
completed in 2.5ms at a boost of 42, but another one scraped from the
megathread took 5.0ms and had to reach a boost of 90. With some
tracing, I observed that the higher the boost got, the closer the
ratio between baseline infect_hp/immune_eff vs. immune_hp/infect_eff.
It is still possible to win even when the ratios are not equal (thanks
to the group attributes tweaking actual damage), but appears that any
difference larger than double is going to favor the infection - there
simply won't be enough hit points to survive long enough for immune to
win.
Capture this as a heuristic to bypass low-value boosts, so that the
time is spent on battles more likely to matter. For the files I
tested, this cuts runtime on my machine to 2.0ms, regardless of
whether the pre-patch file was 2.5ms or 5.0ms.1 parent 114bd19 commit 67c7736
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
| |||
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
| |||
118 | 126 | | |
119 | 127 | | |
120 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
121 | 141 | | |
122 | 142 | | |
123 | 143 | | |
| |||
0 commit comments