Files
Genarrative/src/services/storyEngine/playthroughMatrixLab.ts
kdletters cbc27bad4a
Some checks failed
CI / verify (push) Has been cancelled
init with react+axum+spacetimedb
2026-04-26 18:06:23 +08:00

33 lines
1006 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type {
CampaignPack,
SimulationRunResult,
StoryEngineMemoryState,
} from '../../types';
import { runStorySimulation } from './storySimulationRunner';
export function runPlaythroughMatrix(params: {
scenarioPackId: string;
campaignPack: CampaignPack;
memory: StoryEngineMemoryState;
seeds: string[];
}) {
return params.seeds.map((seed) =>
runStorySimulation({
scenarioPackId: params.scenarioPackId,
campaignPack: params.campaignPack,
memory: params.memory,
seed,
}),
);
}
export function buildMatrixSummary(results: SimulationRunResult[]) {
if (results.length <= 0) {
return '当前没有可用的仿真结果。';
}
const endingCount = new Set(results.map((result) => result.endingId ?? 'none')).size;
const maxIssueCount = results.reduce((max, result) => Math.max(max, result.issueCount), 0);
return `共跑了 ${results.length} 条 simulationending family ${endingCount} 类,单次最高 QA 问题 ${maxIssueCount} 条。`;
}