Support board-wide Truthtrance force questions
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 03:41:29 +11:00
1 parent f1007a4ea8
commit 89589878fc
12 files changed
+144 -29

No files matched your search

+29 -1
View File
@@ -4,7 +4,8 @@ import { applyAction, normalizeAutomaticGame, viewGame, type Action, type Game }
import { botActions } from '../game/bots';
import { DIFFICULTIES } from '../game/bot-profiles';
import { MOBILE_LOCATION, MOBILE_STRONGHOLD } from '../game/board';
import type { TruthFact } from '../game/truthtrance';
import { truthFactAnswer, type TruthFact } from '../game/truthtrance';
import { truthKnowledgeOf } from '../game/truthtrance-knowledge';
import { knowledgeGame, knowledgePhysical } from './truthtrance-knowledge-fixture';
import { completedIxSkillsGame, assertIxSkillsCustody } from './ix-skills-fixture';
import { discoveryFixture, enterDiscoveryCollection } from './fixture-discovery';
@@ -114,6 +115,27 @@ void test('a whole-territory Basic question counts separate sectors and every bo
}
});
void test('a whole-board Basic force question counts multiple territories and every bot answers the actual fact', () => {
const initial = knowledgeGame(false);
const fremen = player(initial, 'f');
fremen.forces = { 'wind_pass:14': 4, 'imperial_basin:9': 6 };
const zone: ForceFact['zone'] = { kind: 'board' };
const question = fact(zone, 'total', 10);
assert.equal(truthFactAnswer(fremen, question), 'unknown');
assert.equal(truthFactAnswer(fremen, { kind: 'and', terms: [question, question] }), 'unknown');
answer(ask(initial, 'f', question), 'f', 'yes');
answer(ask(initial, 'f', fact(zone, 'total', 11, 'gte')), 'f', 'no');
for (const difficulty of DIFFICULTIES) {
const waiting = ask(initial, 'f', question);
const view = viewGame(waiting, 'f');
view.players.find(candidate => candidate.id === 'f')!.bot = difficulty;
const response = botActions(view);
assert.deepEqual(response, [{ type: 'truthAnswer', answer: 'yes' }]);
const done = act(waiting, 'f', response[0]);
assert.equal(done.truthHistory!.at(-1)!.answer, 'yes');
}
});
void test('whole-territory typed facts aggregate elite and normal counters across sectors', () => {
const initial = typedGame();
const fremen = player(initial, 'f');
@@ -262,6 +284,12 @@ void test('the live HMS interior is an exact physical location distinct from its
assert.equal(initial.mobileStronghold!.location, 'polar_sink:0');
assert.equal(player(initial, 'i').forces[MOBILE_LOCATION], 6);
assert.equal(player(initial, 'i').elites!.forces[MOBILE_LOCATION], 3);
answer(ask(initial, 'i', fact({ kind: 'board' }, 'total', 6), 'e'), 'i', 'yes');
answer(ask(initial, 'i', fact({ kind: 'board' }, 'elite', 3), 'e'), 'i', 'yes');
const unplaced = structuredClone(initial);
unplaced.mobileStronghold!.location = null;
assert.equal(truthFactAnswer(player(unplaced, 'i'), fact({ kind: 'board' }, 'total', 0),
truthKnowledgeOf(unplaced, player(unplaced, 'i'))), 'yes');
for (const [counter, value] of [['total', 6], ['normal', 3], ['elite', 3]] as const)
assertIxSkillsCustody(answer(ask(initial, 'i', fact({ kind: 'location', territory: MOBILE_STRONGHOLD, sector: 0 }, counter, value), 'e'), 'i', 'yes'));
answer(ask(initial, 'i', fact({ kind: 'territory', territory: MOBILE_STRONGHOLD }, 'total', 6), 'e'), 'i', 'yes');