33 lines
1006 B
TypeScript
33 lines
1006 B
TypeScript
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} 条 simulation,ending family ${endingCount} 类,单次最高 QA 问题 ${maxIssueCount} 条。`;
|
||
}
|