Interpret compound Truthtrance hand facts
Verify and publish checkpoint container / container (push) Successful in 10m54s
Verify and publish checkpoint container / container (push) Successful in 10m54s
This commit is contained in:
1 parent
4224bb3e2a
commit
15a4f3038a
9 files changed
+268
-17
No files matched your search
+11
-2
@@ -71,6 +71,7 @@ import { parseFreeformFactV1 } from './truthtrance-freeform-facts';
|
||||
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 { CHEAP_HERO_TRAITOR } from './traitors';
|
||||
import {
|
||||
TRUTH_FACT_MAX_NODES, TRUTH_FACT_MAX_DEPTH, TRUTH_FACT_MAX_TERMS,
|
||||
@@ -136,7 +137,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; fact: TruthFact };
|
||||
interpreted?: { version: 1; fact: Extract<TruthFact, { kind: 'hand' | 'spice' }> } | { version: 2 | 3 | 4 | 5; fact: TruthFact };
|
||||
};
|
||||
export type TruthAnswer = 'yes' | 'no' | 'unknown';
|
||||
export type TruthQueueEntry = {
|
||||
@@ -698,10 +699,14 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
|
||||
? parseFreeformFactV3(question.text) : null;
|
||||
const negativeFact = question.scope === 'fact' && marker.version === 4 && !parseFreeformFactV3(question.text)
|
||||
? parseFreeformFactV4(question.text) : null;
|
||||
const compoundFact = question.scope === 'fact' && marker.version === 5 &&
|
||||
!parseFreeformFactV3(question.text) && !parseFreeformFactV4(question.text)
|
||||
? parseTruthFreeformFactsV5(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 } : null;
|
||||
: negativeFact ? { version: 4 as const, fact: negativeFact }
|
||||
: compoundFact ? { version: 5 as const, fact: compoundFact } : null;
|
||||
check(expected !== null && JSON.stringify(v.interpreted) === JSON.stringify(expected),
|
||||
'The saved freeform interpretation does not match its original question.');
|
||||
question.interpreted = expected;
|
||||
@@ -1175,6 +1180,10 @@ export function resolveTruthAction(
|
||||
else {
|
||||
const negativeFact = parseFreeformFactV4(w.question.text);
|
||||
if (negativeFact) w.question.interpreted = { version: 4, fact: negativeFact };
|
||||
else {
|
||||
const compoundFact = parseTruthFreeformFactsV5(w.question.text);
|
||||
if (compoundFact) w.question.interpreted = { version: 5, fact: compoundFact };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user