pain-box-golden.tsv holds BadDaySimulator 9f59764's PainBoxSimulation for 7 intensity/pull settings x seeds 1-60: outcome, break and end ms, flinch count and a hash of the per-tick stimulus/pain/strain/resolve/goal stream. The Actor reproduces it exactly. tools/pain-box-golden regenerates it from that commit. New tests kill 'resolve recovery off' and 'flinch reported after the break'. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
46 lines
2.2 KiB
C#
46 lines
2.2 KiB
C#
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)));
|
|
}
|
|
}
|