Support mixed Truthtrance questions in Richese auctions
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-11-16 18:42:40 +11:00
1 parent 1f3bc349ba
commit 6ce9a4b4a7
16 files changed
+504 -10

No files matched your search

+4
View File
@@ -1368,6 +1368,10 @@ function policyActions(g: GameView): Action[] {
const answer = g.truthMixedBidAnswers?.[0];
return answer ? [{ type: 'truthAnswer', answer }] : [];
}
if (w.question.kind === 'mixedRicheseBid') {
const answer = g.truthMixedRicheseBidAnswers?.[0];
return answer ? [{ type: 'truthAnswer', answer }] : [];
}
if (w.question.kind === 'mixedRevival') {
const answer = g.truthMixedRevivalAnswers?.[0];
return answer ? [{ type: 'truthAnswer', answer }] : [];
+62 -1
View File
@@ -63,6 +63,7 @@ import { AllianceExpressionPromiseError, allianceExpressionOutcomes, findAllianc
type AllianceExpression, type AllianceExpressionClaim, type AllianceExpressionPromise } from './alliance-expression-promises';
import type { AllianceActionClaim, MixedAllianceClaim } from './mixed-alliance-question';
import { mixedBidMinimum, type MixedBidClaim } from './mixed-bid-question';
import { mixedRicheseBidResidual, type MixedRicheseBidClaim } from './mixed-richese-bid-question';
import type { RevivalActionClaim, MixedRevivalClaim } from './mixed-revival-question';
import type { BribePaymentClaim, MixedBribeClaim } from './mixed-bribe-question';
import { compileMixedActionExpression, MixedActionQuestionError, type CompiledMixedAction } from './mixed-action-question';
@@ -2507,6 +2508,10 @@ export type Game = {
mixedBidQuestions?: (MixedBidClaim & {
event: string; player: string; asker: string; answer: boolean; binding: boolean;
})[];
/** Original aggregate linked by ID to its native Richese bid obligation. */
mixedRicheseBidQuestions?: (MixedRicheseBidClaim & {
id: string; player: string; asker: string; answer: boolean; binding: boolean;
})[];
revivalPromises?: RevivalPromise[];
leaderRevivalPromises?: LeaderRevivalPromise[];
gholaLeaderPromises?: GholaLeaderPromise[];
@@ -8031,6 +8036,9 @@ function truthtranceDiscardSignature(g: Game, next: TruthDiscardContinuation) {
...(next.record.question.kind === 'mixedBid' ? {
mixedBidQuestions: g.mixedBidQuestions, bidPromises: g.bidPromises,
} : {}),
...(next.record.question.kind === 'mixedRicheseBid' ? {
mixedRicheseBidQuestions: g.mixedRicheseBidQuestions, richeseBidPromises: g.richeseBidPromises,
} : {}),
...(next.record.question.kind === 'mixedRevival' ? {
mixedRevivalQuestions: g.mixedRevivalQuestions, revivalExpressionPromises: g.revivalExpressionPromises,
} : {}),
@@ -18573,6 +18581,49 @@ function bindRicheseBidTruth(g: Game,p: Player,claim: RicheseBidClaim,answer: bo
'Choose an answer compatible with this Richese auction bid.');
(g.richeseBidPromises ??= []).push({...claim,id:crypto.randomUUID(),player:p.id,asker,answer});
}
function compileMixedRicheseBid(g: Game, p: Player, claim: MixedRicheseBidClaim, answer: boolean) {
const compiled = compileMixedActionExpression(claim.mixed,
fact => truthFactAnswer(p, fact, truthKnowledgeOf(g, p)), answer);
return compiled.kind === 'constant' ? {constant:compiled.value} :
{residual:mixedRicheseBidResidual(claim,compiled)};
}
function mixedRicheseBidTruthAnswers(g: Game, p: Player, claim: MixedRicheseBidClaim): TruthAnswer[] {
const lot = g.richeseAuction;
if (!richeseBidWindow(g) || !lot || claim.turn !== g.turn || claim.event !== lot.event ||
!lot.eligible.includes(p.id) || lot.acted.includes(p.id) ||
!richeseBidFitsHand(lot.source,lot.owner,p.id,p.hand.length,handLimit(p))) return [];
const answers: TruthAnswer[] = [];
for (const answer of [true,false]) {
const compiled = compileMixedRicheseBid(g,p,claim,answer);
if (compiled.constant !== undefined ? compiled.constant === answer :
richeseBidTruthAnswers(g,p,compiled.residual!).includes(answer ? 'yes' : 'no'))
answers.push(answer ? 'yes' : 'no');
}
return answers.length ? answers : ['unknown'];
}
function bindMixedRicheseBidTruth(g: Game,p: Player,claim: MixedRicheseBidClaim,answer: boolean,asker: string) {
requireRule(mixedRicheseBidTruthAnswers(g,p,claim).includes(answer ? 'yes' : 'no'),
'Choose a mixed answer compatible with this Richese auction.');
const compiled = compileMixedRicheseBid(g,p,claim,answer);
let id: string;
if (compiled.residual) {
bindRicheseBidTruth(g,p,compiled.residual,answer,asker);
id = g.richeseBidPromises!.at(-1)!.id;
} else {
requireRule(compiled.constant === answer, 'Retain the truthful whole mixed-bid answer.');
id = crypto.randomUUID();
}
(g.mixedRicheseBidQuestions ??= []).push({turn:claim.turn,event:claim.event,
mixed:structuredClone(claim.mixed),id,player:p.id,asker,answer,binding:!!compiled.residual});
}
function projectedMixedRicheseBidPromises(g: Game, player: string) {
return (g.mixedRicheseBidQuestions ?? []).filter(row => row.player === player).map(row => {
const bound = g.richeseBidPromises?.find(promise => promise.id === row.id);
return {id:row.id,turn:row.turn,event:row.event,player:row.player,asker:row.asker,
mixed:structuredClone(row.mixed),answer:row.answer,
fulfilled:!row.binding || bound?.fulfilled === true,released:bound?.released === true};
});
}
function richeseBidIntegrity(g: Game) {
richeseBidRule(() => validateRicheseBidPromises(g.richeseBidPromises ?? [],g.players.map(row => row.id)));
}
@@ -45363,6 +45414,8 @@ function applyActionInner(
bindRevival: bindRevivalTruth,
mixedBidAnswers: mixedBidTruthAnswers,
bindMixedBid: bindMixedBidTruth,
mixedRicheseBidAnswers: mixedRicheseBidTruthAnswers,
bindMixedRicheseBid: bindMixedRicheseBidTruth,
bidAnswers: bidTruthAnswers,
bindBid: bindBidTruth,
charityAnswers: charityTruthAnswers,
@@ -49848,11 +49901,19 @@ export function viewGame(state: Game, id: string, now?: number) {
}).map(player => player.id) : [],
truthRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
g.truthtrance.question.kind === 'richeseBid' ? richeseBidTruthAnswers(g,me,g.truthtrance.question) : null,
truthMixedRicheseBidTargets: richeseBidWindow(g) ? g.players.filter(player => {
const lot = g.richeseAuction!;
return lot.eligible.includes(player.id) && !lot.acted.includes(player.id);
}).map(player => player.id) : [],
truthMixedRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
g.truthtrance.question.kind === 'mixedRicheseBid' ? mixedRicheseBidTruthAnswers(g,me,g.truthtrance.question) : null,
mixedRicheseBidPromises: projectedMixedRicheseBidPromises(g,id),
truthEarlyRicheseBidTargets: earlyRicheseBidWindow(g) ? g.players.map(player => player.id) : [],
truthEarlyRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
g.truthtrance.question.kind === 'earlyRicheseBid' ? earlyRicheseBidTruthAnswers(g,me,g.truthtrance.question) : null,
ownEarlyRicheseBidPromises: (g.earlyRicheseBidPromises ?? []).filter(row => row.player === id).map(row => ({...row})),
richeseBidPromises: (g.richeseBidPromises ?? []).filter(row => row.player === id).map(row => ({...row})),
richeseBidPromises: (g.richeseBidPromises ?? []).filter(row => row.player === id &&
!g.mixedRicheseBidQuestions?.some(question => question.id === row.id)).map(row => ({...row})),
richeseBidPromiseGuide: projectedRicheseBidGuide(g,id),
truthPhaseBidTargets: phaseBidQuestionWindow(g) ? g.players.map(player => player.id) : [],
truthPhaseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
+19
View File
@@ -0,0 +1,19 @@
import { mixedBidMinimum, type BidActionClaim } from './mixed-bid-question';
import type { CompiledMixedAction, MixedActionExpression } from './mixed-action-question';
import { parseRicheseBidClaim, type RicheseBidClaim } from './richese-bid-promises';
/** Every future bid leaf addresses one declaration in this exact public lot. */
export type MixedRicheseBidClaim = {
turn: number;
event: string;
mixed: MixedActionExpression<BidActionClaim>;
};
/** After facts are frozen and constants folded, use the native Richese
* commitment rather than creating another bidding or funding mechanism. */
export function mixedRicheseBidResidual(
claim: MixedRicheseBidClaim,
compiled: CompiledMixedAction<BidActionClaim>,
): RicheseBidClaim {
return parseRicheseBidClaim({turn:claim.turn, event:claim.event, minimum:mixedBidMinimum(compiled)});
}
+6 -5
View File
@@ -1145,7 +1145,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'In supported Basic native games, voluntary revelation is also available during an Ix phase opening or selected auction and market decisions without replacing that decision. Other interruption windows remain unfinished.',
'In supported Basic games, your voluntary reveal can also interrupt a clean Emperor allied spice gift or extra-revival response, Tleilaxu revival-income response, Atreides Movement-phase Spice forecast without Bene Gesserit, or Guild’s own ordinary reserve-shipment rate response when the shipment enters a different territory from the marker. If Richese receives the extra revival, reveal from current reserves before that return. The original response and payment continue once; other interruptions remain guarded.',
'An active public agreement does not by itself prevent a supported reveal. Existing current-turn travel and other binding commitments still retain their separate safeguards, and a reveal does not settle or cancel a payment.',
'During supported Basic or Advanced games you can also reveal while another faction’s ordinary movement waits for a Fremen or Ixian response or a CHOAM decision. The original move and its response remain pending; a zero No-Field disappears without creating physical forces. An Advanced Bene Gesserit movement into the marker’s own territory remains guarded while its arrival stance is unresolved.',
'During supported Basic or Advanced games you can also reveal while another faction’s ordinary movement waits for a Fremen or Ixian response or a CHOAM decision. The original move and its response remain pending; a zero No-Field disappears without creating physical forces. A supported Advanced Bene Gesserit arrival at the CHOAM-occupied destination retains its declared stance.',
'These supported clean Basic interruptions also work with the Ecaz/Moritani deck and native factions. A token already present does not enter again when it is revealed; pending Ambassador and Terror reactions keep their own controls.',
'Provisional Guild transport treats your owned concealed marker as one billable force alongside any same-origin physical counters. Native Guild allies may cross-ship it through the normal permission and rate responses. The actual absent-Guild Secret Ally may cross-ship or return it face down, spending its Nexus once and paying the Bank. Cross keeps concealment; return creates no denomination-sized reserve deposit and retains the same-token next-shipment ban. Ordinary Guild allies cannot return. Select the marker separately from physical counters; ordinary movement remains available.',
'In supported native Homeworld games, you may provisionally ship one concealed No-Field from your supply to a foreign non-allied Homeworld, alone or with physical forces from those reserves. Advanced also permits a fresh marker-only placement on your own Homeworld for one spice; physical reserves are already there and cannot accompany it. On a later turn, you may ship that same concealed marker between distinct eligible Homeworlds, alone or with selected physical Richese counters from the marker’s current World; its own Homeworld is an eligible endpoint only in Advanced. Price the whole moving group as one plus those counters; a purchased Guild rate halves the total, rounding up once. The marker retains its identity and last-shipment history, and its value does not materialize until reveal; available reserves are placed there unless it is already on its own World, where the physical pool stays unchanged. Only one marker may be deployed globally. Optional-module combinations remain unavailable. The supplied revised rulebook permits World-to-World shipment (physical p. 22) and counts a concealed marker as one force for effects (physical p. 36), but does not settle its off-board source or native-world physical representation; this placement is provisional.',
@@ -3753,11 +3753,11 @@ export const RULE_TOPICS: RuleTopic[] = [
},
{
id: 'truthtrance-mixed-bid',
title: 'Truthtrance: current facts and ordinary bids',
title: 'Truthtrance: current facts and bids',
category: 'Cards',
coverage: 'Partial',
developmentStage: 'Prototyped',
summary: 'Combine answer-time facts with future accepted bid declarations in the current ordinary lot, preserving native funding and payment.',
summary: 'Combine answer-time facts with future accepted bid declarations in a supported ordinary or Richese cache lot, preserving native funding and payment.',
steps: [
'Choose Combine current facts and ordinary bids. Add full AND/OR groups with at least one current fact and one bid minimum. The fixed public turn and current ordinary lot apply to every bid condition; nested facts share the sixteen-condition, four-level input limit.',
'Current facts freeze at the actual answer. A statement that you hold at least10 spice remains that answer-time fact after the winning purchase leaves6. The answer does not require preserving the same resources afterward.',
@@ -3765,11 +3765,12 @@ export const RULE_TOPICS: RuleTopic[] = [
'A fact may already settle the aggregate, needing no bid. Otherwise only future accepted declarations in this exact lot count. Two smaller bids never add into a larger bid. A qualifying declaration fulfills Yes even when another bidder eventually wins; the original winning payment remains separate.',
'All remaining minima concern one future bid interval. Satisfying two minima requires the larger; satisfying either requires the smaller. This exact reduction retains every legal amount. No forbids qualifying later declarations through actual lot close.',
'Native current funds, prepaid allied aid, Karama overbidding, capacity, active/waiting eligibility, earlier commitments and release order remain. The answer grants no new opportunity, spice or free purchase and assumes no future rival raise.',
'Raw editing/preview/Ask, private answers, own aggregate status and one exact native bid/pass guide connect to four minimal policies. Fulfilled history does not duplicate or suppress a live guide. Phase-wide questions, native special auctions, other action families and broader compositions remain unfinished.',
'In a supported Richese Once Around or Silent cache auction, choose Combine current facts and a Richese bid. Facts freeze on answer and bid conditions address your one remaining accepted declaration in that exact lot. The original funding, auction order and winning payment remain; Silent bids stay sealed until their normal reveal.',
'Raw editing/preview/Ask, private answers, own aggregate status and one exact native bid/pass guide connect to four minimal policies. Fulfilled history does not duplicate or suppress a live guide. Phase-wide questions, Black Market bids, other action families and broader compositions remain unfinished.',
],
related: ['card-truthtrance', 'truthtrance-bid', 'truthtrance-mixed-revival', 'implementation-checklist'],
checklist: [
{ area: 'Implementation', status: 'Partial', detail: 'Shared answer-time compilation reduces remaining same-lot minima to an exact native scalar bid obligation; raw aggregate projection hides frozen values, reduced minima and hidden lot source.', evidence: ['game/mixed-action-question.ts', 'game/mixed-bid-question.ts', 'game/truthtrance.ts', 'game/engine.ts', 'tests/mixed-bid-question.test.ts'] },
{ area: 'Implementation', status: 'Partial', detail: 'Shared answer-time compilation reduces remaining same-lot minima to an exact native scalar bid obligation in ordinary and supported Richese Once Around/Silent auctions; raw aggregate projection hides frozen values and reduced minima.', evidence: ['game/mixed-action-question.ts', 'game/mixed-bid-question.ts', 'game/mixed-richese-bid-question.ts', 'game/truthtrance.ts', 'game/engine.ts', 'tests/mixed-bid-question.test.ts'] },
{ area: 'Player controls', status: 'Partial', detail: 'Full shared editor, fixed current lot, repairable bid drafts, raw preview/Ask, private answers and one exact live event guide are connected.', evidence: ['components/mixed-bid-fields.tsx', 'components/mixed-bid-promises.tsx', 'components/bid-promises.tsx', 'components/truthtrance.tsx', 'components/game-table.tsx', 'tests/truth-mixed-bid-controls.test.tsx'] },
{ area: 'AI', status: 'Partial', detail: 'Four minimal profiles answer and declare native bids. Strategic refinement/calibration remain deferred.', evidence: ['game/bots.ts', 'tests/truth-mixed-bid-runtime.test.ts'] },
{ area: 'Documentation', status: 'Implemented', detail: 'Snapshot/unknown meaning, exact threshold reduction, original declaration/invoice boundaries and remaining gates are explicit.', evidence: ['docs/TRUTHTRANCE_MIXED_BIDS.md', 'docs/RULE_DECISIONS.md'] },
+1 -1
View File
@@ -112,7 +112,7 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
// Mixed-question receipts can own binding state separately from the ordinary
// residual lists. Conservatively retain their whole current-turn boundary.
const mixed = [g.mixedBidQuestions, g.mixedRevivalQuestions, g.mixedBribeQuestions,
const mixed = [g.mixedBidQuestions, g.mixedRicheseBidQuestions, g.mixedRevivalQuestions, g.mixedBribeQuestions,
g.mixedAllianceQuestions, g.mixedMovementQuestions, g.mixedTraitorQuestions, g.mixedBattleQuestions];
if (mixed.some(rows => rows?.some(row => row.turn === g.turn && row.binding))) return false;
+27
View File
@@ -13,6 +13,7 @@ import { parseBattleActionClaim, MIXED_BATTLE_MAX_NODES, MIXED_BATTLE_MAX_TERMS,
import { parseAllianceExpressionClaim, allianceExpressionText, type AllianceExpressionClaim } from './alliance-expression-promises';
import { parseAllianceActionClaim, type MixedAllianceClaim } from './mixed-alliance-question';
import { parseBidActionClaim, MIXED_BID_MAX_DEPTH, MIXED_BID_MAX_LEAVES, type MixedBidClaim } from './mixed-bid-question';
import type { MixedRicheseBidClaim } from './mixed-richese-bid-question';
import { parseRevivalActionClaim, type MixedRevivalClaim } from './mixed-revival-question';
import { parseBribePaymentClaim, type MixedBribeClaim } from './mixed-bribe-question';
import { parseMixedActionExpression, mixedActionExpressionText, type MixedActionExpression } from './mixed-action-question';
@@ -112,6 +113,7 @@ export type TruthQuestion =
| ({ kind: 'allianceExpression'; target: string } & AllianceExpressionClaim)
| ({ kind: 'mixedAlliance'; target: string } & MixedAllianceClaim)
| ({ kind: 'mixedBid'; target: string } & MixedBidClaim)
| ({ kind: 'mixedRicheseBid'; target: string } & MixedRicheseBidClaim)
| ({ kind: 'mixedRevival'; target: string } & MixedRevivalClaim)
| ({ kind: 'mixedBribe'; target: string } & MixedBribeClaim)
| ({ kind: 'mixedMovement'; target: string } & MixedMovementClaim)
@@ -461,6 +463,19 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
'Choose a quiet supported Once Around or Silent auction and its current public event.');
return { kind: 'richeseBid', target: v.target, ...claim };
}
if (v.kind === 'mixedRicheseBid') {
check(Object.keys(v).sort().join(',') === 'event,kind,mixed,target,turn',
'Supply the current Richese lot, turn, complete mixed bid question and respondent.');
const claim = parseRicheseBidClaim({turn:v.turn,event:v.event,minimum:1}), lot = g.richeseAuction;
check(bidPromiseModeSupported({ ...g, semutaPreview: undefined }) && g.status === 'playing' && g.phase === 3 && lot &&
(lot.method === 'onceAround' || lot.method === 'silent') && !lot.outcome && lot.event === claim.event && claim.turn === g.turn &&
!g.response && !g.decision && !g.phaseOpening && !g.pendingKarama && !g.pendingTreacheryDiscard,
'Choose a quiet supported Once Around or Silent auction and its current public event.');
const respondent = g.players.find(player => player.id === v.target)!;
return {kind:'mixedRicheseBid', target:v.target as string, turn:claim.turn, event:claim.event,
mixed:parseMixedActionExpression(v.mixed, fact => parseFact(g,fact,respondent), parseBidActionClaim,
{maxLeaves:MIXED_BID_MAX_LEAVES,maxDepth:MIXED_BID_MAX_DEPTH})};
}
if (v.kind === 'phaseBid') {
check(Object.keys(v).sort().join(',') === 'kind,minimum,target,turn',
'Supply the current turn, phase bid minimum and respondent.');
@@ -1023,6 +1038,8 @@ export function truthQuestionText(
action => `you ${allianceClaimText({ turn: q.turn, partner: action.partner }, playerName)}`)}?`;
if (q.kind === 'mixedBid') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
action => `you ${bidClaimText({ turn: q.turn, lot: q.lot, minimum: action.minimum })}`)}?`;
if (q.kind === 'mixedRicheseBid') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
action => `you ${richeseBidClaimText({turn:q.turn,event:q.event,minimum:action.minimum})}`)}?`;
if (q.kind === 'mixedRevival') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
action => `you ${revivalExpressionText(action, id => id === 'kwisatz' ? 'Kwisatz Haderach' : leaderName(id))} before your Revival opportunity ends`)}?`;
if (q.kind === 'mixedBribe') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
@@ -1085,6 +1102,8 @@ export function resolveTruthAction(
bindRevival?: (g: Game, p: Player, claim: RevivalClaim, answer: boolean, asker: string) => void;
mixedBidAnswers?: (g: Game, p: Player, claim: MixedBidClaim) => TruthAnswer[];
bindMixedBid?: (g: Game, p: Player, claim: MixedBidClaim, answer: boolean, asker: string) => void;
mixedRicheseBidAnswers?: (g: Game, p: Player, claim: MixedRicheseBidClaim) => TruthAnswer[];
bindMixedRicheseBid?: (g: Game, p: Player, claim: MixedRicheseBidClaim, answer: boolean, asker: string) => void;
bidAnswers?: (g: Game, p: Player, claim: BidClaim) => TruthAnswer[];
bindBid?: (g: Game, p: Player, claim: BidClaim, answer: boolean, asker: string) => void;
charityAnswers?: (g: Game, p: Player, turn: number) => TruthAnswer[];
@@ -1324,6 +1343,9 @@ export function resolveTruthAction(
if (w.question.kind === 'mixedBid')
check(effects.mixedBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
'Choose a mixed current-fact and bid question with an available ordinary-lot opportunity.');
if (w.question.kind === 'mixedRicheseBid')
check(effects.mixedRicheseBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
'Choose a mixed current-fact and bid question with an available Richese auction opportunity.');
if (w.question.kind === 'bid')
check(effects.bidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
'Choose a bidder with a remaining ordinary opportunity in this lot.');
@@ -1474,6 +1496,11 @@ export function resolveTruthAction(
'Choose a whole mixed-bid answer compatible with current facts and native ordinary declarations.');
if (a.answer !== 'unknown') effects.bindMixedBid(g, p, q, a.answer === 'yes', current.player);
}
if (q.kind === 'mixedRicheseBid') {
check(effects.mixedRicheseBidAnswers && effects.bindMixedRicheseBid && effects.mixedRicheseBidAnswers(g, p, q).includes(a.answer),
'Choose a whole mixed-bid answer compatible with current facts and native Richese declarations.');
if (a.answer !== 'unknown') effects.bindMixedRicheseBid(g, p, q, a.answer === 'yes', current.player);
}
if (q.kind === 'bid') {
check(effects.bidAnswers && effects.bindBid && effects.bidAnswers(g, p, q).includes(a.answer),
'Choose an answer consistent with this lot, your legal bids and earlier answers.');