// Provenance: own design — shared run scripts (spec §5) using System.Globalization; namespace Godosa.Core.Runs.Scripts; public sealed record ScriptRunOptions { public bool Deterministic { get; init; } = true; /// Overrides the script's seed header; neither → 0 and the game's rng is left alone. public ulong? Seed { get; init; } public OutputLevel Output { get; init; } = OutputLevel.Labels; public OutputLevel Floor { get; init; } = OutputLevel.Quiet; public int StepCap { get; init; } = 36_000; public string? CacheDir { get; init; } public bool UseCache { get; init; } = true; /// false: checkpoints are markers — no digest (a whole-state serialization, slow in a big game), nothing /// cached (--no-snapshots). public bool Snapshots { get; init; } = true; public string? From { get; init; } public string? Until { get; init; } public string? ReportDir { get; init; } public long CacheCapBytes { get; init; } = 2L << 30; } public enum RunOutcome { Passed, Failed, Invalid, Stopped } public sealed record RunResult(RunOutcome Outcome, int ExitCode, long Frames, string? Failure); public sealed class ScriptRunner : IConditionContext { private sealed class Active(Instr instr, long startFrame) { public Instr Instr { get; } = instr; public long StartFrame { get; } = startFrame; public int Frames { get; set; } public InputPlan? Plan { get; set; } /// The value a plan's frame 0 lands on (0 for the step's own plan). public int PlanBase { get; set; } public int Sent { get; set; } public IRunAction? Action { get; init; } public Cond? Wait { get; init; } public int? WaitFrames { get; init; } } private sealed record Label(string Name, long Start, SourceRef At); private readonly ScriptProgram _program; private readonly IRunGame _game; private readonly ScriptRunOptions _options; private readonly RunOutput _out; private readonly VarScopes _vars; private readonly List