Compose freeform Truthtrance facts
Verify and publish checkpoint container / container (push) Successful in 11m2s
Verify and publish checkpoint container / container (push) Successful in 11m2s
This commit is contained in:
1 parent
cc9cc0945d
commit
593ff33ca8
10 files changed
+306
-4
No files matched your search
+13
-2
@@ -73,6 +73,7 @@ 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 { parseTruthFreeformFactsV7 } from './truthtrance-freeform-facts-v7';
|
||||
import { CHEAP_HERO_TRAITOR } from './traitors';
|
||||
import {
|
||||
TRUTH_FACT_MAX_NODES, TRUTH_FACT_MAX_DEPTH, TRUTH_FACT_MAX_TERMS,
|
||||
@@ -138,7 +139,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 | 6; fact: TruthFact };
|
||||
interpreted?: { version: 1; fact: Extract<TruthFact, { kind: 'hand' | 'spice' }> } | { version: 2 | 3 | 4 | 5 | 6 | 7; fact: TruthFact };
|
||||
};
|
||||
export type TruthAnswer = 'yes' | 'no' | 'unknown';
|
||||
export type TruthQueueEntry = {
|
||||
@@ -729,12 +730,17 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
|
||||
!parseFreeformFactV2(question.text) && !parseFreeformFactV3(question.text) &&
|
||||
!parseFreeformFactV4(question.text) && !parseTruthFreeformFactsV5(question.text)
|
||||
? parseFreeformFactV6(question.text) : null;
|
||||
const aggregateFact = question.scope === 'fact' && marker.version === 7 &&
|
||||
!parseFreeformFactV2(question.text) && !parseFreeformFactV3(question.text) &&
|
||||
!parseFreeformFactV4(question.text) && !parseTruthFreeformFactsV5(question.text) &&
|
||||
!parseFreeformFactV6(question.text) ? parseTruthFreeformFactsV7(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 }
|
||||
: currentFact ? { version: 6 as const, fact: parseFact(g, currentFact, g.players.find(player => player.id === question.target)!) } : null;
|
||||
: currentFact ? { version: 6 as const, fact: parseFact(g, currentFact, g.players.find(player => player.id === question.target)!) }
|
||||
: aggregateFact ? { version: 7 as const, fact: parseFact(g, aggregateFact, 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;
|
||||
@@ -1225,6 +1231,11 @@ export function resolveTruthAction(
|
||||
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)!) };
|
||||
else {
|
||||
const aggregateFact = parseTruthFreeformFactsV7(w.question.text);
|
||||
if (aggregateFact) w.question.interpreted = { version: 7,
|
||||
fact: parseFact(g, aggregateFact, g.players.find(player => player.id === w.question!.target)!) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user