Expand freeform Truthtrance current facts
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 18:46:17 +11:00
1 parent a10e019b01
commit cc9cc0945d
10 files changed
+290 -4

No files matched your search

+13 -2
View File
@@ -72,6 +72,7 @@ import { parseFreeformFactV2 } from './truthtrance-freeform-facts-v2';
import { parseFreeformFactV3 } from './truthtrance-freeform-facts-v3';
import { parseFreeformFactV4 } from './truthtrance-freeform-facts-v4';
import { parseTruthFreeformFactsV5 } from './truthtrance-freeform-facts-v5';
import { parseFreeformFactV6 } from './truthtrance-freeform-facts-v6';
import { CHEAP_HERO_TRAITOR } from './traitors';
import {
TRUTH_FACT_MAX_NODES, TRUTH_FACT_MAX_DEPTH, TRUTH_FACT_MAX_TERMS,
@@ -137,7 +138,7 @@ export type TruthQuestion =
text: string;
scope: 'fact' | 'currentTurn';
/** Only newly asked, explicitly recognized facts carry this stable interpretation. */
interpreted?: { version: 1; fact: Extract<TruthFact, { kind: 'hand' | 'spice' }> } | { version: 2 | 3 | 4 | 5; fact: TruthFact };
interpreted?: { version: 1; fact: Extract<TruthFact, { kind: 'hand' | 'spice' }> } | { version: 2 | 3 | 4 | 5 | 6; fact: TruthFact };
};
export type TruthAnswer = 'yes' | 'no' | 'unknown';
export type TruthQueueEntry = {
@@ -724,11 +725,16 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
const compoundFact = question.scope === 'fact' && marker.version === 5 &&
!parseFreeformFactV3(question.text) && !parseFreeformFactV4(question.text)
? parseTruthFreeformFactsV5(question.text) : null;
const currentFact = question.scope === 'fact' && marker.version === 6 &&
!parseFreeformFactV2(question.text) && !parseFreeformFactV3(question.text) &&
!parseFreeformFactV4(question.text) && !parseTruthFreeformFactsV5(question.text)
? parseFreeformFactV6(question.text) : null;
const expected = oldFact ? { version: 1 as const, fact: oldFact }
: newFact ? { version: 2 as const, fact: newFact }
: categoryFact ? { version: 3 as const, fact: categoryFact }
: negativeFact ? { version: 4 as const, fact: negativeFact }
: compoundFact ? { version: 5 as const, fact: compoundFact } : null;
: compoundFact ? { version: 5 as const, fact: compoundFact }
: currentFact ? { version: 6 as const, fact: parseFact(g, currentFact, g.players.find(player => player.id === question.target)!) } : null;
check(expected !== null && JSON.stringify(v.interpreted) === JSON.stringify(expected),
'The saved freeform interpretation does not match its original question.');
question.interpreted = expected;
@@ -1215,6 +1221,11 @@ export function resolveTruthAction(
else {
const compoundFact = parseTruthFreeformFactsV5(w.question.text);
if (compoundFact) w.question.interpreted = { version: 5, fact: compoundFact };
else {
const currentFact = parseFreeformFactV6(w.question.text);
if (currentFact) w.question.interpreted = { version: 6,
fact: parseFact(g, currentFact, g.players.find(player => player.id === w.question!.target)!) };
}
}
}
}