From 6ce9a4b4a7b15cbbebf86a1ceef3b7be38cfb5d4 Mon Sep 17 00:00:00 2001
From: Quintine <15965533+Quintine@users.noreply.github.com>
Date: Mon, 16 Nov 2026 18:42:40 +1100
Subject: [PATCH] Support mixed Truthtrance questions in Richese auctions
---
components/game-table.tsx | 2 +
components/mixed-bid-fields.tsx | 25 +++-
components/mixed-richese-bid-promises.tsx | 49 +++++++
components/truthtrance.tsx | 20 ++-
docs/CURRENT_STATUS.md | 10 ++
docs/RULE_DECISIONS.md | 7 +
docs/TRUTHTRANCE_MIXED_BIDS.md | 25 ++++
game/bots.ts | 4 +
game/engine.ts | 63 ++++++++-
game/mixed-richese-bid-question.ts | 19 +++
game/reference.ts | 11 +-
game/richese-reveal-interruption.ts | 2 +-
game/truthtrance.ts | 27 ++++
tests/mixed-richese-bid-question.test.ts | 29 ++++
.../truth-mixed-richese-bid-controls.test.tsx | 94 +++++++++++++
tests/truth-mixed-richese-bid-runtime.test.ts | 127 ++++++++++++++++++
16 files changed, 504 insertions(+), 10 deletions(-)
create mode 100644 components/mixed-richese-bid-promises.tsx
create mode 100644 game/mixed-richese-bid-question.ts
create mode 100644 tests/mixed-richese-bid-question.test.ts
create mode 100644 tests/truth-mixed-richese-bid-controls.test.tsx
create mode 100644 tests/truth-mixed-richese-bid-runtime.test.ts
diff --git a/components/game-table.tsx b/components/game-table.tsx
index 77d17907..399efb0e 100644
--- a/components/game-table.tsx
+++ b/components/game-table.tsx
@@ -46,6 +46,7 @@ import { BribeExpressionPromises } from './bribe-expression-promises';
import { MixedBribePromises } from './mixed-bribe-promises';
import { MixedRevivalPromises } from './mixed-revival-promises';
import { MixedBidPromises } from './mixed-bid-promises';
+import { MixedRicheseBidPromises } from './mixed-richese-bid-promises';
import { RevivalPromises } from './revival-promises';
import { RevivalExpressionPromises } from './revival-expression-promises';
import { LeaderRevivalPromises } from './leader-revival-promises';
@@ -2172,6 +2173,7 @@ export function GameTable({
{g.status === 'playing' && }
{g.status === 'playing' && }
{g.status === 'playing' && }
+ {g.status === 'playing' && }
{g.status === 'playing' && }
{g.status === 'playing' && }
{g.status === 'playing' && g.shortAllianceVictory &&
diff --git a/components/mixed-bid-fields.tsx b/components/mixed-bid-fields.tsx
index 9c9f5c8a..73505fb2 100644
--- a/components/mixed-bid-fields.tsx
+++ b/components/mixed-bid-fields.tsx
@@ -31,16 +31,37 @@ const config: MixedActionConfig = {
>,
};
-export function mixedBidInputError(value: unknown, game: GameView, target: string): string | null {
- return mixedActionInputError(value, game, target, config);
+const richeseConfig: MixedActionConfig = {
+ ...config,
+ prefix: 'mixed-richese-bid',
+ legend: 'Mixed current-fact / future Richese-lot bid claim',
+ actionLabel: 'Richese-lot bid condition',
+ actionTiming: 'Future bid · this Richese lot',
+ actionHelp: <>Count the one remaining accepted bid declaration after the answer in this Richese lot.
+ A qualifying bid does not promise a win; normal funding, bidding and winning-payment rules still apply.
+ In a Silent auction, submitted bid amounts stay private until the native reveal.
+ An unknown current fact uses a future commitment that guarantees the whole answer;
+ otherwise the answer is I don’t know.>,
+ fallbackError: 'Choose a current fact and a future Richese-lot bid condition.',
+};
+
+export function mixedBidInputError(value: unknown, game: GameView, target: string, variant: 'ordinary' | 'richese' = 'ordinary'): string | null {
+ return mixedActionInputError(value, game, target, variant === 'richese' ? richeseConfig : config);
}
export function MixedBidFields(props: {
value: MixedActionExpression;
game: GameView;
target: string;
disabled: boolean;
+ variant?: 'ordinary' | 'richese';
onChange: (expression: MixedActionExpression) => void;
}) {
+ if (props.variant === 'richese') {
+ const method = props.game.richeseAuction?.method;
+ const selected = method === 'silent' ? 'Silent' : 'Once Around';
+ return MixedActionFields({ ...props, config: { ...richeseConfig,
+ legend: `${richeseConfig.legend} · Turn ${props.game.turn} · ${selected}` } });
+ }
const lot = props.game.bidPromiseLot;
return MixedActionFields({ ...props, config: lot
? { ...config, legend: `${config.legend} · Turn ${lot.turn} · Ordinary lot ${lot.lot}` }
diff --git a/components/mixed-richese-bid-promises.tsx b/components/mixed-richese-bid-promises.tsx
new file mode 100644
index 00000000..4077daac
--- /dev/null
+++ b/components/mixed-richese-bid-promises.tsx
@@ -0,0 +1,49 @@
+'use client';
+
+import type { Action, GameView } from '@/game/engine';
+import { truthQuestionText } from '@/game/truthtrance';
+import { CHEAP_HERO_TRAITOR } from '@/game/traitors';
+import { Button } from './ui/button';
+
+/** Only the whole question, its answer and current status are projected. */
+export function MixedRicheseBidPromises(props: { game: GameView; busy: boolean; send: (action: Action) => void }) {
+ const game = props.game;
+ const own = game.mixedRicheseBidPromises.filter(promise => promise.player === game.me);
+ if (!own.length) return null;
+ const leaderName = (id: string) => id === 'kwisatz' ? 'Kwisatz Haderach'
+ : id === CHEAP_HERO_TRAITOR ? 'Cheap Hero / Heroine' : game.allLeaders.find(leader => leader.id === id)?.name ?? id;
+ const auction = game.richeseAuction, guide = game.richeseBidPromiseGuide;
+ const live = !!auction && own.some(promise => promise.turn === game.turn && promise.event === auction.event &&
+ !promise.fulfilled && !promise.released);
+ const action = guide?.action, signature = action && JSON.stringify(action);
+ const isCurrentGuide = () => {
+ if (props.game !== game || !auction || game.richeseAuction !== auction ||
+ !guide || game.richeseBidPromiseGuide !== guide || !action || guide.action !== action ||
+ JSON.stringify(action) !== signature || action.type !== 'richeseBid' || action.event !== auction.event ||
+ typeof action.richeseBidPromiseId !== 'string') return false;
+ return own.some(promise => promise.id === action.richeseBidPromiseId && promise.turn === game.turn &&
+ promise.event === auction.event && !promise.fulfilled && !promise.released);
+ };
+ const canGuide = () => !props.busy && isCurrentGuide();
+ return
+ Your mixed Richese bid promises
+ {own.map(promise =>
+ Turn {promise.turn}: You answered {promise.answer ? 'Yes' : 'No'} to {truthQuestionText({ kind: 'mixedRicheseBid',
+ target: promise.player, turn: promise.turn, event: promise.event, mixed: promise.mixed }, leaderName,
+ id => game.combatLocations.find(location => location.id === id)?.name ?? id,
+ id => game.players.find(player => player.id === id)?.name ?? id)}
+ {promise.released ? ' Released: this whole commitment is no longer possible.'
+ : promise.fulfilled ? ' Fulfilled: this whole commitment is complete.' : ' This whole answer is binding for this lot.'}
+ )}
+ Current facts are evaluated when you answer; they do not require you to keep cards, spice or forces afterward.
+ AND requires every condition; OR requires at least one. No negates the whole expression.
+ The original bidding, funding and payment rules still apply. Silent bids remain private until the native reveal.
+ {live && !guide && Your remaining bid opportunity may still be ahead; the answer stays visible while the lot continues.
}
+ {live && isCurrentGuide() && { if (canGuide() && action) props.send(action); }}>
+ {typeof action?.amount === 'number' && action.amount > 0
+ ? `Bid ${action.amount} spice while honoring your answers`
+ : action?.amount === 0 ? 'Submit zero spice while honoring your answers' : 'Pass this lot while honoring your answers'}
+ }
+ ;
+}
diff --git a/components/truthtrance.tsx b/components/truthtrance.tsx
index e684a97f..e9188077 100644
--- a/components/truthtrance.tsx
+++ b/components/truthtrance.tsx
@@ -159,7 +159,7 @@ export function Truthtrance({
g.players.find((p) => p.id !== me.id)!.id,
);
const [kind, setKind] = useState<
- 'fact' | 'freeform' | 'charity' | 'battlePlan' | 'futureBattleLeader' | 'shipment' | 'mixedShipment' | 'movement' | 'traitorCall' | 'bid' | 'phaseBid' | 'richeseBid' | 'earlyRicheseBid' | 'revival' | 'bribe' | 'pledgeAid' | 'alliance' | 'leaderRevival' | 'gholaLeader' | 'revivalExpression' | 'bribeExpression' | 'movementExpression' | 'mixedMovement' | 'mixedBribe' | 'mixedRevival' | 'mixedBid' | 'allianceExpression' | 'mixedAlliance' | 'mixedBattlePlan' | 'mixedTraitorCall' | 'travel' | 'turnActions'
+ 'fact' | 'freeform' | 'charity' | 'battlePlan' | 'futureBattleLeader' | 'shipment' | 'mixedShipment' | 'movement' | 'traitorCall' | 'bid' | 'phaseBid' | 'richeseBid' | 'earlyRicheseBid' | 'revival' | 'bribe' | 'pledgeAid' | 'alliance' | 'leaderRevival' | 'gholaLeader' | 'revivalExpression' | 'bribeExpression' | 'movementExpression' | 'mixedMovement' | 'mixedBribe' | 'mixedRevival' | 'mixedBid' | 'mixedRicheseBid' | 'allianceExpression' | 'mixedAlliance' | 'mixedBattlePlan' | 'mixedTraitorCall' | 'travel' | 'turnActions'
>('fact');
const [revivalLeader, setRevivalLeader] = useState(g.allLeaders.find(leader =>
leader.faction === g.players.find(player => player.id === target)?.faction)?.id ?? '');
@@ -230,6 +230,7 @@ export function Truthtrance({
{ kind: 'action', action: { minimum: 4 } },
] });
const mixedBidError = mixedBidInputError(mixedBid, g, target);
+ const mixedRicheseBidError = mixedBidInputError(mixedBid, g, target, 'richese');
const [mixedBattle, setMixedBattle] = useState>({ kind: 'and', terms: [
{ kind: 'fact', fact: { kind: 'hand', name: 'Shield' } },
{ kind: 'action', action: { kind: 'dial', compare: 'eq', value: 0 } },
@@ -308,6 +309,7 @@ export function Truthtrance({
: kind === 'pledgeAid' ? { kind, target, turn: g.turn, phase: g.phase === 3 ? 3 : 5, ally: pledgeAlly, minimum: pledgeMinimum }
: kind === 'revival' ? { kind, target, ...revivalClaim }
: kind === 'mixedBid' ? { kind, target, turn: bidClaim.turn, lot: bidClaim.lot, mixed: mixedBid }
+ : kind === 'mixedRicheseBid' ? { kind, target, turn: g.turn, event: g.richeseAuction?.event ?? '', mixed: mixedBid }
: kind === 'bid' ? { kind, target, ...bidClaim }
: kind === 'phaseBid' ? { kind, target, ...phaseBidClaim }
: kind === 'earlyRicheseBid' ? { kind, target, turn:g.turn, minimum:bidMinimum }
@@ -432,6 +434,13 @@ export function Truthtrance({
{button(answer === 'unknown' ? 'I don’t know yet' : `Answer ${answer === 'yes' ? 'Yes' : 'No'}`, { type: 'truthAnswer', answer })}
)}
>
+ ) : w.question!.kind === 'mixedRicheseBid' ? (
+ <>
+ Answer the whole mixed question. Current facts freeze now; any remaining bid conditions concern your one future accepted declaration in this Richese lot. No keeps the whole expression false. Normal funding and payment rules apply, and Silent bids remain sealed until the native reveal. An unknown fact requires a commitment that guarantees the whole answer; otherwise choose I don’t know.
+ {(g.truthMixedRicheseBidAnswers ?? []).map(answer =>
+ {button(answer === 'unknown' ? 'I don’t know' : `Answer ${answer === 'yes' ? 'Yes' : 'No'}`, { type: 'truthAnswer', answer })}
+
)}
+ >
) : w.question!.kind === 'mixedBid' ? (
<>
Answer the whole mixed question. Current facts freeze now; any remaining bid conditions concern future accepted declarations in this ordinary lot. No keeps the whole expression false. Passing, funding, Karama and the original winning payment still follow the auction rules. An unknown fact requires a commitment that guarantees the whole answer; otherwise choose I don’t know.
@@ -712,6 +721,7 @@ export function Truthtrance({
Bind a bid this Bidding phase
Bind a bid in the first Richese cache auction
Bind a bid in this Richese lot
+ Combine current facts and a Richese bid
Combine current facts and ordinary bids
Bind this battle’s Traitor declaration
Combine current facts and this Traitor declaration
@@ -782,6 +792,13 @@ export function Truthtrance({
{!g.truthMixedAllianceTargets.includes(target) && Choose a supported participant in a quiet ordinary Nexus.
}
{mixedAllianceError ?? truthQuestionText(question, leaderName, locationName, name)}
>
+ ) : kind === 'mixedRicheseBid' ? (
+ <>
+
+ {!g.truthMixedRicheseBidTargets.includes(target) && Choose a bidder with a remaining opportunity in this supported Richese Once Around or Silent auction.
}
+ {mixedRicheseBidError ?? truthQuestionText(question, leaderName, locationName, name)}
+ >
) : kind === 'mixedBid' ? (
<>
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 &&
diff --git a/game/mixed-richese-bid-question.ts b/game/mixed-richese-bid-question.ts
new file mode 100644
index 00000000..34533601
--- /dev/null
+++ b/game/mixed-richese-bid-question.ts
@@ -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;
+};
+
+/** 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,
+): RicheseBidClaim {
+ return parseRicheseBidClaim({turn:claim.turn, event:claim.event, minimum:mixedBidMinimum(compiled)});
+}
diff --git a/game/reference.ts b/game/reference.ts
index 0693bb42..43415ebb 100644
--- a/game/reference.ts
+++ b/game/reference.ts
@@ -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'] },
diff --git a/game/richese-reveal-interruption.ts b/game/richese-reveal-interruption.ts
index 840f4583..bbd29233 100644
--- a/game/richese-reveal-interruption.ts
+++ b/game/richese-reveal-interruption.ts
@@ -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;
diff --git a/game/truthtrance.ts b/game/truthtrance.ts
index 3f4a7605..33a61353 100644
--- a/game/truthtrance.ts
+++ b/game/truthtrance.ts
@@ -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.');
diff --git a/tests/mixed-richese-bid-question.test.ts b/tests/mixed-richese-bid-question.test.ts
new file mode 100644
index 00000000..026e590d
--- /dev/null
+++ b/tests/mixed-richese-bid-question.test.ts
@@ -0,0 +1,29 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { compileMixedActionExpression } from '../game/mixed-action-question';
+import { mixedRicheseBidResidual, type MixedRicheseBidClaim } from '../game/mixed-richese-bid-question';
+import { truthQuestionText, validateTruthQuestionReceipt, type TruthQuestion } from '../game/truthtrance';
+import { createTruthRicheseBidFixture } from './fixture-truth-richese-bid';
+
+const mixed: MixedRicheseBidClaim['mixed'] = {kind:'and',terms:[
+ {kind:'fact',fact:{kind:'spice',compare:'gte',value:10}},
+ {kind:'or',terms:[{kind:'action',action:{minimum:4}},{kind:'action',action:{minimum:7}}]},
+]};
+
+void test('Richese mixed bid reduction preserves the actual turn, public event and native threshold', () => {
+ const claim: MixedRicheseBidClaim = {turn:3,event:'original-public-lot',mixed};
+ const result = compileMixedActionExpression(mixed,() => 'yes',true);
+ assert.deepEqual(mixedRicheseBidResidual(claim,result),{turn:3,event:'original-public-lot',minimum:4});
+ assert.throws(() => mixedRicheseBidResidual({...claim,event:' stale '},result));
+ assert.throws(() => mixedRicheseBidResidual(claim,compileMixedActionExpression(mixed,() => 'no',false)));
+});
+
+void test('a Richese mixed bid question binds a current Once Around event without accepting old or extra metadata', () => {
+ const f = createTruthRicheseBidFixture(false);
+ const question: TruthQuestion = {kind:'mixedRicheseBid',target:f.target,turn:f.game.turn,event:f.lot,mixed};
+ assert.doesNotThrow(() => validateTruthQuestionReceipt(f.game,f.asker,question));
+ assert.match(truthQuestionText(question,id => id,id => id,id => id),/Richese auction/);
+ assert.throws(() => validateTruthQuestionReceipt(f.game,f.asker,{...question,event:'stale-lot'}));
+ assert.throws(() => validateTruthQuestionReceipt(f.game,f.asker,{...question,turn:f.game.turn+1}));
+ assert.throws(() => validateTruthQuestionReceipt(f.game,f.asker,{...question,lot:1} as TruthQuestion));
+});
diff --git a/tests/truth-mixed-richese-bid-controls.test.tsx b/tests/truth-mixed-richese-bid-controls.test.tsx
new file mode 100644
index 00000000..701763c6
--- /dev/null
+++ b/tests/truth-mixed-richese-bid-controls.test.tsx
@@ -0,0 +1,94 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { createElement, isValidElement, type ReactElement, type ReactNode } from 'react';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { MixedBidFields, mixedBidInputError } from '../components/mixed-bid-fields';
+import { MixedRicheseBidPromises } from '../components/mixed-richese-bid-promises';
+import { Truthtrance } from '../components/truthtrance';
+import { viewGame, type Action, type Game, type GameView } from '../game/engine';
+import type { BidActionClaim } from '../game/mixed-bid-question';
+import type { MixedActionExpression } from '../game/mixed-action-question';
+import { createTruthRicheseBidFixture } from './fixture-truth-richese-bid';
+import { createTruthRicheseSilentFixture } from './fixture-truth-richese-silent';
+import { actTruthtranceRichesePromises as act, passTruthRicheseFreshDiscard } from './fixture-truthtrance-richese-promises';
+
+type Expr = MixedActionExpression;
+type Fixture = ReturnType | ReturnType;
+type Props = { children?: ReactNode; [key: string]: unknown };
+const expression: Expr = {kind:'and',terms:[
+ {kind:'fact',fact:{kind:'spice',compare:'gte',value:10}},
+ {kind:'action',action:{minimum:4}},
+]};
+function elements(node: ReactNode): ReactElement[] {
+ if (Array.isArray(node)) return node.flatMap(elements);
+ if (!isValidElement(node)) return [];
+ return [node,...elements(node.props.children)];
+}
+function ask(f: Fixture, source: Game) {
+ let game = act(source,f.asker,{type:'card',card:f.truth});
+ for (let n = 0; game.truthtrance?.stage === 'priority' && n < game.players.length; n++) {
+ const seat = game.players.find(player => !game.truthtrance!.passed.includes(player.id)); assert.ok(seat);
+ game = act(game,seat.id,{type:'truthPass'});
+ }
+ assert.equal(game.truthtrance?.stage,'ask');
+ return game;
+}
+const truth = (game: GameView) => renderToStaticMarkup(createElement(Truthtrance,{game,busy:false,act() {}}));
+const panel = (game: GameView) => renderToStaticMarkup(createElement(MixedRicheseBidPromises,{game,busy:false,send() {}}));
+
+for (const method of ['onceAround','silent'] as const) void test(
+ `Advanced ${method} mixed Richese question controls show the right editor, answer and owned aggregate`, () => {
+ const f = method === 'onceAround' ? createTruthRicheseBidFixture(true) : createTruthRicheseSilentFixture(true);
+ const source = method === 'onceAround' ? act(f.game,f.asker,{type:'richeseBid',event:f.lot,amount:null}) : f.game;
+ let game = ask(f,source);
+ const asker = viewGame(game,f.asker);
+ assert.ok(asker.truthMixedRicheseBidTargets.includes(f.target));
+ assert.match(truth(asker),/Combine current facts and a Richese bid/);
+ const fields = renderToStaticMarkup(createElement(MixedBidFields,{value:expression,game:asker,target:f.target,
+ disabled:false,variant:'richese',onChange() {}}));
+ assert.equal(mixedBidInputError(expression,asker,f.target,'richese'),null);
+ assert.match(fields,method === 'silent' ? /Silent/ : /Once Around/);
+ assert.match(fields,/one remaining accepted bid declaration/);
+ assert.match(fields,/submitted bid amounts stay private/);
+ assert.doesNotMatch(fields,/Ordinary bank auctions only/);
+ const bad = {kind:'and',terms:[expression.terms[0],{kind:'action',action:{minimum:0}}]};
+ assert.ok(mixedBidInputError(bad,asker,f.target,'richese'));
+
+ game = act(game,f.asker,{type:'truthAsk',question:{kind:'mixedRicheseBid',target:f.target,
+ turn:game.turn,event:f.lot,mixed:expression}});
+ const answer = truth(viewGame(game,f.target));
+ assert.match(answer,/Answer the whole mixed question/);
+ assert.match(answer,/Answer Yes/); assert.match(answer,/Answer No/);
+ assert.match(answer,/Silent bids remain sealed/);
+ assert.doesNotMatch(truth(viewGame(game,f.owner)),/Answer Yes/);
+ game = passTruthRicheseFreshDiscard(act(game,f.target,{type:'truthAnswer',answer:'yes'}));
+ const target = viewGame(game,f.target), rendered = panel(target);
+ assert.match(rendered,/Your mixed Richese bid promises/);
+ assert.match(rendered,/You answered Yes/); assert.match(rendered,/at least 4 spice/);
+ assert.match(rendered,/data-testid="mixed-richese-bid-promise-guide"/);
+ assert.doesNotMatch(rendered,new RegExp(f.lot));
+ assert.doesNotMatch(panel(viewGame(game,f.owner)),/Your mixed Richese bid promises/);
+ });
+
+void test('mixed Richese guide forwards its original legal action and refuses busy, foreign or stale receipts', () => {
+ const f = createTruthRicheseSilentFixture(true);
+ let game = ask(f,f.game);
+ game = act(game,f.asker,{type:'truthAsk',question:{kind:'mixedRicheseBid',target:f.target,
+ turn:game.turn,event:f.lot,mixed:expression}});
+ game = passTruthRicheseFreshDiscard(act(game,f.target,{type:'truthAnswer',answer:'yes'}));
+ const view = viewGame(game,f.target), sent: Action[] = [];
+ const props = {game:view,busy:false,send(action:Action) {sent.push(action);}};
+ const tree = MixedRicheseBidPromises(props); assert.ok(tree);
+ const button = elements(tree).find(element => element.props['data-testid'] === 'mixed-richese-bid-promise-guide'); assert.ok(button);
+ (button.props.onClick as () => void)();
+ assert.deepEqual(sent,[view.richeseBidPromiseGuide!.action]);
+ props.busy = true;
+ (button.props.onClick as () => void)(); assert.equal(sent.length,1);
+ props.busy = false;
+ view.mixedRicheseBidPromises[0].fulfilled = true;
+ (button.props.onClick as () => void)(); assert.equal(sent.length,1);
+ view.mixedRicheseBidPromises[0].fulfilled = false;
+ view.richeseAuction!.event = 'later-lot';
+ (button.props.onClick as () => void)(); assert.equal(sent.length,1);
+ assert.doesNotMatch(panel(view),/data-testid="mixed-richese-bid-promise-guide"/);
+});
diff --git a/tests/truth-mixed-richese-bid-runtime.test.ts b/tests/truth-mixed-richese-bid-runtime.test.ts
new file mode 100644
index 00000000..4fba24d6
--- /dev/null
+++ b/tests/truth-mixed-richese-bid-runtime.test.ts
@@ -0,0 +1,127 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { botActions } from '../game/bots';
+import { DIFFICULTIES } from '../game/bot-profiles';
+import { viewGame, type Action, type Game } from '../game/engine';
+import type { BidActionClaim } from '../game/mixed-bid-question';
+import type { MixedActionExpression } from '../game/mixed-action-question';
+import { createTruthRicheseBidFixture } from './fixture-truth-richese-bid';
+import { createTruthRicheseSilentFixture } from './fixture-truth-richese-silent';
+import { actTruthtranceRichesePromises as act, passTruthRicheseFreshDiscard,
+ truthtranceRichesePromisesInventory as inventory, truthtranceRichesePromisesPlayer as player
+} from './fixture-truthtrance-richese-promises';
+
+type Fixture = ReturnType | ReturnType;
+type Expr = MixedActionExpression;
+const fact = (value:number): Expr => ({kind:'fact',fact:{kind:'spice',compare:'gte',value}});
+const bid = (minimum:number): Expr => ({kind:'action',action:{minimum}});
+const mixed = (kind:'and'|'or', value:number, minimum = 4): Expr => ({kind,terms:[fact(value),bid(minimum)]});
+function reject(game:Game, actor:string, action:Action) {
+ const before = structuredClone(game);
+ assert.throws(() => act(game,actor,action));
+ assert.deepEqual(game,before);
+}
+function ask(f:Fixture, source:Game, expression:Expr) {
+ let game = act(source,f.asker,{type:'card',card:f.truth});
+ for(let n=0;game.truthtrance?.stage === 'priority' && n !game.truthtrance!.passed.includes(p.id)); assert.ok(seat);
+ game = act(game,seat.id,{type:'truthPass'});
+ }
+ assert.equal(game.truthtrance?.stage,'ask');
+ return act(game,f.asker,{type:'truthAsk',question:{kind:'mixedRicheseBid',target:f.target,
+ turn:game.turn,event:f.lot,mixed:expression}});
+}
+function answer(f:Fixture, game:Game, choice:'yes'|'no') {
+ return passTruthRicheseFreshDiscard(act(game,f.target,{type:'truthAnswer',answer:choice}));
+}
+
+// Both fixture families originate in actual public setup and an original cache
+// lot; only their disclosed unopened deal/Spice ordering and scalar rolls are
+// controlled. No hand, wallet, bid, answer, or commitment is injected.
+for(const advanced of [false,true]) for(const method of ['onceAround','silent'] as const)
+ for(const choice of ['yes','no'] as const) void test(
+ `${advanced?'Advanced':'Basic'} ${method} mixed fact AND bid ${choice} constrains and settles the real lot`,() => {
+ const f = method === 'onceAround' ? createTruthRicheseBidFixture(advanced) : createTruthRicheseSilentFixture(advanced);
+ const source = method === 'onceAround' ? act(f.game,f.asker,{type:'richeseBid',event:f.lot,amount:null}) : f.game;
+ assert.equal(player(source,f.target).spice,10);
+ const expression = mixed('and',10), asked = ask(f,source,expression);
+ assert.deepEqual(viewGame(asked,f.target).truthMixedRicheseBidAnswers,['yes','no']);
+ assert.equal(viewGame(asked,f.asker).truthMixedRicheseBidAnswers,null);
+ const bound = answer(f,asked,choice), projected = viewGame(bound,f.target);
+ const aggregate = projected.mixedRicheseBidPromises.find(row => row.player === f.target); assert.ok(aggregate);
+ assert.deepEqual(aggregate.mixed,expression);
+ assert.equal(aggregate.fulfilled,false); assert.equal(aggregate.released,false);
+ assert.equal(viewGame(bound,f.owner).mixedRicheseBidPromises.length,0);
+ const guide = projected.richeseBidPromiseGuide; assert.ok(guide);
+ assert.equal(guide.action.richeseBidPromiseId,aggregate.id);
+ reject(bound,f.target,{...guide.action,richeseBidPromiseId:'stale-aggregate'});
+ reject(bound,f.target,{...guide.action,event:'stale-lot'});
+ reject(bound,f.target,{type:'richeseBid',event:f.lot,amount:choice === 'yes' ? 3 : 4,allyPayment:0});
+ const amount = choice === 'yes' ? 4 : 2;
+ let game = act(bound,f.target,{type:'richeseBid',event:f.lot,amount,allyPayment:0});
+ assert.equal(player(game,f.target).spice,10,'The bid is not an early invoice');
+ const receipt = viewGame(game,f.target).mixedRicheseBidPromises.find(row => row.player === f.target);
+ assert.ok(receipt);
+ assert.equal(receipt.id,aggregate.id); assert.equal(receipt.fulfilled,true); assert.equal(receipt.released,false);
+ reject(game,f.target,guide.action);
+ if(method === 'silent') {
+ assert.equal(viewGame(game,f.target).richeseAuction?.ownBid,amount);
+ assert.equal(viewGame(game,f.owner).richeseAuction?.ownBid,null);
+ assert.equal(viewGame(game,f.owner).richeseAuction?.revealedBids,null);
+ game = act(game,f.asker,{type:'richeseBid',event:f.lot,amount:0,allyPayment:0});
+ game = act(game,f.owner,{type:'richeseBid',event:f.lot,amount:0,allyPayment:0});
+ } else if(game.richeseAuction?.event === f.lot && game.richeseAuction.active === f.owner) {
+ game = act(game,f.owner,{type:'richeseBid',event:f.lot,amount:null});
+ }
+ assert.ok(player(game,f.target).hand.some(card => card.id === f.card));
+ assert.equal(player(game,f.target).spice,10-amount);
+ assert.equal(game.discard.filter(card => card.id === f.truth).length,1);
+ assert.deepEqual(inventory(game),f.originalCards);
+ });
+
+for(const method of ['onceAround','silent'] as const) void test(
+ `Advanced ${method} fact OR bid uses whole answer semantics and legal bot choices`,() => {
+ const f = method === 'onceAround' ? createTruthRicheseBidFixture(true) : createTruthRicheseSilentFixture(true);
+ const source = method === 'onceAround' ? act(f.game,f.asker,{type:'richeseBid',event:f.lot,amount:null}) : f.game;
+ // False current fact makes the disjunction depend on the future bid.
+ const asked = ask(f,source,mixed('or',11));
+ assert.deepEqual(viewGame(asked,f.target).truthMixedRicheseBidAnswers,['yes','no']);
+ for(const difficulty of DIFFICULTIES) {
+ const view = viewGame(asked,f.target); view.players.find(row => row.id === f.target)!.bot = difficulty;
+ const proposed = botActions(view)[0]; assert.equal(proposed?.type,'truthAnswer',difficulty);
+ const bound = passTruthRicheseFreshDiscard(act(structuredClone(asked),f.target,proposed));
+ const bidView = viewGame(bound,f.target); bidView.players.find(row => row.id === f.target)!.bot = difficulty;
+ const guide = bidView.richeseBidPromiseGuide; assert.ok(guide,difficulty);
+ assert.deepEqual(botActions(bidView)[0],guide.action);
+ assert.doesNotThrow(() => act(bound,f.target,guide.action));
+ }
+ // A true current fact makes OR inevitably true without any bid obligation.
+ const always = ask(f,source,mixed('or',10));
+ assert.deepEqual(viewGame(always,f.target).truthMixedRicheseBidAnswers,['yes']);
+ reject(always,f.target,{type:'truthAnswer',answer:'no'});
+ const settled = answer(f,always,'yes');
+ assert.equal(viewGame(settled,f.target).richeseBidPromiseGuide,null);
+ const aggregate = viewGame(settled,f.target).mixedRicheseBidPromises.find(row => row.player === f.target);
+ assert.ok(aggregate); assert.equal(aggregate.fulfilled,true); assert.equal(aggregate.released,false);
+ assert.ok(!(settled.richeseBidPromises ?? []).some(row => row.id === aggregate.id));
+ assert.deepEqual(inventory(settled),f.originalCards);
+ });
+
+for(const advanced of [false,true]) void test(
+ `${advanced?'Advanced':'Basic'} an opposing Once Around raise releases an impossible mixed Yes`,() => {
+ const f = createTruthRicheseBidFixture(advanced);
+ const asked = ask(f,f.game,mixed('or',11));
+ let game = answer(f,asked,'yes');
+ const before = viewGame(game,f.target).mixedRicheseBidPromises.find(row => row.player === f.target);
+ assert.ok(before); assert.equal(before.fulfilled,false); assert.equal(before.released,false);
+ assert.equal(viewGame(game,f.target).richeseBidPromiseGuide,null);
+ game = act(game,f.asker,{type:'richeseBid',event:f.lot,amount:10,allyPayment:0});
+ const after = viewGame(game,f.target).mixedRicheseBidPromises.find(row => row.id === before.id);
+ assert.ok(after); assert.equal(after.fulfilled,false); assert.equal(after.released,true);
+ game = act(game,f.target,{type:'richeseBid',event:f.lot,amount:null});
+ if(game.richeseAuction?.event === f.lot && game.richeseAuction.active === f.owner)
+ game = act(game,f.owner,{type:'richeseBid',event:f.lot,amount:null});
+ assert.ok(player(game,f.asker).hand.some(card => card.id === f.card));
+ assert.equal(player(game,f.target).spice,10);
+ assert.deepEqual(inventory(game),f.originalCards);
+ });