From d217729dbe9277285976fd9ae5dfedaaf6c5db10 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 06:58:47 +0100 Subject: [PATCH] Office: the settle is 8 s, calibrated on a 100-seed body sweep At 6 s seeds 55 and 100 ended with a hand at 0.0512 and 0.0521 m/s, over the 0.05 m/s stillness limit; 7 s gives 0.0259, 8 s gives 0.0124 (seed 100) over seeds 1-100. The limit is unchanged; the test asserts under 0.025 (half of it). The suite runs the tight seeds; BDS_SETTLE_SWEEP=1 runs all 100 (about a minute). The office golden is re-captured for the two extra seconds of rows. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 2 +- src/BadDay.Core/StressParameters.cs | 4 ++-- tests/BadDay.Tests/Program.cs | 36 +++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 34de290..8e8fd88 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ no pull) loops wind-up and strike with each arm at 0.25 s a key. It refills his and breaks a second time (5-20 s after the snap) `Calm` takes over: his composed pose at normal strength, involuntary since his will is spent, terminal as data (it gates on `Breaks >= 2`, which never falls, and nothing outranks it): he throws no further fit (ruling `lodur:ruling:fella-calm-after-rage`). The Actor commits each switch 100 ms after its break, -the session logs a `GoalChanged` row for each, and the run goes on `ReleaseSeconds` (6 s, the settle: the seated body is still by then) after the Brain's release goal +the session logs a `GoalChanged` row for each, and the run goes on `ReleaseSeconds` (8 s, the settle: the seated body is under 0.025 m/s by then on every seed 1-100) after the Brain's release goal (`ReleaseGoalId`, `calm`) takes over, or to 180 s if the will holds. `TimeToBreakMs` is the first break, the snap; the second `WillBroke` row is the rage running dry. The chamber's release is declared the same way (`PainBoxParameters.ReleaseGoalId`, `withdraw`), and its withdrawal is one-way: a will that mends does not give the hand back. Who has the day is a `Character` (his senses; `Character.OfficeFella`), apart from the setting and the cause. Each scenario builds its own Brain from its own parameters; one entry point keyed by character id diff --git a/src/BadDay.Core/StressParameters.cs b/src/BadDay.Core/StressParameters.cs index 90932ff..322b6af 100644 --- a/src/BadDay.Core/StressParameters.cs +++ b/src/BadDay.Core/StressParameters.cs @@ -11,8 +11,8 @@ public sealed record StressParameters public double MaxSeconds { get; init; } = 180.0; public double SampleEverySeconds { get; init; } = 1.0; - /// How long the run goes on after the release goal (calm) takes over, seconds [P]: the settle time. Calibrated on the body so the seated puppet is still by the end (hand speed under 0.05 m/s from 5 s after calm, seeds 1-5); the headless run ends at the same time, one rule for every path. - public double ReleaseSeconds { get; init; } = 6.0; + /// How long the run goes on after the release goal (calm) takes over, seconds [P]: the settle time. Calibrated on the body so the seated puppet is still by the end: over seeds 1-100 the fastest hand in the last second is 0.0124 m/s at 8 s (0.0521 at 6 s, over the 0.05 m/s stillness limit; 0.0259 at 7 s), checked by the office body settle test; the headless run ends at the same time, one rule for every path. + public double ReleaseSeconds { get; init; } = 8.0; /// What the rage costs his will per second while it is voluntary, resolve units [P]: the rage refills his will, and this is how fast it runs dry (about 20 s from full, so the rage lasts 5-20 s with the senses still pressing). public double RageEffort { get; init; } = 0.05; diff --git a/tests/BadDay.Tests/Program.cs b/tests/BadDay.Tests/Program.cs index 7328260..1cceb26 100644 --- a/tests/BadDay.Tests/Program.cs +++ b/tests/BadDay.Tests/Program.cs @@ -776,7 +776,7 @@ public static class Program } }), - ("office golden [P]: the rows up to the break are rung 3's bytes, the 50-seed sweep ends in its captured line, and the run's own bytes are captured (re-captured with the arc: the rage refills his will, a second break and calm follow)", () => + ("office golden [P]: the rows up to the break are rung 3's bytes, the 50-seed sweep ends in its captured line, and the run's own bytes are captured (re-captured with the arc and again for the 8 s settle)", () => { string Out(params string[] a) { @@ -792,7 +792,7 @@ public static class Program for (int i = 2; i <= brk; i++) rung3.Add(lines[i].Replace(" KeepComposure", i == brk ? " Withdraw" : " HoldHand")); rung3.Add(lines[^1]); Check(Hash(string.Join('\n', rung3) + "\n") == "66098b69834c3c8b5e5b694f0059b8ed566e31d332f36be7e57baf70ae650823", "the office's rows up to the break differ from rung 3's"); - Check(Hash(string.Join('\n', lines) + "\n") == "b4e56329126e49192d2212b5acfcb63bd5691845571ff727fafec6745e7c42fc", $"office --seed 1 changed: {Hash(string.Join('\n', lines) + "\n")}"); + Check(Hash(string.Join('\n', lines) + "\n") == "14e226cbb85d68bb9104314b08802c3c20207f378456915a004b60f1ab657089", $"office --seed 1 changed: {Hash(string.Join('\n', lines) + "\n")}"); var last = Out("office-sweep", "--seed", "1", "--count", "50").TrimEnd('\n').Split('\n')[^1]; Check(last == "runs 50: broke 50, endured 0; time to break min/median/max ms: 72670/86570/113420; min resolve of endured runs: -", $"sweep line changed: {last}"); }), @@ -815,7 +815,7 @@ public static class Program Check(r.Timeline.Where(e => e.TimeMs < rage.TimeMs).All(e => e.Goal == OfficeGoal.KeepComposure), $"seed {seed}: a row before the rage is not KeepComposure"); Check(r.Timeline.Where(e => e.TimeMs >= rage.TimeMs && e.TimeMs < calm.TimeMs).All(e => e.Goal == OfficeGoal.Rage), $"seed {seed}: a row in the rage is not Rage"); Check(r.Timeline.Where(e => e.TimeMs >= calm.TimeMs).All(e => e.Goal == OfficeGoal.Calm), $"seed {seed}: a row from calm on is not Calm"); - Check(r.Outcome == Outcome.WillBroke && r.EndMs == calm.TimeMs + 6000, $"seed {seed}: ended at {r.EndMs}, calm was at {calm.TimeMs}"); + Check(r.Outcome == Outcome.WillBroke && r.EndMs == calm.TimeMs + 8000, $"seed {seed}: ended at {r.EndMs}, calm was at {calm.TimeMs}"); } var short_ = Office(new StressParameters { ReleaseSeconds = 2.0 }, 1); Check(short_.EndMs == short_.Timeline.Single(e => e.Kind == StressEntryKind.GoalChanged && e.Goal == OfficeGoal.Calm).TimeMs + 2000, "ReleaseSeconds did not set the settle time"); @@ -846,7 +846,7 @@ public static class Program Check(r.EndMs == 180000 && r.Outcome == Outcome.WillBroke, $"releasing on a goal the Brain never switches to ended the run at {r.EndMs}"); var rage = Office(new StressParameters { ReleaseGoalId = OfficeBrain.RageId }, 1); var sw = rage.Timeline.First(e => e.Kind == StressEntryKind.GoalChanged); - Check(sw.Goal == OfficeGoal.Rage && rage.EndMs == sw.TimeMs + 6000, $"releasing on the rage ended the run at {rage.EndMs}, the rage was at {sw.TimeMs}"); + Check(sw.Goal == OfficeGoal.Rage && rage.EndMs == sw.TimeMs + 8000, $"releasing on the rage ended the run at {rage.EndMs}, the rage was at {sw.TimeMs}"); bool threw = false; try { NewOffice(new StressParameters { ReleaseGoalId = "nowhere" }, 1); } catch (ArgumentException) { threw = true; } Check(threw, "a release goal the Brain lacks was accepted"); @@ -871,7 +871,7 @@ public static class Program int sw = a.RageTick!.Value; var calmRow = a.Run.Timeline.Single(e => e.Kind == StressEntryKind.GoalChanged && e.Goal == OfficeGoal.Calm); int calmTick = (int)Math.Round(calmRow.TimeMs * Hz / 1000.0); - Check(a.HandL.Count == calmTick + 6 * Hz + 1, $"the run has {a.HandL.Count} steps, calm is at {calmTick}"); + Check(a.HandL.Count == calmTick + 8 * Hz + 1, $"the run has {a.HandL.Count} steps, calm is at {calmTick}"); double Rms(IReadOnlyList h, int from, int to) { double sum = 0; @@ -921,6 +921,32 @@ public static class Program } }), + ("office body settle: the seated body is still when the run ends: no hand faster than 0.025 m/s (half the 0.05 limit) over the last second, on the seeds that were tightest at 6 s and every seed 1..100 when BDS_SETTLE_SWEEP is set", () => + { + // The release is a timer (the office never ends on body stillness), so the timer is calibrated and this is where that is checked. + // 6 s left seeds 55 and 100 at 0.0512 and 0.0521 m/s; at 8 s the worst of seeds 1..100 is 0.0124 m/s (seed 100). The full sweep takes about a minute: + // BDS_SETTLE_SWEEP=1 dotnet run -c Release --project tests/BadDay.Tests -- "office body settle" + var seeds = Environment.GetEnvironmentVariable("BDS_SETTLE_SWEEP") is { Length: > 0 } + ? Enumerable.Range(1, 100).Select(n => (ulong)n) + : new ulong[] { 1, 2, 3, 7, 55, 69, 100 }; + double worst = 0.0; + ulong worstSeed = 0; + foreach (ulong seed in seeds) + { + var a = OfficeBody.Run(new StressParameters { TickSeconds = OfficeBody.TickSeconds }, seed); + foreach (var h in new[] { a.HandL, a.HandR }) + { + for (int k = h.Count - Hz; k < h.Count; k++) + { + double dx = h[k].X - h[k - 1].X, dy = h[k].Y - h[k - 1].Y, dz = h[k].Z - h[k - 1].Z; + double v = Math.Sqrt(dx * dx + dy * dy + dz * dz) * Hz; + if (v > worst) { worst = v; worstSeed = seed; } + } + } + } + Check(worst < 0.025, $"seed {worstSeed}: a hand still moves at {worst:F4} m/s in the run's last second"); + }), + ("office body: the desk's emitters are sensed at the head, so the body breaks within 0.5 s of the headless run (sensed at a hand it is 3.6 s off)", () => { var body = OfficeBody.Run(new StressParameters { TickSeconds = OfficeBody.TickSeconds }, 1).Run;