diff --git a/tests/Lodur.Core.Tests/ActorTests.cs b/tests/Lodur.Core.Tests/ActorTests.cs
index f462cf8..b95b769 100644
--- a/tests/Lodur.Core.Tests/ActorTests.cs
+++ b/tests/Lodur.Core.Tests/ActorTests.cs
@@ -84,6 +84,45 @@ public sealed class ActorTests
Assert.Equal(PainBoxReplay.Withdraw[0].W, r.Targets[0].W, 5);
}
+ [Fact]
+ public void Resolve_recovers_when_the_box_goes_quiet_and_not_when_recovery_is_off()
+ {
+ static double Resolve(double recovery)
+ {
+ var r = new PainBoxReplay(1, drive: new DriveParameters { ResolveRecovery = recovery });
+ for (var i = 0; i < 400; i++) r.Tick(); // 4 s in the box: resolve is down a little, will intact
+ var low = r.Actor.Drive.Resolve;
+ Assert.InRange(low, 0.85, 0.97);
+ for (var i = 0; i < 20000; i++) r.Tick(boxOn: false); // 200 s quiet: pain falls under the recovery line
+ Assert.False(r.Actor.Drive.WillBroken);
+ return r.Actor.Drive.Resolve - low;
+ }
+ Assert.True(Resolve(0.02) > 0.04); // recovers what it lost
+ Assert.True(Resolve(0.0) <= 0.0); // with recovery off it never rises (lingering pain still drains it)
+ }
+
+ [Fact]
+ public void A_flinch_is_a_suppressed_reflex_leaking_so_none_is_reported_after_the_will_breaks()
+ {
+ // Across seeds, some runs have a leak over the threshold, outside the refractory window, in the ticks
+ // between WillBroke and Withdrew (BDS counts none there). The golden table pins the totals; this pins the rule.
+ var sawLeakAfterBreak = 0;
+ for (ulong seed = 1; seed <= 60; seed++)
+ {
+ var r = new PainBoxReplay(seed);
+ var broke = false;
+ for (var i = 0; i < 4000; i++)
+ {
+ var e = r.Tick();
+ if (broke) Assert.Equal(0, (int)(e & TickEvents.Flinch));
+ broke |= (e & TickEvents.WillBroke) != 0;
+ if ((e & TickEvents.Withdrew) != 0) break;
+ }
+ sawLeakAfterBreak += broke ? 1 : 0;
+ }
+ Assert.Equal(60, sawLeakAfterBreak);
+ }
+
private static long BreakTick(double intensity, double pull)
{
var (broke, _, _) = new PainBoxReplay(1, intensity, pull).Run(3000.0);
diff --git a/tests/Lodur.Core.Tests/GoldenParityTests.cs b/tests/Lodur.Core.Tests/GoldenParityTests.cs
new file mode 100644
index 0000000..508be6e
--- /dev/null
+++ b/tests/Lodur.Core.Tests/GoldenParityTests.cs
@@ -0,0 +1,65 @@
+using System.Globalization;
+using Lodur;
+
+namespace Lodur.Core.Tests;
+
+///
+/// The Actor against Bad Day Simulator's pain box at 9f59764, which that repo deletes in its next cut:
+/// pain-box-golden.tsv holds, for 7 intensity/pull settings x seeds 1-60, the outcome and a hash of the
+/// per-tick stimulus, pain, strain, resolve and goal stream. Regenerate with tools/pain-box-golden/generate.sh.
+///
+public sealed class GoldenParityTests
+{
+ private sealed record Row(ulong Seed, double Intensity, double Pull, string Outcome, long BreakMs, long EndMs, int Flinches, long Ticks, ulong Hash);
+
+ private static IEnumerable Rows()
+ {
+ foreach (var line in File.ReadLines(Path.Combine(AppContext.BaseDirectory, "pain-box-golden.tsv")))
+ {
+ if (line.StartsWith('#') || string.IsNullOrWhiteSpace(line)) continue;
+ var f = line.Trim().Split(' ');
+ yield return new Row(ulong.Parse(f[0]), double.Parse(f[1], CultureInfo.InvariantCulture), double.Parse(f[2], CultureInfo.InvariantCulture),
+ f[3], long.Parse(f[4]), long.Parse(f[5]), int.Parse(f[6]), long.Parse(f[7]), Convert.ToUInt64(f[8], 16));
+ }
+ }
+
+ [Fact]
+ public void The_actor_reproduces_the_pain_box_golden_table_exactly()
+ {
+ var rows = Rows().ToList();
+ Assert.Equal(420, rows.Count);
+ Assert.Contains(rows, r => r.Outcome == "Endured");
+ Assert.Contains(rows, r => r.Outcome == "WillBroke");
+
+ var bad = new List();
+ foreach (var row in rows)
+ {
+ var replay = new PainBoxReplay(row.Seed, row.Intensity, row.Pull);
+ var h = 14695981039346656037ul;
+ void Byte(byte b) { h ^= b; h *= 1099511628211ul; }
+ void Double(double d) { foreach (var b in BitConverter.GetBytes(BitConverter.DoubleToInt64Bits(d))) Byte(b); }
+
+ long ticks = 0, broke = -1, withdrew = -1;
+ var flinches = 0;
+ var max = (long)Math.Round(120.0 / PainBoxReplay.Dt);
+ for (long i = 0; i <= max && withdrew < 0; i++)
+ {
+ var e = replay.Tick();
+ ticks++;
+ if ((e & TickEvents.Flinch) != 0) flinches++;
+ if ((e & TickEvents.WillBroke) != 0) broke = i;
+ if ((e & TickEvents.Withdrew) != 0) withdrew = i;
+ var d = replay.Actor.Drive;
+ Double(replay.Actor.Stimulus(0)); Double(d.Pain); Double(d.Strain); Double(d.Resolve);
+ Byte((byte)(replay.Actor.Goal == Goal.Hold ? 0 : 1));
+ }
+
+ var ms = (long)Math.Round(withdrew >= 0 ? withdrew * 10.0 : max * 10.0);
+ var got = $"{(broke >= 0 ? "WillBroke" : "Endured")} {(broke >= 0 ? broke * 10 : -1)} {ms} {flinches} {ticks} {h:x16}";
+ var want = $"{row.Outcome} {row.BreakMs} {row.EndMs} {row.Flinches} {row.Ticks} {row.Hash:x16}";
+ if (got != want) bad.Add($"seed {row.Seed} i={row.Intensity} p={row.Pull}: got [{got}] want [{want}]");
+ }
+
+ Assert.True(bad.Count == 0, $"{bad.Count} of {rows.Count} runs differ; first: {bad.FirstOrDefault()}");
+ }
+}
diff --git a/tests/Lodur.Core.Tests/Lodur.Core.Tests.csproj b/tests/Lodur.Core.Tests/Lodur.Core.Tests.csproj
index 4854a3f..617d2d1 100644
--- a/tests/Lodur.Core.Tests/Lodur.Core.Tests.csproj
+++ b/tests/Lodur.Core.Tests/Lodur.Core.Tests.csproj
@@ -19,6 +19,7 @@
+
diff --git a/tests/Lodur.Core.Tests/PainBoxReplay.cs b/tests/Lodur.Core.Tests/PainBoxReplay.cs
index 8ac0d4c..46ba6ce 100644
--- a/tests/Lodur.Core.Tests/PainBoxReplay.cs
+++ b/tests/Lodur.Core.Tests/PainBoxReplay.cs
@@ -49,12 +49,12 @@ internal sealed class PainBoxReplay
}
/// One tick of the replayed stimulus; the tick index is Actor.TickCount before the call.
- public TickEvents Tick()
+ public TickEvents Tick(bool boxOn = true)
{
var tick = Actor.TickCount;
var noise = _rng.NextSigned();
var ramp = Math.Min(1.0, tick * Dt / 2.0);
- Sources[0].Intensity = Math.Max(0.0, _intensity * ramp * (1.0 + 0.1 * noise));
+ Sources[0].Intensity = boxOn ? Math.Max(0.0, _intensity * ramp * (1.0 + 0.1 * noise)) : 0.0;
return Actor.Tick(_p, _p, _p, Sources, Strengths, Targets);
}
diff --git a/tests/Lodur.Core.Tests/pain-box-golden.tsv b/tests/Lodur.Core.Tests/pain-box-golden.tsv
new file mode 100644
index 0000000..37ad24d
--- /dev/null
+++ b/tests/Lodur.Core.Tests/pain-box-golden.tsv
@@ -0,0 +1,422 @@
+# Generated by tools/pain-box-golden/generate.sh from BadDaySimulator 9f59764 PainBoxSimulation (tick 10 ms, one sample row per tick). Do not edit.
+# seed intensity pull outcome break_ms end_ms flinches ticks hash
+1 0.8 0.5 WillBroke 14730 14830 16 1484 1ceb743a21f5ff5a
+2 0.8 0.5 WillBroke 14600 14700 16 1471 7259484084f5a927
+3 0.8 0.5 WillBroke 16520 16620 16 1663 1d6bba4a157df7a6
+4 0.8 0.5 WillBroke 14660 14760 15 1477 e5eebd484761de72
+5 0.8 0.5 WillBroke 15270 15370 16 1538 3c4747a8445cefd7
+6 0.8 0.5 WillBroke 15160 15260 17 1527 195b3053e604f362
+7 0.8 0.5 WillBroke 18400 18500 20 1851 9f21e1a7ce0e8e45
+8 0.8 0.5 WillBroke 14950 15050 16 1506 70030d48d40f4b19
+9 0.8 0.5 WillBroke 14330 14430 16 1444 42e87dc3299a52ac
+10 0.8 0.5 WillBroke 16720 16820 16 1683 ac540aa974f86a3d
+11 0.8 0.5 WillBroke 17460 17560 18 1757 27c1801dd3b14200
+12 0.8 0.5 WillBroke 14090 14190 15 1420 319ec304c2b2cc96
+13 0.8 0.5 WillBroke 15470 15570 17 1558 c5df29d2946eb2d0
+14 0.8 0.5 WillBroke 17950 18050 20 1806 9ae75b13832bd3e4
+15 0.8 0.5 WillBroke 14730 14830 16 1484 9d430ea61e812af0
+16 0.8 0.5 WillBroke 18100 18200 20 1821 8e5fb25cbd4fb1fe
+17 0.8 0.5 WillBroke 16190 16290 18 1630 05610c511c4d19c1
+18 0.8 0.5 WillBroke 16630 16730 16 1674 f5e2796f88e62ef6
+19 0.8 0.5 WillBroke 16540 16640 18 1665 b25f6c3df9d287d6
+20 0.8 0.5 WillBroke 19200 19300 20 1931 bfd2524973119a17
+21 0.8 0.5 WillBroke 16150 16250 16 1626 125a8dcf62f71b8a
+22 0.8 0.5 WillBroke 13550 13650 15 1366 7507771068c765e1
+23 0.8 0.5 WillBroke 14200 14300 16 1431 3bcf5023b59ce3a8
+24 0.8 0.5 WillBroke 14710 14810 16 1482 1a491d9500a4ee8a
+25 0.8 0.5 WillBroke 16820 16920 19 1693 f0830cd17098c811
+26 0.8 0.5 WillBroke 15070 15170 17 1518 c9e6b86dbee77d05
+27 0.8 0.5 WillBroke 14840 14940 16 1495 5e57b1ae95415f2d
+28 0.8 0.5 WillBroke 14770 14870 16 1488 2c0b8e2781a51ee3
+29 0.8 0.5 WillBroke 14250 14350 16 1436 c32ad3049a90f668
+30 0.8 0.5 WillBroke 14500 14600 16 1461 4910c161327cdb00
+31 0.8 0.5 WillBroke 13930 14030 15 1404 1bdcd50e804b9bdd
+32 0.8 0.5 WillBroke 14180 14280 16 1429 2ab161925bd68a7e
+33 0.8 0.5 WillBroke 19070 19170 20 1918 5c18119adec71cce
+34 0.8 0.5 WillBroke 14590 14690 15 1470 64587cd7060ee804
+35 0.8 0.5 WillBroke 16120 16220 17 1623 78ac045afa3e8511
+36 0.8 0.5 WillBroke 15050 15150 17 1516 82450899d9167065
+37 0.8 0.5 WillBroke 14190 14290 16 1430 ae4a4d35b3f54257
+38 0.8 0.5 WillBroke 16400 16500 19 1651 e0ea8c58df2c29c5
+39 0.8 0.5 WillBroke 13580 13680 15 1369 6d1697c268835c76
+40 0.8 0.5 WillBroke 15190 15290 15 1530 3c4a7a8be8eb2453
+41 0.8 0.5 WillBroke 17060 17160 17 1717 38ae8fdfa2ca5b91
+42 0.8 0.5 WillBroke 16310 16410 18 1642 3ff1fef4fb1442de
+43 0.8 0.5 WillBroke 14650 14750 16 1476 19f85bbaf383110c
+44 0.8 0.5 WillBroke 14110 14210 16 1422 027af17c0ac0fdc7
+45 0.8 0.5 WillBroke 12960 13060 14 1307 d1fb96d0ee7ba804
+46 0.8 0.5 WillBroke 16280 16380 18 1639 c8e839df23f5a211
+47 0.8 0.5 WillBroke 16600 16700 18 1671 e7f53b160c1853ae
+48 0.8 0.5 WillBroke 17070 17170 16 1718 aeec09055f384b43
+49 0.8 0.5 WillBroke 17970 18070 18 1808 f212a3419dd45eb8
+50 0.8 0.5 WillBroke 14720 14820 16 1483 138dc377b6038fc6
+51 0.8 0.5 WillBroke 17000 17100 18 1711 91bf94bf4f9b80a9
+52 0.8 0.5 WillBroke 15330 15430 18 1544 479d44543e6d898f
+53 0.8 0.5 WillBroke 16910 17010 19 1702 23c9ae667a13b1b8
+54 0.8 0.5 WillBroke 15710 15810 18 1582 5db0798e7430331f
+55 0.8 0.5 WillBroke 18080 18180 20 1819 bb57883965df4728
+56 0.8 0.5 WillBroke 14690 14790 16 1480 db298aebc9ac6475
+57 0.8 0.5 WillBroke 17110 17210 18 1722 a8b179b65459b425
+58 0.8 0.5 WillBroke 16040 16140 17 1615 9311f9bf9c30c9fa
+59 0.8 0.5 WillBroke 15280 15380 17 1539 d357274a150ed640
+60 0.8 0.5 WillBroke 16430 16530 18 1654 dce27d808a54e389
+1 1.0 0.5 WillBroke 12700 12800 15 1281 3778c1c08b0e4636
+2 1.0 0.5 WillBroke 12590 12690 15 1270 d2e72be9df803e3d
+3 1.0 0.5 WillBroke 14160 14260 16 1427 0b18cbb4d9d49fbb
+4 1.0 0.5 WillBroke 12650 12750 15 1276 da78405420316abd
+5 1.0 0.5 WillBroke 13140 13240 15 1325 c95a030fe020dd7a
+6 1.0 0.5 WillBroke 13040 13140 16 1315 44fd3277642c8a9a
+7 1.0 0.5 WillBroke 15660 15760 19 1577 017b21240992c769
+8 1.0 0.5 WillBroke 12880 12980 15 1299 599e66b4a1a5921e
+9 1.0 0.5 WillBroke 12370 12470 15 1248 cb45d1000cf1ea08
+10 1.0 0.5 WillBroke 14320 14420 16 1443 32fa60bc328344e0
+11 1.0 0.5 WillBroke 14910 15010 17 1502 fe8e6683df6f44c1
+12 1.0 0.5 WillBroke 12180 12280 14 1229 d7ceb4d09ec176aa
+13 1.0 0.5 WillBroke 13290 13390 16 1340 e8036a983b52c1ab
+14 1.0 0.5 WillBroke 15310 15410 18 1542 0b8a9b1c08492fbe
+15 1.0 0.5 WillBroke 12700 12800 15 1281 a8ed8929fa4337f0
+16 1.0 0.5 WillBroke 15430 15530 18 1554 eb95c4903824bb05
+17 1.0 0.5 WillBroke 13890 13990 16 1400 6db1399b0be214fa
+18 1.0 0.5 WillBroke 14250 14350 15 1436 535d36145c307a6a
+19 1.0 0.5 WillBroke 14160 14260 17 1427 547e4a683939cf31
+20 1.0 0.5 WillBroke 16310 16410 19 1642 0653fd31b3fc42d8
+21 1.0 0.5 WillBroke 13860 13960 15 1397 abb9fb41943aed14
+22 1.0 0.5 WillBroke 11720 11820 14 1183 1174869087f230c6
+23 1.0 0.5 WillBroke 12260 12360 15 1237 d5074ba63114d34f
+24 1.0 0.5 WillBroke 12680 12780 15 1279 d075ca28021bcb2f
+25 1.0 0.5 WillBroke 14390 14490 18 1450 ca018f228e141313
+26 1.0 0.5 WillBroke 12970 13070 16 1308 3c559d5142622b8a
+27 1.0 0.5 WillBroke 12790 12890 15 1290 04d51fbe35ed5cd5
+28 1.0 0.5 WillBroke 12730 12830 15 1284 e32fd88365db7019
+29 1.0 0.5 WillBroke 12300 12400 15 1241 e865da9fc3e136dd
+30 1.0 0.5 WillBroke 12500 12600 15 1261 ee7b9626cecaa543
+31 1.0 0.5 WillBroke 12030 12130 15 1214 58cfcc93405f718b
+32 1.0 0.5 WillBroke 12240 12340 15 1235 4a7a33fc862b87b6
+33 1.0 0.5 WillBroke 16210 16310 19 1632 a4321c62d0942b51
+34 1.0 0.5 WillBroke 12580 12680 15 1269 8d8084c506399075
+35 1.0 0.5 WillBroke 13830 13930 16 1394 80eab6a1a91fe47e
+36 1.0 0.5 WillBroke 12960 13060 16 1307 a3bf0483a30b9832
+37 1.0 0.5 WillBroke 12250 12350 15 1236 591a92e077f7fb7e
+38 1.0 0.5 WillBroke 14040 14140 17 1415 a37a6c6e88296d4c
+39 1.0 0.5 WillBroke 11750 11850 14 1186 c8e91a1813d1cf7f
+40 1.0 0.5 WillBroke 13080 13180 14 1319 59ad5f054dacf9b5
+41 1.0 0.5 WillBroke 14600 14700 16 1471 d6c53c1e324f31bc
+42 1.0 0.5 WillBroke 13980 14080 17 1409 82171315883210d2
+43 1.0 0.5 WillBroke 12620 12720 15 1273 cf5f3536022121f2
+44 1.0 0.5 WillBroke 12180 12280 15 1229 c9f7c2acacdc2a4f
+45 1.0 0.5 WillBroke 11230 11330 14 1134 e4dcb7f2fca454aa
+46 1.0 0.5 WillBroke 13950 14050 17 1406 4f6631c906041c50
+47 1.0 0.5 WillBroke 14210 14310 17 1432 94971d9adbcce7f4
+48 1.0 0.5 WillBroke 14610 14710 16 1472 52b86bd6f4d01970
+49 1.0 0.5 WillBroke 15330 15430 17 1544 b76a0e4f82a8f139
+50 1.0 0.5 WillBroke 12690 12790 15 1280 f3859d8ebae145f7
+51 1.0 0.5 WillBroke 14540 14640 17 1465 d54f534dbfd8ac98
+52 1.0 0.5 WillBroke 13170 13270 16 1328 e3ba704a9ee1a898
+53 1.0 0.5 WillBroke 14450 14550 18 1456 09513ed8620db12f
+54 1.0 0.5 WillBroke 13500 13600 16 1361 fa700ae33783c44b
+55 1.0 0.5 WillBroke 15410 15510 18 1552 37ce852a8984b97a
+56 1.0 0.5 WillBroke 12670 12770 15 1278 138a00120ccb00fe
+57 1.0 0.5 WillBroke 14630 14730 17 1474 18f604c62fdf14cf
+58 1.0 0.5 WillBroke 13760 13860 16 1387 40a380177cc0fb2f
+59 1.0 0.5 WillBroke 13150 13250 15 1326 cbb58f0ec6aacce2
+60 1.0 0.5 WillBroke 14070 14170 17 1418 fdd65da97d503bea
+1 0.6 0.5 WillBroke 18150 18250 16 1826 6ba0eac35d362331
+2 0.6 0.5 WillBroke 17970 18070 16 1808 e9a49730ebc3284e
+3 0.6 0.5 WillBroke 20530 20630 17 2064 f35e11a268ee6e5b
+4 0.6 0.5 WillBroke 18050 18150 16 1816 7f4d381a70594785
+5 0.6 0.5 WillBroke 18850 18950 16 1896 2255227b0f0566a4
+6 0.6 0.5 WillBroke 18740 18840 18 1885 77671a7b01e433c1
+7 0.6 0.5 WillBroke 23130 23230 21 2324 6d6875964a164a26
+8 0.6 0.5 WillBroke 18450 18550 17 1856 89995e2334a69fc4
+9 0.6 0.5 WillBroke 17630 17730 16 1774 3a57554bfdae952c
+10 0.6 0.5 WillBroke 20780 20880 16 2089 92d0d3ee482673bb
+11 0.6 0.5 WillBroke 21820 21920 20 2193 499413f37856cc67
+12 0.6 0.5 WillBroke 17300 17400 15 1741 cf400e983b9ab384
+13 0.6 0.5 WillBroke 19160 19260 18 1927 cc9cd1d981969951
+14 0.6 0.5 WillBroke 22520 22620 21 2263 ed6838239b11bc75
+15 0.6 0.5 WillBroke 18130 18230 16 1824 d749947d1fa45774
+16 0.6 0.5 WillBroke 22710 22810 21 2282 bda734962c5606f0
+17 0.6 0.5 WillBroke 20110 20210 18 2022 35e19cd78e4681c5
+18 0.6 0.5 WillBroke 20680 20780 16 2079 044b17ae0c8f471d
+19 0.6 0.5 WillBroke 20600 20700 20 2071 6bc5d68ea6d37f58
+20 0.6 0.5 WillBroke 24210 24310 21 2432 a8ea7744a790f179
+21 0.6 0.5 WillBroke 20020 20120 15 2013 024dc742aba6d11e
+22 0.6 0.5 WillBroke 16590 16690 16 1670 1ed9990a7a83680d
+23 0.6 0.5 WillBroke 17460 17560 17 1757 2f5c8bb3f7fbce51
+24 0.6 0.5 WillBroke 18120 18220 17 1823 39e31936bdc74dca
+25 0.6 0.5 WillBroke 20980 21080 20 2109 0c545a97c49f67d0
+26 0.6 0.5 WillBroke 18610 18710 18 1872 b84cafd2a5e955fd
+27 0.6 0.5 WillBroke 18300 18400 17 1841 7610f4a37901d7da
+28 0.6 0.5 WillBroke 18190 18290 17 1830 87c68d8444be7fe2
+29 0.6 0.5 WillBroke 17520 17620 16 1763 64e7b957cc2182a1
+30 0.6 0.5 WillBroke 17850 17950 16 1796 b318302a3ff94a1b
+31 0.6 0.5 WillBroke 17100 17200 16 1721 ab156f4dcec9413a
+32 0.6 0.5 WillBroke 17430 17530 17 1754 3505a668df088e29
+33 0.6 0.5 WillBroke 24030 24130 21 2414 62dad0cd6de6c6ad
+34 0.6 0.5 WillBroke 17960 18060 16 1807 468f81ede64f7032
+35 0.6 0.5 WillBroke 19990 20090 17 2010 8425b945af3a5546
+36 0.6 0.5 WillBroke 18600 18700 18 1871 2ada8cd49c8d5762
+37 0.6 0.5 WillBroke 17440 17540 17 1755 a98e38b6442eaf84
+38 0.6 0.5 WillBroke 20440 20540 21 2055 7762c24c4c087ea3
+39 0.6 0.5 WillBroke 16640 16740 16 1675 948a96907d9eefc0
+40 0.6 0.5 WillBroke 18740 18840 15 1885 cf3d3003437065ba
+41 0.6 0.5 WillBroke 21260 21360 17 2137 42ef7102a413d1c0
+42 0.6 0.5 WillBroke 20280 20380 20 2039 dcf19acb186b9283
+43 0.6 0.5 WillBroke 18040 18140 17 1815 a2b7896cebd7012a
+44 0.6 0.5 WillBroke 17340 17440 17 1745 ae0d1f06637ac29e
+45 0.6 0.5 WillBroke 15820 15920 15 1593 34ed73b3ed021ee4
+46 0.6 0.5 WillBroke 20240 20340 20 2035 1327132bbc471b49
+47 0.6 0.5 WillBroke 20670 20770 19 2078 6ed62543a7d622f7
+48 0.6 0.5 WillBroke 21260 21360 16 2137 7852586cc5440810
+49 0.6 0.5 WillBroke 22500 22600 19 2261 e5cb75e99d5282f9
+50 0.6 0.5 WillBroke 18130 18230 17 1824 b6ab5edaaf877789
+51 0.6 0.5 WillBroke 21210 21310 19 2132 41ac950e5cfaa653
+52 0.6 0.5 WillBroke 18990 19090 19 1910 413ccf741adabd38
+53 0.6 0.5 WillBroke 21110 21210 21 2122 36abd4e8cfe6083a
+54 0.6 0.5 WillBroke 19460 19560 19 1957 cab475fe2176ba46
+55 0.6 0.5 WillBroke 22700 22800 21 2281 4621276ba4894fea
+56 0.6 0.5 WillBroke 18100 18200 17 1821 ec9a774751bdedbf
+57 0.6 0.5 WillBroke 21340 21440 18 2145 5709bbcab913e98c
+58 0.6 0.5 WillBroke 19910 20010 18 2002 d16492ba1669abb8
+59 0.6 0.5 WillBroke 18890 18990 17 1900 f36f53cb80836d5e
+60 0.6 0.5 WillBroke 20450 20550 20 2056 c118dd86c7e0945f
+1 0.8 0.0 WillBroke 10070 10170 10 1018 1914ad90455159e8
+2 0.8 0.0 WillBroke 9990 10090 10 1010 3d6287598c77d9e3
+3 0.8 0.0 WillBroke 11160 11260 10 1127 7476613d96868cc1
+4 0.8 0.0 WillBroke 10030 10130 10 1014 50107275381fd7aa
+5 0.8 0.0 WillBroke 10400 10500 10 1051 d287687d8bf0078e
+6 0.8 0.0 WillBroke 10340 10440 11 1045 6ce913c53b72daf4
+7 0.8 0.0 WillBroke 12300 12400 12 1241 bc0a4e85028ea794
+8 0.8 0.0 WillBroke 10210 10310 10 1032 9d817ecb6fe288ee
+9 0.8 0.0 WillBroke 9820 9920 10 993 92da81d6468ebe82
+10 0.8 0.0 WillBroke 11280 11380 10 1139 f2f9c86856025f04
+11 0.8 0.0 WillBroke 11730 11830 11 1184 9f0a0926039f3e52
+12 0.8 0.0 WillBroke 9690 9790 9 980 33b8c796b8fe56e5
+13 0.8 0.0 WillBroke 10530 10630 11 1064 bc70c2da7b3b974c
+14 0.8 0.0 WillBroke 12040 12140 12 1215 c95036c6977e1b59
+15 0.8 0.0 WillBroke 10080 10180 10 1019 373431a56c7b9101
+16 0.8 0.0 WillBroke 12130 12230 12 1224 02dcac6b7da6c93c
+17 0.8 0.0 WillBroke 10970 11070 11 1108 baed4dff515bc947
+18 0.8 0.0 WillBroke 11220 11320 10 1133 ed5b57045897960d
+19 0.8 0.0 WillBroke 11190 11290 11 1130 9e9829f5785c1567
+20 0.8 0.0 WillBroke 12780 12880 12 1289 b0ce6f3a04534a83
+21 0.8 0.0 WillBroke 10930 11030 10 1104 5f92a1c351fcaade
+22 0.8 0.0 WillBroke 9350 9450 9 946 685587a2ecb63f49
+23 0.8 0.0 WillBroke 9760 9860 10 987 46ca2993ce13d9b7
+24 0.8 0.0 WillBroke 10060 10160 10 1017 8bbb14c9c6edd738
+25 0.8 0.0 WillBroke 11360 11460 12 1147 ca7a2943fbf35fa7
+26 0.8 0.0 WillBroke 10290 10390 11 1040 c2615398937c44cf
+27 0.8 0.0 WillBroke 10140 10240 10 1025 2c11a0e93231978e
+28 0.8 0.0 WillBroke 10100 10200 10 1021 02996614f9d1b6ad
+29 0.8 0.0 WillBroke 9770 9870 10 988 ee1586d573ca55c9
+30 0.8 0.0 WillBroke 9930 10030 10 1004 cb05f8a9a91fd3fa
+31 0.8 0.0 WillBroke 9580 9680 10 969 e8ecae5902642a8d
+32 0.8 0.0 WillBroke 9740 9840 10 985 f136abd42fb6b90f
+33 0.8 0.0 WillBroke 12710 12810 12 1282 87209b5050bf4859
+34 0.8 0.0 WillBroke 9980 10080 10 1009 b910622b9c39d291
+35 0.8 0.0 WillBroke 10930 11030 10 1104 e910f01456aee3b6
+36 0.8 0.0 WillBroke 10290 10390 11 1040 2468ae1f05faa180
+37 0.8 0.0 WillBroke 9740 9840 10 985 bf0e779e9243fe83
+38 0.8 0.0 WillBroke 11110 11210 12 1122 cd1edafd69f799db
+39 0.8 0.0 WillBroke 9360 9460 10 947 0a9c9db826fd6fc3
+40 0.8 0.0 WillBroke 10350 10450 9 1046 8a695f2a7b77be08
+41 0.8 0.0 WillBroke 11500 11600 10 1161 773e9846d68e4563
+42 0.8 0.0 WillBroke 11050 11150 12 1116 971f9792bb5190a5
+43 0.8 0.0 WillBroke 10030 10130 10 1014 290e32ab22867eef
+44 0.8 0.0 WillBroke 9690 9790 10 980 abf81ab05a0351ab
+45 0.8 0.0 WillBroke 8970 9070 9 908 c51f9d6618059105
+46 0.8 0.0 WillBroke 11030 11130 11 1114 3eefac78a2ec93b0
+47 0.8 0.0 WillBroke 11210 11310 11 1132 c1f575d6e9da5621
+48 0.8 0.0 WillBroke 11500 11600 10 1161 cc56a243e423592f
+49 0.8 0.0 WillBroke 12040 12140 11 1215 ab73b8cd07be0649
+50 0.8 0.0 WillBroke 10080 10180 10 1019 5b3f678f2f519458
+51 0.8 0.0 WillBroke 11460 11560 11 1157 49df060130506ba9
+52 0.8 0.0 WillBroke 10440 10540 11 1055 a04eaacb8803cb78
+53 0.8 0.0 WillBroke 11410 11510 12 1152 47d7de117d48f625
+54 0.8 0.0 WillBroke 10700 10800 11 1081 2dc02e576db39ec7
+55 0.8 0.0 WillBroke 12120 12220 12 1223 b59afb6f495f92cc
+56 0.8 0.0 WillBroke 10050 10150 10 1016 96cd4b621eb75a64
+57 0.8 0.0 WillBroke 11520 11620 11 1163 6ace2627157a30f5
+58 0.8 0.0 WillBroke 10870 10970 11 1098 d24694742d029864
+59 0.8 0.0 WillBroke 10420 10520 10 1053 cb0148bdde051390
+60 0.8 0.0 WillBroke 11120 11220 11 1123 89dcecf0208bd4c5
+1 0.8 0.8 WillBroke 26100 26200 31 2621 facb758365f7865b
+2 0.8 0.8 WillBroke 25850 25950 31 2596 7d282a08b15832e4
+3 0.8 0.8 WillBroke 29980 30080 34 3009 f2ded9f2c282d18f
+4 0.8 0.8 WillBroke 25990 26090 31 2610 5bb9737062e3e1ff
+5 0.8 0.8 WillBroke 27260 27360 32 2737 4bd7db07086983d8
+6 0.8 0.8 WillBroke 27040 27140 34 2715 58790a7cd5034891
+7 0.8 0.8 WillBroke 34160 34260 43 3427 c3b1132c88b0087b
+8 0.8 0.8 WillBroke 26600 26700 32 2671 e4f42c7e9a769659
+9 0.8 0.8 WillBroke 25280 25380 31 2539 ae0029cabb1ecb76
+10 0.8 0.8 WillBroke 30440 30540 35 3055 075dfb3f39c9f414
+11 0.8 0.8 WillBroke 32040 32140 39 3215 6edcb217700a8f7c
+12 0.8 0.8 WillBroke 24790 24890 30 2490 f8491701247bcb39
+13 0.8 0.8 WillBroke 27710 27810 35 2782 cb475aee74befea5
+14 0.8 0.8 WillBroke 33180 33280 41 3329 8af0b8a0fd5e834b
+15 0.8 0.8 WillBroke 26070 26170 31 2618 e2fbd7aa00441616
+16 0.8 0.8 WillBroke 33480 33580 42 3359 cc06979bd8253d1c
+17 0.8 0.8 WillBroke 29220 29320 36 2933 34d06f9996dc6314
+18 0.8 0.8 WillBroke 30290 30390 35 3040 f30283d3d1284d9a
+19 0.8 0.8 WillBroke 29950 30050 38 3006 ed2ffeeb23e4d2c7
+20 0.8 0.8 WillBroke 35990 36090 44 3610 441d34847f7052a3
+21 0.8 0.8 WillBroke 29210 29310 33 2932 97b819d64521f3f1
+22 0.8 0.8 WillBroke 23650 23750 29 2376 4bece642126eda8e
+23 0.8 0.8 WillBroke 24990 25090 31 2510 707aeeeb6326f2a8
+24 0.8 0.8 WillBroke 26050 26150 32 2616 e019c2e195081ba6
+25 0.8 0.8 WillBroke 30630 30730 39 3074 4193242a4b0f92a4
+26 0.8 0.8 WillBroke 26800 26900 34 2691 ea4cd91c79d0dae5
+27 0.8 0.8 WillBroke 26360 26460 32 2647 41475b4e3dcc78b5
+28 0.8 0.8 WillBroke 26190 26290 32 2630 2812da5c40655627
+29 0.8 0.8 WillBroke 25110 25210 31 2522 f5cce351f754c3dc
+30 0.8 0.8 WillBroke 25630 25730 31 2574 da101fc4522fbef8
+31 0.8 0.8 WillBroke 24440 24540 30 2455 d1ed5841b8f3d2c7
+32 0.8 0.8 WillBroke 24950 25050 31 2506 7a853f4af1372d33
+33 0.8 0.8 WillBroke 35700 35800 43 3581 c19ba694b20e2224
+34 0.8 0.8 WillBroke 25830 25930 31 2594 1fe8515aa980c3e8
+35 0.8 0.8 WillBroke 29070 29170 35 2918 b471b626e0a26207
+36 0.8 0.8 WillBroke 26760 26860 34 2687 7b47afeb2bda4f09
+37 0.8 0.8 WillBroke 24960 25060 31 2507 70611ac9655b4130
+38 0.8 0.8 WillBroke 29720 29820 39 2983 29e31c8aedca1b66
+39 0.8 0.8 WillBroke 23720 23820 29 2383 e6b672c0d11de53f
+40 0.8 0.8 WillBroke 27150 27250 31 2726 228e1e1209860ccf
+41 0.8 0.8 WillBroke 31230 31330 36 3134 d8bd943c7794fb4d
+42 0.8 0.8 WillBroke 29450 29550 37 2956 99532fe0b5bbd56a
+43 0.8 0.8 WillBroke 25920 26020 32 2603 8c12e7bb65f2c9ec
+44 0.8 0.8 WillBroke 24790 24890 31 2490 c1e40d8406efd5e9
+45 0.8 0.8 WillBroke 22450 22550 28 2256 4ae97c637521edaf
+46 0.8 0.8 WillBroke 29410 29510 37 2952 7760a4f76f63ebb5
+47 0.8 0.8 WillBroke 30160 30260 37 3027 f062837cb5b49eb0
+48 0.8 0.8 WillBroke 31220 31320 36 3133 5e41f3871a485c72
+49 0.8 0.8 WillBroke 33200 33300 39 3331 bf6f87e6642eeed9
+50 0.8 0.8 WillBroke 26050 26150 32 2616 800841a85e80970f
+51 0.8 0.8 WillBroke 31020 31120 38 3113 54d06d44545aa4fb
+52 0.8 0.8 WillBroke 27410 27510 35 2752 c545900336cea749
+53 0.8 0.8 WillBroke 30780 30880 40 3089 7b14f9d5b0dabe0d
+54 0.8 0.8 WillBroke 28150 28250 35 2826 46db795b35f34c5d
+55 0.8 0.8 WillBroke 33490 33590 42 3360 c4760d6e42ad2e59
+56 0.8 0.8 WillBroke 26030 26130 32 2614 0503e5395eaff483
+57 0.8 0.8 WillBroke 31290 31390 37 3140 b7b8ab30e565b2f9
+58 0.8 0.8 WillBroke 28940 29040 35 2905 4527feae8a218446
+59 0.8 0.8 WillBroke 27310 27410 33 2742 518030c576b6fcbe
+60 0.8 0.8 WillBroke 29750 29850 38 2986 53e33f04a6f4a7af
+1 0.12 0.5 Endured -1 120000 0 12001 a4d66728d54aad20
+2 0.12 0.5 Endured -1 120000 0 12001 0f86d5191fd466e2
+3 0.12 0.5 Endured -1 120000 0 12001 842a665c4588e215
+4 0.12 0.5 Endured -1 120000 0 12001 930164c1ef89e1d1
+5 0.12 0.5 Endured -1 120000 0 12001 a3c5f53000dc35b6
+6 0.12 0.5 Endured -1 120000 0 12001 6f2b82eed827ff94
+7 0.12 0.5 Endured -1 120000 0 12001 e8ccd63c058aac7e
+8 0.12 0.5 Endured -1 120000 0 12001 ce987e8b1ff40739
+9 0.12 0.5 Endured -1 120000 0 12001 311b03a75aa8774d
+10 0.12 0.5 Endured -1 120000 0 12001 335c11e8d64fdd7a
+11 0.12 0.5 Endured -1 120000 0 12001 ec84541c1a1c2b9e
+12 0.12 0.5 Endured -1 120000 0 12001 23d1461c11d6eecf
+13 0.12 0.5 Endured -1 120000 0 12001 e21fc8da5df2c979
+14 0.12 0.5 Endured -1 120000 0 12001 8c16fb1b49916ce9
+15 0.12 0.5 Endured -1 120000 0 12001 596e31a87d587289
+16 0.12 0.5 Endured -1 120000 0 12001 53e9f6c0cdc92586
+17 0.12 0.5 Endured -1 120000 0 12001 32a5669012845805
+18 0.12 0.5 Endured -1 120000 0 12001 bf03e03c67b40e3b
+19 0.12 0.5 Endured -1 120000 0 12001 178a29a6f8375006
+20 0.12 0.5 Endured -1 120000 0 12001 59c536047786a192
+21 0.12 0.5 Endured -1 120000 0 12001 b356add08dab94a5
+22 0.12 0.5 Endured -1 120000 0 12001 99922c10b6b32d2b
+23 0.12 0.5 Endured -1 120000 0 12001 e280c89341344aa7
+24 0.12 0.5 Endured -1 120000 0 12001 fa0726e3c32d99d8
+25 0.12 0.5 Endured -1 120000 0 12001 f9f241118be9983e
+26 0.12 0.5 Endured -1 120000 0 12001 80a50b45c9d799c0
+27 0.12 0.5 Endured -1 120000 0 12001 771cfaf72c64438b
+28 0.12 0.5 Endured -1 120000 0 12001 fbbd6f2007051076
+29 0.12 0.5 Endured -1 120000 0 12001 c08d546694da4a7e
+30 0.12 0.5 Endured -1 120000 0 12001 9df481a0c2cdee11
+31 0.12 0.5 Endured -1 120000 0 12001 ae9f606dafebfa1e
+32 0.12 0.5 Endured -1 120000 0 12001 06e696404e9256de
+33 0.12 0.5 Endured -1 120000 0 12001 066aafcddab6ef0e
+34 0.12 0.5 Endured -1 120000 0 12001 0833cb592b8138cd
+35 0.12 0.5 Endured -1 120000 0 12001 72f9ccaea0637ad4
+36 0.12 0.5 Endured -1 120000 0 12001 e0d1c64bc8e0fc48
+37 0.12 0.5 Endured -1 120000 0 12001 b70ad94cf12adce0
+38 0.12 0.5 Endured -1 120000 0 12001 ff435f0887180b71
+39 0.12 0.5 Endured -1 120000 0 12001 8da9c4370b584012
+40 0.12 0.5 Endured -1 120000 0 12001 74f9885c1a541501
+41 0.12 0.5 Endured -1 120000 0 12001 d4e11eb98b23c59a
+42 0.12 0.5 Endured -1 120000 0 12001 4289f6ae3fe60c0d
+43 0.12 0.5 Endured -1 120000 0 12001 f9595ac5caec95c2
+44 0.12 0.5 Endured -1 120000 0 12001 bc590d5d1b609c7e
+45 0.12 0.5 Endured -1 120000 0 12001 efdb32b1f8fb14ca
+46 0.12 0.5 Endured -1 120000 0 12001 6b1ed857ef93f9e7
+47 0.12 0.5 Endured -1 120000 0 12001 4dcb3fb4a7fb1808
+48 0.12 0.5 Endured -1 120000 0 12001 f11072ebdaf3fe06
+49 0.12 0.5 Endured -1 120000 0 12001 b2b83bbf20dcb8da
+50 0.12 0.5 Endured -1 120000 0 12001 1c976596616ad5bc
+51 0.12 0.5 Endured -1 120000 0 12001 3c9322031aac9a32
+52 0.12 0.5 Endured -1 120000 0 12001 a96cd8ca41cfa13a
+53 0.12 0.5 Endured -1 120000 0 12001 a215b789ed222a7d
+54 0.12 0.5 Endured -1 120000 0 12001 3be6e39bfa4d5424
+55 0.12 0.5 Endured -1 120000 0 12001 b40fe851ccb51114
+56 0.12 0.5 Endured -1 120000 0 12001 3eb672b6f8f9df4b
+57 0.12 0.5 Endured -1 120000 0 12001 0cc56de0d1df332a
+58 0.12 0.5 Endured -1 120000 0 12001 1c46b092e7a9f5fa
+59 0.12 0.5 Endured -1 120000 0 12001 9abf165506073db5
+60 0.12 0.5 Endured -1 120000 0 12001 d9913a1ed7920a47
+1 0.2 0.5 WillBroke 61550 61650 0 6166 4eb7b5f041058c3a
+2 0.2 0.5 WillBroke 60770 60870 0 6088 6adf5a0713405867
+3 0.2 0.5 WillBroke 73080 73180 0 7319 3b218fb3f2750d00
+4 0.2 0.5 WillBroke 60910 61010 0 6102 e6fc3dd13c4f4f88
+5 0.2 0.5 WillBroke 64890 64990 0 6500 13eb57c707621354
+6 0.2 0.5 WillBroke 65330 65430 0 6544 5d12aa022ce881c2
+7 0.2 0.5 WillBroke 89140 89240 0 8925 722956c2506d94ac
+8 0.2 0.5 WillBroke 63320 63420 0 6343 4c8556996b77c4d2
+9 0.2 0.5 WillBroke 59100 59200 0 5921 4fdeaa907d37b76a
+10 0.2 0.5 WillBroke 74460 74560 0 7457 e6a7d0c99e99df1d
+11 0.2 0.5 WillBroke 81360 81460 0 8147 8bb48eff4337aca3
+12 0.2 0.5 WillBroke 57220 57320 0 5733 5c1f16f19f35355c
+13 0.2 0.5 WillBroke 68020 68120 0 6813 7728601e0be34b58
+14 0.2 0.5 WillBroke 85960 86060 0 8607 a16720cf9093a2ba
+15 0.2 0.5 WillBroke 61270 61370 0 6138 84ad9eee8ece8cab
+16 0.2 0.5 WillBroke 86760 86860 0 8687 f30b663ba19039fa
+17 0.2 0.5 WillBroke 72150 72250 0 7226 adb357df88b33dc8
+18 0.2 0.5 WillBroke 73890 73990 0 7400 fbfa7d31601e6aa1
+19 0.2 0.5 WillBroke 75870 75970 0 7598 e142af5c45ee0be2
+20 0.2 0.5 WillBroke 94760 94860 0 9487 4c708580624a1d46
+21 0.2 0.5 WillBroke 70030 70130 0 7014 13ad55e6f3130be3
+22 0.2 0.5 WillBroke 53850 53950 0 5396 79f3bb316c0eaf85
+23 0.2 0.5 WillBroke 58520 58620 0 5863 9f0c6f85419ae6dd
+24 0.2 0.5 WillBroke 61550 61650 0 6166 f39221687519b487
+25 0.2 0.5 WillBroke 77990 78090 0 7810 10d4fc69f97b26d8
+26 0.2 0.5 WillBroke 64630 64730 0 6474 cc05ed3304923a87
+27 0.2 0.5 WillBroke 62610 62710 0 6272 39625ac195ca6345
+28 0.2 0.5 WillBroke 61980 62080 0 6209 1689dbf84daa149b
+29 0.2 0.5 WillBroke 58650 58750 0 5876 63711e804c1fd959
+30 0.2 0.5 WillBroke 60210 60310 0 6032 6750a2c42c1feb9b
+31 0.2 0.5 WillBroke 56770 56870 0 5688 efe09e0087130ba4
+32 0.2 0.5 WillBroke 58580 58680 0 5869 48e0e13604b41a59
+33 0.2 0.5 WillBroke 93390 93490 0 9350 0f7b98fadce89c49
+34 0.2 0.5 WillBroke 60530 60630 0 6064 7a4f7f1a4f63374c
+35 0.2 0.5 WillBroke 70790 70890 0 7090 85f8a9ddf9d30a53
+36 0.2 0.5 WillBroke 64920 65020 0 6503 73db5f07ae7671ad
+37 0.2 0.5 WillBroke 58250 58350 0 5836 09f7c4eb8062265a
+38 0.2 0.5 WillBroke 75920 76020 0 7603 2414eda9e29d7e3e
+39 0.2 0.5 WillBroke 54080 54180 0 5419 8668a6e52104341a
+40 0.2 0.5 WillBroke 63980 64080 0 6409 9b0483b182117ef2
+41 0.2 0.5 WillBroke 77210 77310 0 7732 1177a13eb3cc229b
+42 0.2 0.5 WillBroke 74160 74260 0 7427 666d37658845da58
+43 0.2 0.5 WillBroke 61350 61450 0 6146 871d25bd76ae94c8
+44 0.2 0.5 WillBroke 58190 58290 0 5830 f1e96621098bc360
+45 0.2 0.5 WillBroke 50280 50380 0 5039 c2f86a90a197eb00
+46 0.2 0.5 WillBroke 73840 73940 0 7395 17cf31b97a0d1671
+47 0.2 0.5 WillBroke 75630 75730 0 7574 8538745e7a5e1ff6
+48 0.2 0.5 WillBroke 76850 76950 0 7696 b6525c3189927f9a
+49 0.2 0.5 WillBroke 84340 84440 0 8445 8590d59e44ff5fd4
+50 0.2 0.5 WillBroke 61880 61980 0 6199 2e5718c722577755
+51 0.2 0.5 WillBroke 77980 78080 0 7809 8f8ccdb15763c750
+52 0.2 0.5 WillBroke 67470 67570 0 6758 ac01f6ce963b5334
+53 0.2 0.5 WillBroke 79110 79210 0 7922 6ea0bdfb3703d02a
+54 0.2 0.5 WillBroke 69530 69630 0 6964 fb7b9ac715a66a05
+55 0.2 0.5 WillBroke 87170 87270 0 8728 07bba7c2cd21b7b7
+56 0.2 0.5 WillBroke 61450 61550 0 6156 3136df798ca68e9d
+57 0.2 0.5 WillBroke 78000 78100 0 7811 d6a4a321a0936ef2
+58 0.2 0.5 WillBroke 71110 71210 0 7122 e7dfb64e0e60fff6
+59 0.2 0.5 WillBroke 65890 65990 0 6600 970e46a63d649f1d
+60 0.2 0.5 WillBroke 75320 75420 0 7543 cfedd17a42366fca
diff --git a/tools/pain-box-golden/PainBoxGolden.csproj b/tools/pain-box-golden/PainBoxGolden.csproj
new file mode 100644
index 0000000..f8c74ed
--- /dev/null
+++ b/tools/pain-box-golden/PainBoxGolden.csproj
@@ -0,0 +1,16 @@
+
+
+
+
+ Exe
+ net10.0
+ enable
+ disable
+
+
+
+
+
+
+
diff --git a/tools/pain-box-golden/Program.cs b/tools/pain-box-golden/Program.cs
new file mode 100644
index 0000000..5db904d
--- /dev/null
+++ b/tools/pain-box-golden/Program.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Globalization;
+using System.IO;
+using BadDay.Core;
+
+// One row per (intensity, pull, seed): the outcome of BadDaySimulator's PainBoxSimulation at 9f59764 with
+// SampleEverySeconds 0.01, so the timeline holds one Sample row per tick, and an FNV-1a 64 hash of that
+// per-tick stream (stimulus, pain, strain, resolve as raw double bits, then the goal byte).
+var settings = new (double Intensity, double Pull)[]
+{
+ (0.8, 0.5), (1.0, 0.5), (0.6, 0.5), (0.8, 0.0), (0.8, 0.8), (0.12, 0.5), (0.2, 0.5),
+};
+const int Seeds = 60;
+
+using var w = new StreamWriter(args[0], false, new System.Text.UTF8Encoding(false)) { NewLine = "\n" };
+w.WriteLine("# Generated by tools/pain-box-golden/generate.sh from BadDaySimulator 9f59764 PainBoxSimulation (tick 10 ms, one sample row per tick). Do not edit.");
+w.WriteLine("# seed intensity pull outcome break_ms end_ms flinches ticks hash");
+foreach (var (intensity, pull) in settings)
+{
+ for (ulong seed = 1; seed <= Seeds; seed++)
+ {
+ var p = new PainBoxParameters { BoxIntensity = intensity, ObjectivePull = pull, SampleEverySeconds = 0.01 };
+ var r = PainBoxSimulation.Run(p, seed);
+ var h = 14695981039346656037ul;
+ void Byte(byte b) { h ^= b; h *= 1099511628211ul; }
+ void Double(double d) { foreach (var b in BitConverter.GetBytes(BitConverter.DoubleToInt64Bits(d))) Byte(b); }
+ long ticks = 0;
+ foreach (var e in r.Timeline)
+ {
+ if (e.Kind != EntryKind.Sample) continue;
+ ticks++;
+ Double(e.Stimulus); Double(e.Pain); Double(e.Strain); Double(e.Resolve);
+ Byte((byte)e.Goal);
+ }
+ w.WriteLine(string.Join(' ',
+ seed.ToString(CultureInfo.InvariantCulture),
+ intensity.ToString("0.0#", CultureInfo.InvariantCulture),
+ pull.ToString("0.0#", CultureInfo.InvariantCulture),
+ r.Outcome,
+ (r.TimeToBreakMs ?? -1).ToString(CultureInfo.InvariantCulture),
+ r.EndMs.ToString(CultureInfo.InvariantCulture),
+ r.Flinches.ToString(CultureInfo.InvariantCulture),
+ ticks.ToString(CultureInfo.InvariantCulture),
+ h.ToString("x16", CultureInfo.InvariantCulture)));
+ }
+}
diff --git a/tools/pain-box-golden/generate.sh b/tools/pain-box-golden/generate.sh
new file mode 100644
index 0000000..4bf2ba1
--- /dev/null
+++ b/tools/pain-box-golden/generate.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+# Regenerates tests/Lodur.Core.Tests/pain-box-golden.tsv from Bad Day Simulator's pain box at 9f59764.
+# Usage: tools/pain-box-golden/generate.sh
+set -euo pipefail
+bds="${1:?path to a BadDaySimulator checkout at 9f59764}"
+want=9f597647a608a6c6e44473cc9f1399983de14616
+have="$(git -C "$bds" rev-parse HEAD)"
+[ "$have" = "$want" ] || { echo "BadDaySimulator is at $have, need $want" >&2; exit 1; }
+here="$(cd "$(dirname "$0")" && pwd)"
+dotnet run --project "$here/PainBoxGolden.csproj" -p:BdsRoot="$(cd "$bds" && pwd -W 2>/dev/null || pwd)" -- "$here/../../tests/Lodur.Core.Tests/pain-box-golden.tsv"