(Adaptive Loop) Pass 4
This commit is contained in:
36 files changed
+12943
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { canonical } from "../src/domain/core.ts";
|
||||
import { buildInitialState, getScenario } from "../src/domain/scenarios.ts";
|
||||
import { replay } from "../src/domain/solver.ts";
|
||||
import type { RotationAction } from "../src/domain/types.ts";
|
||||
|
||||
const scenario = getScenario("s1-heat");
|
||||
const win: RotationAction[] = [
|
||||
{ ring: "inner", dir: "cw" }, { ring: "inner", dir: "ccw" },
|
||||
{ ring: "middle", dir: "ccw" }, { ring: "middle", dir: "ccw" },
|
||||
{ ring: "middle", dir: "ccw" }, { ring: "middle", dir: "ccw" },
|
||||
{ ring: "middle", dir: "cw" }, { ring: "outer", dir: "cw" },
|
||||
];
|
||||
const collapse: RotationAction[] = [
|
||||
{ ring: "inner", dir: "cw" }, { ring: "middle", dir: "ccw" },
|
||||
{ ring: "outer", dir: "cw" }, { ring: "outer", dir: "cw" },
|
||||
{ ring: "inner", dir: "cw" },
|
||||
];
|
||||
const expire: RotationAction[] = Array.from({ length: 8 }, () => ({ ring: "inner", dir: "cw" as const }));
|
||||
|
||||
describe("Gate 2 — complete Scenario 1", () => {
|
||||
it("has playable win, collapse, and expiration routes", () => {
|
||||
expect(replay(scenario, { producer: [], grazer: [] }, win).outcome).toBe("won");
|
||||
expect(replay(scenario, { producer: [], grazer: [] }, collapse).outcome).toBe("collapsed");
|
||||
expect(replay(scenario, { producer: [], grazer: [] }, expire).outcome).toBe("expired");
|
||||
});
|
||||
|
||||
it("retry restores the exact scenario baseline", () => {
|
||||
const baseline = buildInitialState(scenario, "campaign");
|
||||
const afterLoss = replay(scenario, { producer: [], grazer: [] }, collapse);
|
||||
expect(afterLoss.outcome).toBe("collapsed");
|
||||
expect(canonical(buildInitialState(scenario, "campaign"))).toBe(canonical(baseline));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user