(Adaptive Loop) Prepare for final pass
This commit is contained in:
1079 files changed
-1131878
No files matched your search
@@ -1,37 +0,0 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { getScenario, SCENARIOS } from "../src/domain/scenarios.ts";
|
||||
import { solveWin, solveLoss, replay } from "../src/domain/solver.ts";
|
||||
|
||||
describe("solver scenario 1", () => {
|
||||
it("finds a winning route for baseline scenario 1", () => {
|
||||
const win = solveWin(getScenario("s1-heat"));
|
||||
expect(win).not.toBeNull();
|
||||
if (!win) return;
|
||||
console.log("S1 win length:", win.length, win.map((a) => `${a.ring[0].toUpperCase()}${a.dir}`).join(","));
|
||||
const end = replay(getScenario("s1-heat"), { producer: [], grazer: [] }, win);
|
||||
expect(end.outcome).toBe("won");
|
||||
}, 60000);
|
||||
|
||||
it("finds a losing route for baseline scenario 1", () => {
|
||||
const loss = solveLoss(getScenario("s1-heat"));
|
||||
expect(loss).not.toBeNull();
|
||||
if (!loss) return;
|
||||
const end = replay(getScenario("s1-heat"), { producer: [], grazer: [] }, loss);
|
||||
expect(end.outcome === "collapsed" || end.outcome === "expired").toBe(true);
|
||||
console.log("S1 loss:", end.outcome, loss.length);
|
||||
}, 60000);
|
||||
});
|
||||
|
||||
describe("solver all baseline scenarios", () => {
|
||||
for (const sc of SCENARIOS) {
|
||||
it(`finds win+loss for ${sc.id}`, () => {
|
||||
const win = solveWin(sc);
|
||||
expect(win, `no win for ${sc.id}`).not.toBeNull();
|
||||
if (win) {
|
||||
const end = replay(sc, { producer: [], grazer: [] }, win);
|
||||
expect(end.outcome).toBe("won");
|
||||
console.log(sc.id, "WIN len", win.length);
|
||||
}
|
||||
}, 120000);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user