PainBoxSession: the break is the first one; a break after a mend is a row
The result reported a break 63 s after its own run's end when the session was ticked through a mend and a second break (probe: break 77740 ms, end 14830 ms). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
15ef80a188
commit
4a9861e7d0
2 changed files with 22 additions and 1 deletions
|
|
@ -114,7 +114,7 @@ public sealed class PainBoxSession
|
|||
}
|
||||
if ((events & TickEvents.WillBroke) != 0)
|
||||
{
|
||||
_breakTick = tick;
|
||||
if (_breakTick < 0) _breakTick = tick; // the snap; a break after a mend is a row, never the time to break
|
||||
Log(tick, EntryKind.WillBroke);
|
||||
}
|
||||
if (tick % _sampleEvery == 0) Log(tick, EntryKind.Sample);
|
||||
|
|
|
|||
|
|
@ -249,6 +249,27 @@ public static class Program
|
|||
Check(session.Actor.GoalIndex == ChamberBrain.WithdrawIndex, "the goal left Withdraw as the box went off");
|
||||
}),
|
||||
|
||||
("pain box: a break after a mend is a row, not the time to break: the result's break is the first one and never after the run's end", () =>
|
||||
{
|
||||
var pose = new[] { Lodur.Quat.Identity };
|
||||
var session = new PainBoxSession(Default with { MaxSeconds = 300.0 }, 1, new Lodur.BoxStimulus(0f, 0f, 0f, 1f, 1f, 1f), 1, pose, pose);
|
||||
var point = new float[1];
|
||||
var strengths = new float[1];
|
||||
var targets = new Lodur.Quat[1];
|
||||
while (!session.Withdrew) session.Tick(point, point, point, strengths, targets);
|
||||
session.SetIntensity(0.0);
|
||||
while (session.Actor.Drive.WillBroken) session.Tick(point, point, point, strengths, targets);
|
||||
session.SetIntensity(PainBox.MaxLevel);
|
||||
int breaks = 0;
|
||||
while (!session.Finished && breaks < 1)
|
||||
{
|
||||
if ((session.Tick(point, point, point, strengths, targets) & Lodur.TickEvents.WillBroke) != 0) breaks++;
|
||||
}
|
||||
var r = session.Result();
|
||||
Check(breaks == 1 && r.Timeline.Count(e => e.Kind == EntryKind.WillBroke) == 2, "the will did not break a second time: the test no longer exercises the rule");
|
||||
Check(r.TimeToBreakMs == 14730 && r.TimeToBreakMs <= r.EndMs, $"break {r.TimeToBreakMs} ms, end {r.EndMs} ms");
|
||||
}),
|
||||
|
||||
("chamber release: the withdrawal is the Brain's release goal by id, not any goal change; an id the Brain lacks is refused", () =>
|
||||
{
|
||||
var r = PainBoxSimulation.Run(Default with { ReleaseGoalId = "hold-hand", MaxSeconds = 30.0 }, 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue