Support mixed Truthtrance questions in Richese auctions
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
1f3bc349ba
commit
6ce9a4b4a7
16 files changed
+504
-10
No files matched your search
@@ -46,6 +46,7 @@ import { BribeExpressionPromises } from './bribe-expression-promises';
|
|||||||
import { MixedBribePromises } from './mixed-bribe-promises';
|
import { MixedBribePromises } from './mixed-bribe-promises';
|
||||||
import { MixedRevivalPromises } from './mixed-revival-promises';
|
import { MixedRevivalPromises } from './mixed-revival-promises';
|
||||||
import { MixedBidPromises } from './mixed-bid-promises';
|
import { MixedBidPromises } from './mixed-bid-promises';
|
||||||
|
import { MixedRicheseBidPromises } from './mixed-richese-bid-promises';
|
||||||
import { RevivalPromises } from './revival-promises';
|
import { RevivalPromises } from './revival-promises';
|
||||||
import { RevivalExpressionPromises } from './revival-expression-promises';
|
import { RevivalExpressionPromises } from './revival-expression-promises';
|
||||||
import { LeaderRevivalPromises } from './leader-revival-promises';
|
import { LeaderRevivalPromises } from './leader-revival-promises';
|
||||||
@@ -2172,6 +2173,7 @@ export function GameTable({
|
|||||||
{g.status === 'playing' && <PhaseBidPromises game={g} send={act} busy={busy} />}
|
{g.status === 'playing' && <PhaseBidPromises game={g} send={act} busy={busy} />}
|
||||||
{g.status === 'playing' && <EarlyRicheseBidPromises game={g} />}
|
{g.status === 'playing' && <EarlyRicheseBidPromises game={g} />}
|
||||||
{g.status === 'playing' && <MixedBidPromises game={g} send={act} busy={busy} />}
|
{g.status === 'playing' && <MixedBidPromises game={g} send={act} busy={busy} />}
|
||||||
|
{g.status === 'playing' && <MixedRicheseBidPromises game={g} send={act} busy={busy} />}
|
||||||
{g.status === 'playing' && <MixedBattlePromises game={g} />}
|
{g.status === 'playing' && <MixedBattlePromises game={g} />}
|
||||||
{g.status === 'playing' && <FutureBattleLeaderPromises game={g} />}
|
{g.status === 'playing' && <FutureBattleLeaderPromises game={g} />}
|
||||||
{g.status === 'playing' && g.shortAllianceVictory && <p className="notice">
|
{g.status === 'playing' && g.shortAllianceVictory && <p className="notice">
|
||||||
|
|||||||
@@ -31,16 +31,37 @@ const config: MixedActionConfig<BidActionClaim> = {
|
|||||||
</>,
|
</>,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function mixedBidInputError(value: unknown, game: GameView, target: string): string | null {
|
const richeseConfig: MixedActionConfig<BidActionClaim> = {
|
||||||
return mixedActionInputError(value, game, target, config);
|
...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: {
|
export function MixedBidFields(props: {
|
||||||
value: MixedActionExpression<BidActionClaim>;
|
value: MixedActionExpression<BidActionClaim>;
|
||||||
game: GameView;
|
game: GameView;
|
||||||
target: string;
|
target: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
variant?: 'ordinary' | 'richese';
|
||||||
onChange: (expression: MixedActionExpression<BidActionClaim>) => void;
|
onChange: (expression: MixedActionExpression<BidActionClaim>) => 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;
|
const lot = props.game.bidPromiseLot;
|
||||||
return MixedActionFields({ ...props, config: lot
|
return MixedActionFields({ ...props, config: lot
|
||||||
? { ...config, legend: `${config.legend} · Turn ${lot.turn} · Ordinary lot ${lot.lot}` }
|
? { ...config, legend: `${config.legend} · Turn ${lot.turn} · Ordinary lot ${lot.lot}` }
|
||||||
|
|||||||
@@ -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 <section className="notice space-y-3" aria-label="Your Truthtrance mixed Richese bid promises" id="mixed-richese-bid-promise-guidance">
|
||||||
|
<h3>Your mixed Richese bid promises</h3>
|
||||||
|
<ul>{own.map(promise => <li key={promise.id}>
|
||||||
|
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.'}
|
||||||
|
</li>)}</ul>
|
||||||
|
<p>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.</p>
|
||||||
|
{live && !guide && <p>Your remaining bid opportunity may still be ahead; the answer stays visible while the lot continues.</p>}
|
||||||
|
{live && isCurrentGuide() && <Button className="game-action min-h-11 whitespace-normal" data-testid="mixed-richese-bid-promise-guide"
|
||||||
|
disabled={!canGuide()} onClick={() => { 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'}
|
||||||
|
</Button>}
|
||||||
|
</section>;
|
||||||
|
}
|
||||||
@@ -159,7 +159,7 @@ export function Truthtrance({
|
|||||||
g.players.find((p) => p.id !== me.id)!.id,
|
g.players.find((p) => p.id !== me.id)!.id,
|
||||||
);
|
);
|
||||||
const [kind, setKind] = useState<
|
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');
|
>('fact');
|
||||||
const [revivalLeader, setRevivalLeader] = useState(g.allLeaders.find(leader =>
|
const [revivalLeader, setRevivalLeader] = useState(g.allLeaders.find(leader =>
|
||||||
leader.faction === g.players.find(player => player.id === target)?.faction)?.id ?? '');
|
leader.faction === g.players.find(player => player.id === target)?.faction)?.id ?? '');
|
||||||
@@ -230,6 +230,7 @@ export function Truthtrance({
|
|||||||
{ kind: 'action', action: { minimum: 4 } },
|
{ kind: 'action', action: { minimum: 4 } },
|
||||||
] });
|
] });
|
||||||
const mixedBidError = mixedBidInputError(mixedBid, g, target);
|
const mixedBidError = mixedBidInputError(mixedBid, g, target);
|
||||||
|
const mixedRicheseBidError = mixedBidInputError(mixedBid, g, target, 'richese');
|
||||||
const [mixedBattle, setMixedBattle] = useState<MixedActionExpression<MixedBattleActionClaim>>({ kind: 'and', terms: [
|
const [mixedBattle, setMixedBattle] = useState<MixedActionExpression<MixedBattleActionClaim>>({ kind: 'and', terms: [
|
||||||
{ kind: 'fact', fact: { kind: 'hand', name: 'Shield' } },
|
{ kind: 'fact', fact: { kind: 'hand', name: 'Shield' } },
|
||||||
{ kind: 'action', action: { kind: 'dial', compare: 'eq', value: 0 } },
|
{ 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 === 'pledgeAid' ? { kind, target, turn: g.turn, phase: g.phase === 3 ? 3 : 5, ally: pledgeAlly, minimum: pledgeMinimum }
|
||||||
: kind === 'revival' ? { kind, target, ...revivalClaim }
|
: kind === 'revival' ? { kind, target, ...revivalClaim }
|
||||||
: kind === 'mixedBid' ? { kind, target, turn: bidClaim.turn, lot: bidClaim.lot, mixed: mixedBid }
|
: 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 === 'bid' ? { kind, target, ...bidClaim }
|
||||||
: kind === 'phaseBid' ? { kind, target, ...phaseBidClaim }
|
: kind === 'phaseBid' ? { kind, target, ...phaseBidClaim }
|
||||||
: kind === 'earlyRicheseBid' ? { kind, target, turn:g.turn, minimum:bidMinimum }
|
: 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 })}
|
{button(answer === 'unknown' ? 'I don’t know yet' : `Answer ${answer === 'yes' ? 'Yes' : 'No'}`, { type: 'truthAnswer', answer })}
|
||||||
</div>)}
|
</div>)}
|
||||||
</>
|
</>
|
||||||
|
) : w.question!.kind === 'mixedRicheseBid' ? (
|
||||||
|
<>
|
||||||
|
<p className="notice">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.</p>
|
||||||
|
{(g.truthMixedRicheseBidAnswers ?? []).map(answer => <div key={answer}>
|
||||||
|
{button(answer === 'unknown' ? 'I don’t know' : `Answer ${answer === 'yes' ? 'Yes' : 'No'}`, { type: 'truthAnswer', answer })}
|
||||||
|
</div>)}
|
||||||
|
</>
|
||||||
) : w.question!.kind === 'mixedBid' ? (
|
) : w.question!.kind === 'mixedBid' ? (
|
||||||
<>
|
<>
|
||||||
<p className="notice">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.</p>
|
<p className="notice">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.</p>
|
||||||
@@ -712,6 +721,7 @@ export function Truthtrance({
|
|||||||
<option value="phaseBid">Bind a bid this Bidding phase</option>
|
<option value="phaseBid">Bind a bid this Bidding phase</option>
|
||||||
<option value="earlyRicheseBid">Bind a bid in the first Richese cache auction</option>
|
<option value="earlyRicheseBid">Bind a bid in the first Richese cache auction</option>
|
||||||
<option value="richeseBid">Bind a bid in this Richese lot</option>
|
<option value="richeseBid">Bind a bid in this Richese lot</option>
|
||||||
|
<option value="mixedRicheseBid">Combine current facts and a Richese bid</option>
|
||||||
<option value="mixedBid">Combine current facts and ordinary bids</option>
|
<option value="mixedBid">Combine current facts and ordinary bids</option>
|
||||||
<option value="traitorCall">Bind this battle’s Traitor declaration</option>
|
<option value="traitorCall">Bind this battle’s Traitor declaration</option>
|
||||||
<option value="mixedTraitorCall">Combine current facts and this Traitor declaration</option>
|
<option value="mixedTraitorCall">Combine current facts and this Traitor declaration</option>
|
||||||
@@ -782,6 +792,13 @@ export function Truthtrance({
|
|||||||
{!g.truthMixedAllianceTargets.includes(target) && <p className="notice">Choose a supported participant in a quiet ordinary Nexus.</p>}
|
{!g.truthMixedAllianceTargets.includes(target) && <p className="notice">Choose a supported participant in a quiet ordinary Nexus.</p>}
|
||||||
<p className="notice" aria-label="Public mixed alliance question preview">{mixedAllianceError ?? truthQuestionText(question, leaderName, locationName, name)}</p>
|
<p className="notice" aria-label="Public mixed alliance question preview">{mixedAllianceError ?? truthQuestionText(question, leaderName, locationName, name)}</p>
|
||||||
</>
|
</>
|
||||||
|
) : kind === 'mixedRicheseBid' ? (
|
||||||
|
<>
|
||||||
|
<MixedBidFields value={mixedBid} game={g} target={target} variant="richese"
|
||||||
|
disabled={busy || !g.richeseAuction || !g.truthMixedRicheseBidTargets.includes(target)} onChange={setMixedBid} />
|
||||||
|
{!g.truthMixedRicheseBidTargets.includes(target) && <p className="notice">Choose a bidder with a remaining opportunity in this supported Richese Once Around or Silent auction.</p>}
|
||||||
|
<p className="notice" aria-label="Public mixed Richese bid question preview">{mixedRicheseBidError ?? truthQuestionText(question, leaderName, locationName, name)}</p>
|
||||||
|
</>
|
||||||
) : kind === 'mixedBid' ? (
|
) : kind === 'mixedBid' ? (
|
||||||
<>
|
<>
|
||||||
<MixedBidFields value={mixedBid} game={g} target={target}
|
<MixedBidFields value={mixedBid} game={g} target={target}
|
||||||
@@ -1035,6 +1052,7 @@ export function Truthtrance({
|
|||||||
(kind === 'pledgeAid' && (!!pledgeClaimInputError(pledgeMinimum) || !g.truthPledgeTargets.includes(target))) ||
|
(kind === 'pledgeAid' && (!!pledgeClaimInputError(pledgeMinimum) || !g.truthPledgeTargets.includes(target))) ||
|
||||||
(kind === 'revival' && (!!revivalClaimInputError(revivalClaim) || !g.truthRevivalTargets.includes(target))) ||
|
(kind === 'revival' && (!!revivalClaimInputError(revivalClaim) || !g.truthRevivalTargets.includes(target))) ||
|
||||||
(kind === 'mixedBid' && (!!mixedBidError || !g.truthMixedBidTargets.includes(target))) ||
|
(kind === 'mixedBid' && (!!mixedBidError || !g.truthMixedBidTargets.includes(target))) ||
|
||||||
|
(kind === 'mixedRicheseBid' && (!!mixedRicheseBidError || !g.richeseAuction || !g.truthMixedRicheseBidTargets.includes(target))) ||
|
||||||
(kind === 'bid' && (!!bidClaimInputError(bidClaim) || !g.truthBidTargets.includes(target))) ||
|
(kind === 'bid' && (!!bidClaimInputError(bidClaim) || !g.truthBidTargets.includes(target))) ||
|
||||||
(kind === 'earlyRicheseBid' && (!!richeseBidMinimumError(bidMinimum) || !g.truthEarlyRicheseBidTargets.includes(target))) ||
|
(kind === 'earlyRicheseBid' && (!!richeseBidMinimumError(bidMinimum) || !g.truthEarlyRicheseBidTargets.includes(target))) ||
|
||||||
(kind === 'richeseBid' && (!!richeseBidMinimumError(bidMinimum) || !g.richeseAuction || !g.truthRicheseBidTargets.includes(target))) ||
|
(kind === 'richeseBid' && (!!richeseBidMinimumError(bidMinimum) || !g.richeseAuction || !g.truthRicheseBidTargets.includes(target))) ||
|
||||||
|
|||||||
@@ -17,6 +17,16 @@ open mode gates.
|
|||||||
|
|
||||||
## Current checkpoint and work
|
## Current checkpoint and work
|
||||||
|
|
||||||
|
**Mixed Truthtrance facts and Richese bids — 16 November. Prototyped /
|
||||||
|
Partial.** Players can combine answer-time facts and a future bid in a
|
||||||
|
supported Once Around or Silent Richese cache lot. Native bid funding, one-declaration
|
||||||
|
timing, card custody, sealed bids and settlement remain authoritative;
|
||||||
|
questions settled by facts create no bid obligation. Player editing, own
|
||||||
|
aggregate guidance and minimal legal bots are connected. Ten related unit
|
||||||
|
files pass 77 cases. Black Market
|
||||||
|
and phase-wide mixed questions, optional modules, complete games and deployed
|
||||||
|
acceptance remain open. [Scope](TRUTHTRANCE_MIXED_BIDS.md#current-facts-and-richese-bids--16-november-2026).
|
||||||
|
|
||||||
**Advanced Black Market gifts and Bene Gesserit arrivals — 16 November.
|
**Advanced Black Market gifts and Bene Gesserit arrivals — 16 November.
|
||||||
Prototyped / Partial.** Supported Black Market sales now permit the Emperor's
|
Prototyped / Partial.** Supported Black Market sales now permit the Emperor's
|
||||||
allied gift for Normal, Once Around and Silent auctions, including provisional
|
allied gift for Normal, Once Around and Silent auctions, including provisional
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# Rule decision index
|
# Rule decision index
|
||||||
|
|
||||||
|
## Mixed current facts and Richese bids — 16 November 2026
|
||||||
|
|
||||||
|
The existing provisional mixed question and native one-declaration Richese bid
|
||||||
|
semantics compose in supported Once Around and Silent cache lots. The actual lot,
|
||||||
|
funding, sealed bids and original settlement remain authoritative.
|
||||||
|
[Scope](TRUTHTRANCE_MIXED_BIDS.md#current-facts-and-richese-bids--16-november-2026).
|
||||||
|
|
||||||
## Advanced selected-deck Emperor auction gifts — 16 November 2026
|
## Advanced selected-deck Emperor auction gifts — 16 November 2026
|
||||||
|
|
||||||
The existing provisional prepayment gift extends to supported Advanced
|
The existing provisional prepayment gift extends to supported Advanced
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# Truthtrance current facts and ordinary bids
|
# Truthtrance current facts and ordinary bids
|
||||||
|
|
||||||
|
## Current facts and Richese bids — 16 November 2026
|
||||||
|
|
||||||
|
**Prototyped / Partial.** A separate event-bound `mixedRicheseBid` question
|
||||||
|
combines current facts with a future declaration in the same supported Once
|
||||||
|
Around or Silent Richese cache lot. The original question and whole answer remain
|
||||||
|
visible to its respondent; frozen fact values and the reduced native threshold
|
||||||
|
are not separately projected. The shared compiler snapshots facts at the
|
||||||
|
answer, and the existing Richese commitment enforces funding, eligibility,
|
||||||
|
single-declaration timing, actual payment and external release. An answer
|
||||||
|
settled entirely by a fact creates no bid obligation. Silent bids remain
|
||||||
|
sealed until the native reveal. The original lot, physical card and bidder
|
||||||
|
order are unchanged.
|
||||||
|
|
||||||
|
The publisher FAQ and supplied Advanced revision support questions and
|
||||||
|
compliance as described below; the online ordering and conservative handling of
|
||||||
|
unknown facts remain provisional. Basic and Advanced public-start tests use
|
||||||
|
actual questions, original cache lots and native payments, with fixture-staged
|
||||||
|
unopened deal and Spice order. The structured editor, own status and native
|
||||||
|
guide are connected; bots use the same feasible answers and guide. Ten related
|
||||||
|
unit files pass 77 cases, including [runtime](../tests/truth-mixed-richese-bid-runtime.test.ts),
|
||||||
|
[controls](../tests/truth-mixed-richese-bid-controls.test.tsx) and
|
||||||
|
[reduction](../tests/mixed-richese-bid-question.test.ts). Black Market
|
||||||
|
bidding, phase-wide mixed questions, optional modules, broader combined
|
||||||
|
commitments, full games and deployed acceptance remain open.
|
||||||
|
|
||||||
## Mixed aggregate prototype — 26 October 2026
|
## Mixed aggregate prototype — 26 October 2026
|
||||||
|
|
||||||
**Prototyped / Partial.** The packet is
|
**Prototyped / Partial.** The packet is
|
||||||
|
|||||||
@@ -1368,6 +1368,10 @@ function policyActions(g: GameView): Action[] {
|
|||||||
const answer = g.truthMixedBidAnswers?.[0];
|
const answer = g.truthMixedBidAnswers?.[0];
|
||||||
return answer ? [{ type: 'truthAnswer', answer }] : [];
|
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') {
|
if (w.question.kind === 'mixedRevival') {
|
||||||
const answer = g.truthMixedRevivalAnswers?.[0];
|
const answer = g.truthMixedRevivalAnswers?.[0];
|
||||||
return answer ? [{ type: 'truthAnswer', answer }] : [];
|
return answer ? [{ type: 'truthAnswer', answer }] : [];
|
||||||
|
|||||||
+62
-1
@@ -63,6 +63,7 @@ import { AllianceExpressionPromiseError, allianceExpressionOutcomes, findAllianc
|
|||||||
type AllianceExpression, type AllianceExpressionClaim, type AllianceExpressionPromise } from './alliance-expression-promises';
|
type AllianceExpression, type AllianceExpressionClaim, type AllianceExpressionPromise } from './alliance-expression-promises';
|
||||||
import type { AllianceActionClaim, MixedAllianceClaim } from './mixed-alliance-question';
|
import type { AllianceActionClaim, MixedAllianceClaim } from './mixed-alliance-question';
|
||||||
import { mixedBidMinimum, type MixedBidClaim } from './mixed-bid-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 { RevivalActionClaim, MixedRevivalClaim } from './mixed-revival-question';
|
||||||
import type { BribePaymentClaim, MixedBribeClaim } from './mixed-bribe-question';
|
import type { BribePaymentClaim, MixedBribeClaim } from './mixed-bribe-question';
|
||||||
import { compileMixedActionExpression, MixedActionQuestionError, type CompiledMixedAction } from './mixed-action-question';
|
import { compileMixedActionExpression, MixedActionQuestionError, type CompiledMixedAction } from './mixed-action-question';
|
||||||
@@ -2507,6 +2508,10 @@ export type Game = {
|
|||||||
mixedBidQuestions?: (MixedBidClaim & {
|
mixedBidQuestions?: (MixedBidClaim & {
|
||||||
event: string; player: string; asker: string; answer: boolean; binding: boolean;
|
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[];
|
revivalPromises?: RevivalPromise[];
|
||||||
leaderRevivalPromises?: LeaderRevivalPromise[];
|
leaderRevivalPromises?: LeaderRevivalPromise[];
|
||||||
gholaLeaderPromises?: GholaLeaderPromise[];
|
gholaLeaderPromises?: GholaLeaderPromise[];
|
||||||
@@ -8031,6 +8036,9 @@ function truthtranceDiscardSignature(g: Game, next: TruthDiscardContinuation) {
|
|||||||
...(next.record.question.kind === 'mixedBid' ? {
|
...(next.record.question.kind === 'mixedBid' ? {
|
||||||
mixedBidQuestions: g.mixedBidQuestions, bidPromises: g.bidPromises,
|
mixedBidQuestions: g.mixedBidQuestions, bidPromises: g.bidPromises,
|
||||||
} : {}),
|
} : {}),
|
||||||
|
...(next.record.question.kind === 'mixedRicheseBid' ? {
|
||||||
|
mixedRicheseBidQuestions: g.mixedRicheseBidQuestions, richeseBidPromises: g.richeseBidPromises,
|
||||||
|
} : {}),
|
||||||
...(next.record.question.kind === 'mixedRevival' ? {
|
...(next.record.question.kind === 'mixedRevival' ? {
|
||||||
mixedRevivalQuestions: g.mixedRevivalQuestions, revivalExpressionPromises: g.revivalExpressionPromises,
|
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.');
|
'Choose an answer compatible with this Richese auction bid.');
|
||||||
(g.richeseBidPromises ??= []).push({...claim,id:crypto.randomUUID(),player:p.id,asker,answer});
|
(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) {
|
function richeseBidIntegrity(g: Game) {
|
||||||
richeseBidRule(() => validateRicheseBidPromises(g.richeseBidPromises ?? [],g.players.map(row => row.id)));
|
richeseBidRule(() => validateRicheseBidPromises(g.richeseBidPromises ?? [],g.players.map(row => row.id)));
|
||||||
}
|
}
|
||||||
@@ -45363,6 +45414,8 @@ function applyActionInner(
|
|||||||
bindRevival: bindRevivalTruth,
|
bindRevival: bindRevivalTruth,
|
||||||
mixedBidAnswers: mixedBidTruthAnswers,
|
mixedBidAnswers: mixedBidTruthAnswers,
|
||||||
bindMixedBid: bindMixedBidTruth,
|
bindMixedBid: bindMixedBidTruth,
|
||||||
|
mixedRicheseBidAnswers: mixedRicheseBidTruthAnswers,
|
||||||
|
bindMixedRicheseBid: bindMixedRicheseBidTruth,
|
||||||
bidAnswers: bidTruthAnswers,
|
bidAnswers: bidTruthAnswers,
|
||||||
bindBid: bindBidTruth,
|
bindBid: bindBidTruth,
|
||||||
charityAnswers: charityTruthAnswers,
|
charityAnswers: charityTruthAnswers,
|
||||||
@@ -49848,11 +49901,19 @@ export function viewGame(state: Game, id: string, now?: number) {
|
|||||||
}).map(player => player.id) : [],
|
}).map(player => player.id) : [],
|
||||||
truthRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
|
truthRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
|
||||||
g.truthtrance.question.kind === 'richeseBid' ? richeseBidTruthAnswers(g,me,g.truthtrance.question) : null,
|
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) : [],
|
truthEarlyRicheseBidTargets: earlyRicheseBidWindow(g) ? g.players.map(player => player.id) : [],
|
||||||
truthEarlyRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
|
truthEarlyRicheseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
|
||||||
g.truthtrance.question.kind === 'earlyRicheseBid' ? earlyRicheseBidTruthAnswers(g,me,g.truthtrance.question) : null,
|
g.truthtrance.question.kind === 'earlyRicheseBid' ? earlyRicheseBidTruthAnswers(g,me,g.truthtrance.question) : null,
|
||||||
ownEarlyRicheseBidPromises: (g.earlyRicheseBidPromises ?? []).filter(row => row.player === id).map(row => ({...row})),
|
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),
|
richeseBidPromiseGuide: projectedRicheseBidGuide(g,id),
|
||||||
truthPhaseBidTargets: phaseBidQuestionWindow(g) ? g.players.map(player => player.id) : [],
|
truthPhaseBidTargets: phaseBidQuestionWindow(g) ? g.players.map(player => player.id) : [],
|
||||||
truthPhaseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
|
truthPhaseBidAnswers: g.truthtrance?.stage === 'answer' && g.truthtrance.question?.target === id &&
|
||||||
|
|||||||
@@ -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
@@ -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 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.',
|
'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.',
|
'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.',
|
'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.',
|
'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.',
|
'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',
|
id: 'truthtrance-mixed-bid',
|
||||||
title: 'Truthtrance: current facts and ordinary bids',
|
title: 'Truthtrance: current facts and bids',
|
||||||
category: 'Cards',
|
category: 'Cards',
|
||||||
coverage: 'Partial',
|
coverage: 'Partial',
|
||||||
developmentStage: 'Prototyped',
|
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: [
|
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.',
|
'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.',
|
'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.',
|
'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.',
|
'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.',
|
'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'],
|
related: ['card-truthtrance', 'truthtrance-bid', 'truthtrance-mixed-revival', 'implementation-checklist'],
|
||||||
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: '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: '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'] },
|
{ 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'] },
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
|
|||||||
|
|
||||||
// Mixed-question receipts can own binding state separately from the ordinary
|
// Mixed-question receipts can own binding state separately from the ordinary
|
||||||
// residual lists. Conservatively retain their whole current-turn boundary.
|
// 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];
|
g.mixedAllianceQuestions, g.mixedMovementQuestions, g.mixedTraitorQuestions, g.mixedBattleQuestions];
|
||||||
if (mixed.some(rows => rows?.some(row => row.turn === g.turn && row.binding))) return false;
|
if (mixed.some(rows => rows?.some(row => row.turn === g.turn && row.binding))) return false;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { parseBattleActionClaim, MIXED_BATTLE_MAX_NODES, MIXED_BATTLE_MAX_TERMS,
|
|||||||
import { parseAllianceExpressionClaim, allianceExpressionText, type AllianceExpressionClaim } from './alliance-expression-promises';
|
import { parseAllianceExpressionClaim, allianceExpressionText, type AllianceExpressionClaim } from './alliance-expression-promises';
|
||||||
import { parseAllianceActionClaim, type MixedAllianceClaim } from './mixed-alliance-question';
|
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 { 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 { parseRevivalActionClaim, type MixedRevivalClaim } from './mixed-revival-question';
|
||||||
import { parseBribePaymentClaim, type MixedBribeClaim } from './mixed-bribe-question';
|
import { parseBribePaymentClaim, type MixedBribeClaim } from './mixed-bribe-question';
|
||||||
import { parseMixedActionExpression, mixedActionExpressionText, type MixedActionExpression } from './mixed-action-question';
|
import { parseMixedActionExpression, mixedActionExpressionText, type MixedActionExpression } from './mixed-action-question';
|
||||||
@@ -112,6 +113,7 @@ export type TruthQuestion =
|
|||||||
| ({ kind: 'allianceExpression'; target: string } & AllianceExpressionClaim)
|
| ({ kind: 'allianceExpression'; target: string } & AllianceExpressionClaim)
|
||||||
| ({ kind: 'mixedAlliance'; target: string } & MixedAllianceClaim)
|
| ({ kind: 'mixedAlliance'; target: string } & MixedAllianceClaim)
|
||||||
| ({ kind: 'mixedBid'; target: string } & MixedBidClaim)
|
| ({ kind: 'mixedBid'; target: string } & MixedBidClaim)
|
||||||
|
| ({ kind: 'mixedRicheseBid'; target: string } & MixedRicheseBidClaim)
|
||||||
| ({ kind: 'mixedRevival'; target: string } & MixedRevivalClaim)
|
| ({ kind: 'mixedRevival'; target: string } & MixedRevivalClaim)
|
||||||
| ({ kind: 'mixedBribe'; target: string } & MixedBribeClaim)
|
| ({ kind: 'mixedBribe'; target: string } & MixedBribeClaim)
|
||||||
| ({ kind: 'mixedMovement'; target: string } & MixedMovementClaim)
|
| ({ 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.');
|
'Choose a quiet supported Once Around or Silent auction and its current public event.');
|
||||||
return { kind: 'richeseBid', target: v.target, ...claim };
|
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') {
|
if (v.kind === 'phaseBid') {
|
||||||
check(Object.keys(v).sort().join(',') === 'kind,minimum,target,turn',
|
check(Object.keys(v).sort().join(',') === 'kind,minimum,target,turn',
|
||||||
'Supply the current turn, phase bid minimum and respondent.');
|
'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)}`)}?`;
|
action => `you ${allianceClaimText({ turn: q.turn, partner: action.partner }, playerName)}`)}?`;
|
||||||
if (q.kind === 'mixedBid') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
|
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 })}`)}?`;
|
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,
|
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`)}?`;
|
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,
|
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;
|
bindRevival?: (g: Game, p: Player, claim: RevivalClaim, answer: boolean, asker: string) => void;
|
||||||
mixedBidAnswers?: (g: Game, p: Player, claim: MixedBidClaim) => TruthAnswer[];
|
mixedBidAnswers?: (g: Game, p: Player, claim: MixedBidClaim) => TruthAnswer[];
|
||||||
bindMixedBid?: (g: Game, p: Player, claim: MixedBidClaim, answer: boolean, asker: string) => void;
|
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[];
|
bidAnswers?: (g: Game, p: Player, claim: BidClaim) => TruthAnswer[];
|
||||||
bindBid?: (g: Game, p: Player, claim: BidClaim, answer: boolean, asker: string) => void;
|
bindBid?: (g: Game, p: Player, claim: BidClaim, answer: boolean, asker: string) => void;
|
||||||
charityAnswers?: (g: Game, p: Player, turn: number) => TruthAnswer[];
|
charityAnswers?: (g: Game, p: Player, turn: number) => TruthAnswer[];
|
||||||
@@ -1324,6 +1343,9 @@ export function resolveTruthAction(
|
|||||||
if (w.question.kind === 'mixedBid')
|
if (w.question.kind === 'mixedBid')
|
||||||
check(effects.mixedBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
|
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.');
|
'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')
|
if (w.question.kind === 'bid')
|
||||||
check(effects.bidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
|
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.');
|
'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.');
|
'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 (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') {
|
if (q.kind === 'bid') {
|
||||||
check(effects.bidAnswers && effects.bindBid && effects.bidAnswers(g, p, q).includes(a.answer),
|
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.');
|
'Choose an answer consistent with this lot, your legal bids and earlier answers.');
|
||||||
|
|||||||
@@ -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));
|
||||||
|
});
|
||||||
@@ -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<BidActionClaim>;
|
||||||
|
type Fixture = ReturnType<typeof createTruthRicheseBidFixture> | ReturnType<typeof createTruthRicheseSilentFixture>;
|
||||||
|
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<Props>[] {
|
||||||
|
if (Array.isArray(node)) return node.flatMap(elements);
|
||||||
|
if (!isValidElement<Props>(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"/);
|
||||||
|
});
|
||||||
@@ -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<typeof createTruthRicheseBidFixture> | ReturnType<typeof createTruthRicheseSilentFixture>;
|
||||||
|
type Expr = MixedActionExpression<BidActionClaim>;
|
||||||
|
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.players.length;n++) {
|
||||||
|
const seat = game.players.find(p => !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);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user