Support Truthtrance ordering in Black Market auctions
Verify and publish checkpoint container / container (push) Successful in 11m19s

This commit is contained in:
Quintine committed 2026-11-16 18:49:05 +11:00
1 parent 6ce9a4b4a7
commit 868713eeb9
15 files changed
+359 -28

No files matched your search

+5 -4
View File
@@ -16,7 +16,7 @@ export function PhaseBidClaimFields(props: {
}) { }) {
const error = phaseBidClaimInputError(props.value); const error = phaseBidClaimInputError(props.value);
return <fieldset className="grid gap-2" disabled={props.disabled} aria-label="Bidding phase condition"> return <fieldset className="grid gap-2" disabled={props.disabled} aria-label="Bidding phase condition">
<legend>Bid during this turn</legend> <legend>Ordinary auction bid during this turn</legend>
<p>Turn {props.value.turn} · Remaining ordinary Bidding phase</p> <p>Turn {props.value.turn} · Remaining ordinary Bidding phase</p>
<label htmlFor="truth-phase-bid-minimum">Minimum bid in spice</label> <label htmlFor="truth-phase-bid-minimum">Minimum bid in spice</label>
<Input id="truth-phase-bid-minimum" type="number" min={1} max={Number.MAX_SAFE_INTEGER} step={1} required <Input id="truth-phase-bid-minimum" type="number" min={1} max={Number.MAX_SAFE_INTEGER} step={1} required
@@ -30,9 +30,10 @@ export function PhaseBidClaimFields(props: {
}} /> }} />
{error && <p role="alert">{error}</p>} {error && <p role="alert">{error}</p>}
<p className="fine" id="truth-phase-bid-help"> <p className="fine" id="truth-phase-bid-help">
This asks about one accepted bid of at least this size after the answer, This asks about one accepted ordinary auction bid of at least this size
before Bidding ends this turn. Earlier bids do not count; it does not after the answer, before Bidding ends this turn. Richese cache and Black
promise a win or change the winning payment. Market bids do not count. Earlier bids do not count; it does not promise
a win or change the winning payment.
</p> </p>
</fieldset>; </fieldset>;
} }
+4 -3
View File
@@ -52,9 +52,10 @@ export function PhaseBidPromises(props: PhaseBidPromiseProps) {
: promise.fulfilled ? ' Fulfilled: this commitment is complete.' : ' This answer is binding through this Bidding phase.'} : promise.fulfilled ? ' Fulfilled: this commitment is complete.' : ' This answer is binding through this Bidding phase.'}
</li>)}</ul> </li>)}</ul>
<p> <p>
Yes requires a qualifying future bid while it remains possible. No forbids Yes requires a qualifying future ordinary auction bid while it remains possible.
qualifying bids through Bidding close. A bid can fulfill Yes even if another No forbids qualifying ordinary bids through Bidding close. Richese cache and
player wins; the original payment rules still apply. Black Market bids do not count. A bid can fulfill Yes even if another player
wins; the original payment rules still apply.
</p> </p>
<p className="fine"> <p className="fine">
Earlier bids do not count. Ordinary auctions retain their original order and Earlier bids do not count. Ordinary auctions retain their original order and
+2 -2
View File
@@ -548,7 +548,7 @@ export function Truthtrance({
</> </>
) : w.question!.kind === 'phaseBid' ? ( ) : w.question!.kind === 'phaseBid' ? (
<> <>
<p className="notice">Yes requires one qualifying ordinary bid before this turn’s Bidding closes while possible. No forbids all qualifying later bids. A bid does not promise a win; winning still requires payment.</p> <p className="notice">Yes requires one qualifying ordinary bid before this turn’s Bidding closes while possible. No forbids qualifying later ordinary bids. Richese cache and Black Market bids do not count. A bid does not promise a win; winning still requires payment.</p>
{(g.truthPhaseBidAnswers ?? []).map(answer => <div key={answer}> {(g.truthPhaseBidAnswers ?? []).map(answer => <div key={answer}>
{button(`Answer ${answer === 'yes' ? 'Yes' : answer === 'no' ? 'No' : 'I don’t know'}`, { type: 'truthAnswer', answer })} {button(`Answer ${answer === 'yes' ? 'Yes' : answer === 'no' ? 'No' : 'I don’t know'}`, { type: 'truthAnswer', answer })}
</div>)} </div>)}
@@ -718,7 +718,7 @@ export function Truthtrance({
<option value="revival">Bind ordinary force revivals this turn</option> <option value="revival">Bind ordinary force revivals this turn</option>
<option value="bid">Bind a bid in this ordinary lot</option> <option value="bid">Bind a bid in this ordinary lot</option>
<option value="charity">Bind a Charity claim this turn</option> <option value="charity">Bind a Charity claim this turn</option>
<option value="phaseBid">Bind a bid this Bidding phase</option> <option value="phaseBid">Bind an ordinary 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="mixedRicheseBid">Combine current facts and a Richese bid</option>
+15 -3
View File
@@ -17,14 +17,26 @@ open mode gates.
## Current checkpoint and work ## Current checkpoint and work
**Advanced Black Market Truthtrance — 16 November. Prototyped / Partial.**
Simultaneous questions now receive the existing provisional Sapho ordering
opportunity during supported Normal, Once Around and Silent lots. Original
card custody, bids and funding remain in place; Advanced Semuta at the Sapho
discard remains open. Genuine Advanced tests also confirm that the previously
implemented single and mixed Richese bid questions work in Once Around and
Silent Black Market lots. Phase-wide questions currently count ordinary bids
only, and the question and controls now say so. Nine related test files pass
53 cases. Full games, combinations and
deployed acceptance remain open. [Sapho scope](JUICE_OF_SAPHO_RUNTIME.md#truthtrance-order-in-advanced-black-market--16-november-2026),
[mixed bid scope](TRUTHTRANCE_MIXED_BIDS.md#current-facts-and-richese-bids--16-november-2026).
**Mixed Truthtrance facts and Richese bids — 16 November. Prototyped / **Mixed Truthtrance facts and Richese bids — 16 November. Prototyped /
Partial.** Players can combine answer-time facts and a future bid in a 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 supported Once Around or Silent Richese cache or Advanced Black Market lot. Native bid funding, one-declaration
timing, card custody, sealed bids and settlement remain authoritative; timing, card custody, sealed bids and settlement remain authoritative;
questions settled by facts create no bid obligation. Player editing, own questions settled by facts create no bid obligation. Player editing, own
aggregate guidance and minimal legal bots are connected. Ten related unit aggregate guidance and minimal legal bots are connected. Ten related unit
files pass 77 cases. Black Market files pass 77 cases. Normal Black Market and phase-wide mixed questions,
and phase-wide mixed questions, optional modules, complete games and deployed optional modules, complete games and deployed
acceptance remain open. [Scope](TRUTHTRANCE_MIXED_BIDS.md#current-facts-and-richese-bids--16-november-2026). 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.
+18
View File
@@ -1,5 +1,23 @@
# Juice of Sapho: finite ordering implementation # Juice of Sapho: finite ordering implementation
## Truthtrance order in Advanced Black Market — 16 November 2026
**Prototyped / Partial.** The shared opportunity to reorder simultaneous
Truthtrance questions now also opens during a clean Advanced Black Market
lot, using Normal, Once Around or Silent bidding. It keeps the original seller's
reserved physical card, lot, standing bids, funding, order and sealed submissions
while questions resolve. Silent amounts remain private until their native
reveal. Sapho may not spend the card reserved for sale. These online priorities
remain provisional under the authority described below; they are not a
publisher clarification.
Advanced Sapho currently uses its existing synchronous discard; the separate
Advanced Semuta reaction to this cost is not implemented by this extension.
Other optional combinations, complete games and deployed acceptance remain open.
The [public-start cases](../tests/sapho-truth-black-market-runtime.test.ts)
use real setup and sale actions, with disclosed conserved card swaps for Sapho
and a second Truthtrance.
## Shared Ambassador and Terror arrival — 29 October 2026 ## Shared Ambassador and Terror arrival — 29 October 2026
**Prototyped / Partial.** In a supported fresh Basic Richese game, an ordinary **Prototyped / Partial.** In a supported fresh Basic Richese game, an ordinary
+9 -1
View File
@@ -1,9 +1,17 @@
# Rule decision index # Rule decision index
## Advanced Black Market Truthtrance order — 16 November 2026
The existing provisional Sapho order for simultaneous questions extends to
clean Advanced Black Market auctions with their original lot and funding.
Advanced Semuta at this discard remains open.
[Scope](JUICE_OF_SAPHO_RUNTIME.md#truthtrance-order-in-advanced-black-market--16-november-2026).
## Mixed current facts and Richese bids — 16 November 2026 ## Mixed current facts and Richese bids — 16 November 2026
The existing provisional mixed question and native one-declaration Richese bid The existing provisional mixed question and native one-declaration Richese bid
semantics compose in supported Once Around and Silent cache lots. The actual lot, semantics compose in supported Once Around and Silent cache and Advanced
Black Market lots. The actual lot,
funding, sealed bids and original settlement remain authoritative. funding, sealed bids and original settlement remain authoritative.
[Scope](TRUTHTRANCE_MIXED_BIDS.md#current-facts-and-richese-bids--16-november-2026). [Scope](TRUTHTRANCE_MIXED_BIDS.md#current-facts-and-richese-bids--16-november-2026).
+5 -3
View File
@@ -4,7 +4,7 @@
**Prototyped / Partial.** A separate event-bound `mixedRicheseBid` question **Prototyped / Partial.** A separate event-bound `mixedRicheseBid` question
combines current facts with a future declaration in the same supported Once 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 Around or Silent Richese cache or Advanced Black Market lot. The original question and whole answer remain
visible to its respondent; frozen fact values and the reduced native threshold visible to its respondent; frozen fact values and the reduced native threshold
are not separately projected. The shared compiler snapshots facts at the are not separately projected. The shared compiler snapshots facts at the
answer, and the existing Richese commitment enforces funding, eligibility, answer, and the existing Richese commitment enforces funding, eligibility,
@@ -21,8 +21,10 @@ 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 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), 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 [controls](../tests/truth-mixed-richese-bid-controls.test.tsx) and
[reduction](../tests/mixed-richese-bid-question.test.ts). Black Market [reduction](../tests/mixed-richese-bid-question.test.ts). Later
bidding, phase-wide mixed questions, optional modules, broader combined [Black Market public-start cases](../tests/truth-black-market-bid-runtime.test.ts)
confirm the existing Once Around and Silent implementation, including seller
retention and sealed privacy. Normal Black Market bidding, phase-wide mixed questions, optional modules, broader combined
commitments, full games and deployed acceptance remain open. commitments, full games and deployed acceptance remain open.
## Mixed aggregate prototype — 26 October 2026 ## Mixed aggregate prototype — 26 October 2026
+5 -5
View File
@@ -514,7 +514,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'If you recover the physical Sapho after choosing Last, you may use it again to choose First, including after suspending your own started turn. This provisionally replaces your own Last protection without restoring spent actions. Completed turns stay complete and a different started current actor finishes first. Another holder cannot replace your protected Last.', 'If you recover the physical Sapho after choosing Last, you may use it again to choose First, including after suspending your own started turn. This provisionally replaces your own Last protection without restoring spent actions. Completed turns stay complete and a different started current actor finishes first. Another holder cannot replace your protected Last.',
'Between completed battles, choose first or last among remaining battle choosers. The priority lasts for the rest of the Battle phase. You still need a real unresolved battle. Others may choose battles against you before your own turn; last is not immunity. This scope changes the chooser, not each battle’s aggressor or tie advantage.', 'Between completed battles, choose first or last among remaining battle choosers. The priority lasts for the rest of the Battle phase. You still need a real unresolved battle. Others may choose battles against you before your own turn; last is not immunity. This scope changes the chooser, not each battle’s aggressor or tie advantage.',
'In a fresh Richese battle, use unreserved Sapho at a clean boundary before both combatants finish final battle actions, including after sealed plans and revealed declarations. Habbanya still precedes ordinary aggressor tie priority. Participants, plans, promises, weapon choices and votes do not swap or replay. Older battles retain their pre-plan opportunity.', 'In a fresh Richese battle, use unreserved Sapho at a clean boundary before both combatants finish final battle actions, including after sealed plans and revealed declarations. Habbanya still precedes ordinary aggressor tie priority. Participants, plans, promises, weapon choices and votes do not swap or replay. Older battles retain their pre-plan opportunity.',
'When two or more players declared Truthtrance in a supported clean parent, each queued holder may continue or use their held Sapho to move their entire pending question group first or last. Physical storm order and each holder’s card order stay unchanged. Supported Semuta claim/pass restores the same question queue, including the selected Homeworld, Leader Skills and Discovery profiles. Clean ordinary auction lots also preserve their standing bid and remaining clock. Richese cache Once Around and Silent lots preserve their original bidding and funding; Black Market, other special auctions and pending-parent combinations remain unfinished.', 'When two or more players declared Truthtrance in a supported clean parent, each queued holder may continue or use their held Sapho to move their entire pending question group first or last. Physical storm order and each holder’s card order stay unchanged. Supported Semuta claim/pass restores the same question queue, including the selected Homeworld, Leader Skills and Discovery profiles. Clean ordinary auction lots also preserve their standing bid and remaining clock. Richese cache Once Around and Silent lots and Advanced Black Market lots preserve their original bidding and funding. The Advanced Black Market Sapho discard does not yet offer its Semuta reaction; other special auctions and pending-parent combinations remain unfinished.',
'During a clean native Extortion payer decision, use Sapho to take your optional choice first/last among unanswered non-Moritani players. Earlier declines, collected bank5 and the one-payment3 limit remain. The next payer event changes even when that player stays next. You may decline instead of paying.', 'During a clean native Extortion payer decision, use Sapho to take your optional choice first/last among unanswered non-Moritani players. Earlier declines, collected bank5 and the one-payment3 limit remain. The next payer event changes even when that player stays next. You may decline instead of paying.',
'Before either of two Ecological Testing Station occupants chooses, use Sapho to take your adjustment first or last if that changes the order. Fresh choices with Richese seated give both occupants a shared opportunity to use an available order change or continue; an automated occupant cannot advance the station choice while another player is deciding. Each occupant still adjusts the cumulative storm distance once. Physical storm order and its original source stay unchanged. In supported Semuta games, claim or pass resumes the same next choice. Replay of a recovered Sapho remains unfinished; this online priority is provisional.', 'Before either of two Ecological Testing Station occupants chooses, use Sapho to take your adjustment first or last if that changes the order. Fresh choices with Richese seated give both occupants a shared opportunity to use an available order change or continue; an automated occupant cannot advance the station choice while another player is deciding. Each occupant still adjusts the cumulative storm distance once. Physical storm order and its original source stay unchanged. In supported Semuta games, claim or pass resumes the same next choice. Replay of a recovered Sapho remains unfinished; this online priority is provisional.',
'During ordered Advanced Charity, take your remaining turn first or last, then discard Sapho. An accepted current claim provisionally protects that actor while another holder reorders only later unstarted turns. At a clean boundary, the holder may pause its own claimed turn and resume last without repeating the claim or payment. Completed turns stay closed and physical First Player order is unchanged. Basic and older concurrent phases have no ordered scope.', 'During ordered Advanced Charity, take your remaining turn first or last, then discard Sapho. An accepted current claim provisionally protects that actor while another holder reorders only later unstarted turns. At a clean boundary, the holder may pause its own claimed turn and resume last without repeating the claim or payment. Completed turns stay closed and physical First Player order is unchanged. Basic and older concurrent phases have no ordered scope.',
@@ -3757,7 +3757,7 @@ export const RULE_TOPICS: RuleTopic[] = [
category: 'Cards', category: 'Cards',
coverage: 'Partial', coverage: 'Partial',
developmentStage: 'Prototyped', developmentStage: 'Prototyped',
summary: 'Combine answer-time facts with future accepted bid declarations in a supported ordinary or Richese cache lot, preserving native funding and payment.', summary: 'Combine answer-time facts with future accepted bid declarations in a supported ordinary or Richese 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,8 +3765,8 @@ 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.',
'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.', 'In a supported Richese Once Around or Silent cache or Advanced Black Market 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.', '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, normal 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: [
@@ -3787,7 +3787,7 @@ export const RULE_TOPICS: RuleTopic[] = [
steps: [ steps: [
'Choose Bind a bid in this ordinary lot, another remaining eligible bidder and a positive whole spice minimum. The turn and lot are fixed. Registered native Basic and Advanced tables without optional modules are supported first; broader compositions remain unfinished.', 'Choose Bind a bid in this ordinary lot, another remaining eligible bidder and a positive whole spice minimum. The turn and lot are fixed. Registered native Basic and Advanced tables without optional modules are supported first; broader compositions remain unfinished.',
'In a quiet Richese Once Around auction, choose Bind a bid in this Once Around lot to bind the respondent’s one remaining bid or pass. A waiting Richese owner cannot promise Yes until an actual bid ensures an owner turn. Current hand space, funds and pledged aid remain required; an opposing raise can release an impossible Yes. Normal special auctions remain outside this prototype.', 'In a quiet Richese Once Around auction, choose Bind a bid in this Once Around lot to bind the respondent’s one remaining bid or pass. A waiting Richese owner cannot promise Yes until an actual bid ensures an owner turn. Current hand space, funds and pledged aid remain required; an opposing raise can release an impossible Yes. Normal special auctions remain outside this prototype.',
'Alternatively choose Bind a bid this Bidding phase. Yes requires one qualifying accepted ordinary bid after the answer and before Bidding closes; No forbids qualifying later ordinary bids across lots. Earlier bids do not count, and a bid does not promise a win.', 'Alternatively choose Bind an ordinary bid this Bidding phase. Yes requires one qualifying accepted ordinary bid after the answer and before Bidding closes; No forbids qualifying later ordinary bids across lots. Earlier bids do not count, and a bid does not promise a win.',
'In a Silent Richese lot the question binds the respondent’s single sealed submission. Zero declines; a positive bid remains hidden until the native simultaneous reveal. Available answers use that bidder’s own funding, without using opponents’ concealed amounts.', 'In a Silent Richese lot the question binds the respondent’s single sealed submission. Zero declines; a positive bid remains hidden until the native simultaneous reveal. Available answers use that bidder’s own funding, without using opponents’ concealed amounts.',
'Before Basic Bidding, ask about a minimum bid in the first actual Richese cache auction of this turn. The answer waits for the real event and does not predict its card or method. Current uncommitted personal funds and hand space supply a conservative Yes witness; cancellation or an opposing action can release an impossible commitment. The Richese owner’s Once Around turn may vanish if everyone else passes.', 'Before Basic Bidding, ask about a minimum bid in the first actual Richese cache auction of this turn. The answer waits for the real event and does not predict its card or method. Current uncommitted personal funds and hand space supply a conservative Yes witness; cancellation or an opposing action can release an impossible commitment. The Richese owner’s Once Around turn may vanish if everyone else passes.',
'Your waiting cache commitment remains visible until its auction opens or it ends. Once the real lot opens, the ordinary Richese bid guide takes over.', 'Your waiting cache commitment remains visible until its auction opens or it ends. Once the real lot opens, the ordinary Richese bid guide takes over.',
+5 -3
View File
@@ -1609,12 +1609,14 @@ export function resolveTruthAction(
// decision to open it never inspects who holds Juice of Sapho. // decision to open it never inspects who holds Juice of Sapho.
const ordinaryLot = g.phase === 3 && !!g.auction?.cards[g.auction.index] && const ordinaryLot = g.phase === 3 && !!g.auction?.cards[g.auction.index] &&
!!g.auction.active && !g.currentAuctionSale && !g.ixAuction; !!g.auction.active && !g.currentAuctionSale && !g.ixAuction;
const richeseCacheLot = g.phase === 3 && !!g.richeseAuction && g.richeseAuction.source === 'cache' && const richeseLot = g.phase === 3 && !!g.richeseAuction &&
(g.richeseAuction.method === 'onceAround' || g.richeseAuction.method === 'silent') && (g.richeseAuction.source === 'cache' && (g.richeseAuction.method === 'onceAround' || g.richeseAuction.method === 'silent') ||
g.advanced && g.richeseAuction.source === 'blackMarket' &&
['normal','onceAround','silent'].includes(g.richeseAuction.method)) &&
!g.richeseAuction.outcome && !g.currentAuctionSale && !g.auction && !g.ixAuction; !g.richeseAuction.outcome && !g.currentAuctionSale && !g.auction && !g.ixAuction;
const clean = g.status === 'playing' && g.expansions.includes('choam') && !g.response && !g.decision && !g.phaseOpening && const clean = g.status === 'playing' && g.expansions.includes('choam') && !g.response && !g.decision && !g.phaseOpening &&
!g.pendingKarama && !g.pendingTreacheryDiscard && !g.pendingNullentropy && (!g.auction || ordinaryLot) && !g.pendingKarama && !g.pendingTreacheryDiscard && !g.pendingNullentropy && (!g.auction || ordinaryLot) &&
(!g.richeseAuction || richeseCacheLot) && (!g.richeseAuction || richeseLot) &&
(!g.battle || g.phase === 6 && !!g.battle.event && !g.battle.revealed && !g.battle.preparation && (!g.battle || g.phase === 6 && !!g.battle.event && !g.battle.revealed && !g.battle.preparation &&
!g.pendingWinnerDiscards && !g.pendingCapture && !g.pendingTech && !g.pendingFaceDance && !g.pendingIxSubstitution) && !g.pendingWinnerDiscards && !g.pendingCapture && !g.pendingTech && !g.pendingFaceDance && !g.pendingIxSubstitution) &&
!g.pendingRevival && !g.pendingShipment && !g.pendingRevival && !g.pendingShipment &&
+1 -1
View File
@@ -52,7 +52,7 @@ export function phaseBidPromiseModeSupported(game: Parameters<typeof bidPromiseM
} }
export function phaseBidClaimText(claim: PhaseBidClaim): string { export function phaseBidClaimText(claim: PhaseBidClaim): string {
return `place a bid of at least ${claim.minimum} spice from now until this turn's Bidding phase closes`; return `place an ordinary auction bid of at least ${claim.minimum} spice from now until this turn's Bidding phase closes`;
} }
export function livePhaseBidPromises(promises: readonly PhaseBidPromise[], player: string, turn: number): PhaseBidPromise[] { export function livePhaseBidPromises(promises: readonly PhaseBidPromise[], player: string, turn: number): PhaseBidPromise[] {
@@ -0,0 +1,132 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { viewGame, type Action, type Game } from '../game/engine';
import { botActions } from '../game/bots';
import { DIFFICULTIES } from '../game/bot-profiles';
import { createTruthtranceRichesePromisesFixture, advanceTruthtranceRichesePromises as advance,
actTruthtranceRichesePromises as act, truthtranceRichesePromisesInventory as inventory } from './fixture-truthtrance-richese-promises';
import { truthOrderFrame as frame, playSaphoTruthOrder as play,
finishTruthOrder as finish, finishOriginalTruthQuestions as answer, rejectSaphoTruthOrder as reject } from './fixture-sapho-truth-order';
const player = (game: Game, id: string) => { const p = game.players.find(row => row.id === id); assert.ok(p); return p; };
type Method = 'normal' | 'onceAround' | 'silent';
/** Genuine Advanced R/A/E setup and live Black Market. Controlled conserved
* supplements swap original cached Sapho for Emperor's held card and move an
* undealt physical Truth to Emperor; the actual starting Truth stays Atreides'. */
function fixture(method: Method) {
const source = createTruthtranceRichesePromisesFixture({advanced:true});
let game = structuredClone(source.game);
const emperor = player(game,'emperor'), atreides = player(game,'atreides');
const cache = game.richeseCache!;
const at = cache.findIndex(card => card.effect === 'juiceOfSapho'); assert.ok(at >= 0);
const [sapho] = cache.splice(at,1), [swap] = emperor.hand.splice(0,1);
emperor.hand.push(sapho); cache.push(swap);
const truthAt = game.deck.findIndex(card => card.effect === 'truthtrance'); assert.ok(truthAt >= 0);
const [truth] = game.deck.splice(truthAt,1); emperor.hand.push(truth);
const otherTruth = atreides.hand.find(card => card.effect === 'truthtrance'); assert.ok(otherTruth);
assert.deepEqual(inventory(game),source.originalCards);
game = advance(game,state => state.decision?.kind === 'richeseBlackMarket');
const offered = player(game,'richese').hand.find(card => card.name === 'Shield'); assert.ok(offered);
game = act(game,'richese',{type:'decision',event:game.richeseBidding!.event,card:offered.id,method,
...(method === 'onceAround' ? {direction:'clockwise'} : {})});
for (let n=0; game.response && n<20; n++) {
const actor = game.players.find(row => !game.response!.passed.includes(row.id)); assert.ok(actor);
game = act(game,actor.id,{type:'passResponse'});
}
const lot = game.richeseAuction; assert.ok(lot && lot.source === 'blackMarket' && lot.method === method);
const bidder = method === 'silent' ? 'richese' : lot.active; assert.ok(bidder);
game = act(game,bidder,{type:'richeseBid',event:lot.event,amount:1,allyPayment:0});
assert.ok(game.richeseAuction && !game.richeseAuction.outcome);
const parent = structuredClone({turn:game.turn,phase:game.phase,active:game.active,order:game.order,
lot:game.richeseAuction,round:game.richeseBidding,funding:game.richeseFunding,aid:game.aid,
offered:game.richeseOfferedCard,sellerHand:player(game,'richese').hand});
for (const [actor,card] of [['emperor',truth.id],['atreides',otherTruth.id]] as const)
game = act(game,actor,{type:'card',card});
while (game.truthtrance?.stage === 'priority') {
const actor = game.players.find(row => !game.truthtrance!.passed.includes(row.id)); assert.ok(actor);
game = act(game,actor.id,{type:'truthPass'});
}
const current = frame(game);
const mode: 'first' | 'last' = game.truthtrance!.queue[0].player === 'emperor' ? 'last' : 'first';
return {game,lot:lot.event,offered:offered.id,card:sapho.id,bidder,mode,parent,original:source.originalCards,current};
}
function assertParent(game: Game, f: ReturnType<typeof fixture>) {
assert.deepEqual({turn:game.turn,phase:game.phase,active:game.active,order:game.order,
lot:game.richeseAuction,round:game.richeseBidding,funding:game.richeseFunding,aid:game.aid,
offered:game.richeseOfferedCard,sellerHand:player(game,'richese').hand},f.parent);
assert.ok(player(game,'richese').hand.some(card => card.id === f.offered));
}
function assertSilent(game: Game, bidder: string) {
const ownerView = viewGame(game,bidder).richeseAuction!, otherView = viewGame(game,'emperor').richeseAuction!;
assert.equal(ownerView.ownBid,1); assert.equal(otherView.ownBid,null);
assert.equal(otherView.revealedBids,null); assert.equal('sealed' in otherView,false);
}
for (const method of ['normal','onceAround','silent'] as const) void test(
`Advanced ${method} Black Market retains its original lot when Sapho orders real Truth questions`, () => {
const f = fixture(method), before = structuredClone(f.game);
assertParent(f.game,f);
if (method === 'silent') assertSilent(f.game,f.bidder);
const offered = viewGame(f.game,'emperor').saphoTruthOrderChoices;
assert.ok(offered.some(row => row.card === f.card && row.mode === f.mode));
reject(f.game,'emperor',{type:'saphoTruthOrder',card:f.card,event:'stale',revision:f.current.revision,mode:f.mode});
reject(f.game,'emperor',{type:'saphoTruthOrder',card:f.card,event:f.current.event,revision:f.current.revision+1,mode:f.mode});
for (const difficulty of DIFFICULTIES) {
const view = viewGame(before,'emperor'); view.players.find(row => row.id === 'emperor')!.bot = difficulty;
const action = botActions(view)[0]; assert.ok(action,difficulty);
assert.ok(action.type === 'truthOrderPass' || action.type === 'saphoTruthOrder');
assert.doesNotThrow(() => act(before,'emperor',action));
}
let game = play(f.game,'emperor',f.card,f.mode);
assertParent(game,f);
if (method === 'silent') assertSilent(game,f.bidder);
game = finish(game);
assert.equal(f.mode === 'first' ? game.truthtrance!.queue[0].player : game.truthtrance!.queue.at(-1)!.player,'emperor');
game = answer(game); assert.equal(game.truthtrance,null); assertParent(game,f);
assert.deepEqual(inventory(game),f.original);
if (method === 'silent') assertSilent(game,f.bidder);
const lot = game.richeseAuction!;
const next = method === 'silent' ? lot.eligible.find(id => !Object.hasOwn(lot.sealed,id)) : lot.active;
assert.ok(next);
const action: Action = {type:'richeseBid',event:f.lot,amount:method === 'silent' ? 0 : null,allyPayment:0};
game = act(game,next,action);
assert.deepEqual(inventory(game),f.original);
});
void test('a Black Market seller cannot spend their offered Sapho to reorder their own queued Truth', () => {
const source = createTruthtranceRichesePromisesFixture({advanced:true});
let game = structuredClone(source.game);
const seller = player(game,'richese'), cache = game.richeseCache!;
const at = cache.findIndex(card => card.effect === 'juiceOfSapho'); assert.ok(at >= 0);
const [sapho] = cache.splice(at,1), [swap] = seller.hand.splice(0,1);
seller.hand.push(sapho); cache.push(swap);
const truthAt = game.deck.findIndex(card => card.effect === 'truthtrance'); assert.ok(truthAt >= 0);
const [sellerTruth] = game.deck.splice(truthAt,1); seller.hand.push(sellerTruth);
const otherTruth = player(game,'atreides').hand.find(card => card.effect === 'truthtrance'); assert.ok(otherTruth);
assert.deepEqual(inventory(game),source.originalCards);
game = advance(game,state => state.decision?.kind === 'richeseBlackMarket');
game = act(game,'richese',{type:'decision',event:game.richeseBidding!.event,card:sapho.id,method:'silent'});
for (let n=0; game.response && n<20; n++) {
const actor = game.players.find(row => !game.response!.passed.includes(row.id)); assert.ok(actor);
game = act(game,actor.id,{type:'passResponse'});
}
const lot = game.richeseAuction; assert.ok(lot && lot.cardId === sapho.id);
game = act(game,'emperor',{type:'richeseBid',event:lot.event,amount:1,allyPayment:0});
for (const [actor,card] of [['richese',sellerTruth.id],['atreides',otherTruth.id]] as const)
game = act(game,actor,{type:'card',card});
while (game.truthtrance?.stage === 'priority') {
const actor = game.players.find(row => !game.truthtrance!.passed.includes(row.id)); assert.ok(actor);
game = act(game,actor.id,{type:'truthPass'});
}
const order = frame(game);
assert.ok(order.holders.includes('richese'));
assert.deepEqual(viewGame(game,'richese').saphoTruthOrderChoices,[]);
for (const mode of ['first','last'] as const)
reject(game,'richese',{type:'saphoTruthOrder',card:sapho.id,event:order.event,revision:order.revision,mode});
assert.ok(player(game,'richese').hand.some(card => card.id === sapho.id));
assert.equal(game.richeseAuction?.cardId,sapho.id);
game = finish(game); game = answer(game);
assert.ok(player(game,'richese').hand.some(card => card.id === sapho.id));
assert.equal(game.richeseAuction?.cardId,sapho.id);
assert.deepEqual(inventory(game),source.originalCards);
});
@@ -0,0 +1,151 @@
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 {
actTruthtranceRichesePromises as act,
advanceTruthtranceRichesePromises as advance,
createTruthtranceRichesePromisesFixture,
passTruthRicheseFreshDiscard,
truthtranceRichesePromisesInventory as inventory,
truthtranceRichesePromisesPlayer as player,
} from './fixture-truthtrance-richese-promises';
type Method = 'onceAround' | 'silent';
type QuestionKind = 'richeseBid' | 'mixedRicheseBid';
/** Original Advanced R/A/E setup, starting deal and Charity. Only the
* fixture's disclosed unopened deal/Spice order and scalar rolls are staged;
* Richese offers the physical Shield actually dealt into its own hand. */
function fixture(method: Method) {
const source = createTruthtranceRichesePromisesFixture({advanced:true});
let game = advance(structuredClone(source.earlySource), state => state.decision?.kind === 'richeseBlackMarket');
const card = source.targetCard, event = game.richeseBidding!.event;
assert.ok(player(game,source.richese).hand.some(held => held.id === card));
game = act(game,source.richese,{type:'decision',event,card,method,
...(method === 'onceAround' ? {direction:'clockwise'} : {})});
while (game.response) {
const seat = game.players.find(row => !game.response!.passed.includes(row.id)); assert.ok(seat);
game = act(game,seat.id,{type:'passResponse'});
}
assert.equal(game.richeseAuction?.source,'blackMarket');
assert.equal(game.richeseAuction?.method,method);
assert.equal(viewGame(game,source.richese).richeseAuction?.card?.id,card);
assert.equal(viewGame(game,source.asker).richeseAuction?.card?.id,game.richesePeekKnown ? card : undefined);
assert.equal(viewGame(game,source.emperor).richeseAuction?.card,null);
assert.ok(player(game,source.asker).hand.some(held => held.id === source.truth));
assert.deepEqual(inventory(game),source.originalCards);
return {game,asker:source.asker,target:source.emperor,owner:source.richese,
truth:source.truth,card,lot:game.richeseAuction!.event,originalCards:source.originalCards};
}
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:ReturnType<typeof fixture>,kind:QuestionKind) {
let game=act(f.game,f.asker,{type:'card',card:f.truth});
while (game.truthtrance?.stage === 'priority') {
const seat=game.players.find(row => !game.truthtrance!.passed.includes(row.id)); assert.ok(seat);
game=act(game,seat.id,{type:'truthPass'});
}
assert.equal(game.truthtrance?.stage,'ask');
const question = kind === 'richeseBid'
? {kind,target:f.target,turn:game.turn,event:f.lot,minimum:4}
: {kind,target:f.target,turn:game.turn,event:f.lot,mixed:{kind:'and',terms:[
{kind:'fact',fact:{kind:'spice',compare:'gte',value:10}},
{kind:'action',action:{minimum:4}},
]}};
return act(game,f.asker,{type:'truthAsk',question});
}
for (const method of ['onceAround','silent'] as const)
for (const kind of ['richeseBid','mixedRicheseBid'] as const)
for (const answer of ['yes','no'] as const) void test(
`Advanced ${method} Black Market ${kind} ${answer} retains the original sale`,() => {
const f=fixture(method), asked=ask(f,kind);
assert.equal(viewGame(asked,f.asker).richeseAuction?.card?.id,asked.richesePeekKnown ? f.card : undefined);
assert.equal(viewGame(asked,f.target).richeseAuction?.card,null);
assert.equal(viewGame(asked,f.owner).richeseAuction?.card?.id,f.card);
const answerView=viewGame(asked,f.target);
const answers=kind === 'richeseBid' ? answerView.truthRicheseBidAnswers : answerView.truthMixedRicheseBidAnswers;
assert.ok(answers?.includes(answer));
assert.equal(player(asked,f.target).spice,10);
for (const difficulty of DIFFICULTIES) {
const botView=viewGame(asked,f.target); botView.players.find(row => row.id === f.target)!.bot=difficulty;
const choice=botActions(botView)[0]; assert.equal(choice?.type,'truthAnswer',difficulty);
assert.ok(answers?.includes(choice.answer as 'yes'|'no'|'unknown'));
}
let game=passTruthRicheseFreshDiscard(act(asked,f.target,{type:'truthAnswer',answer}));
assert.equal(game.richeseAuction?.event,f.lot);
assert.ok(player(game,f.owner).hand.some(held => held.id === f.card));
if (method === 'onceAround') {
while (game.richeseAuction?.event === f.lot && game.richeseAuction.active !== f.target) {
const actor=game.richeseAuction.active; assert.ok(actor); assert.notEqual(actor,f.owner);
game=act(game,actor,{type:'richeseBid',event:f.lot,amount:null});
}
}
const guide=viewGame(game,f.target).richeseBidPromiseGuide; assert.ok(guide);
reject(game,f.target,{...guide.action,richeseBidPromiseId:'stale-promise'});
reject(game,f.target,{type:'richeseBid',event:f.lot,amount:answer === 'yes' ? 3 : 4,allyPayment:0});
const amount=answer === 'yes' ? 4 : 2;
const beforeBuyer=player(game,f.target).spice, beforeSeller=player(game,f.owner).spice;
game=act(game,f.target,{type:'richeseBid',event:f.lot,amount,allyPayment:0});
assert.equal(player(game,f.target).spice,beforeBuyer,'Declaring does not pay the winning invoice');
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);
assert.ok(player(game,f.owner).hand.some(held => held.id === f.card));
for (const id of [f.asker,f.owner])
game=act(game,id,{type:'richeseBid',event:f.lot,amount:0,allyPayment:0});
} else {
while (game.richeseAuction?.event === f.lot && !game.richeseAuction.outcome) {
const actor=game.richeseAuction.active; assert.ok(actor);
game=act(game,actor,{type:'richeseBid',event:f.lot,amount:null});
}
}
assert.ok(player(game,f.target).hand.some(held => held.id === f.card));
assert.ok(!player(game,f.owner).hand.some(held => held.id === f.card));
assert.equal(player(game,f.target).spice,beforeBuyer-amount);
assert.equal(player(game,f.owner).spice,beforeSeller+amount);
assert.equal(game.discard.filter(held => held.id === f.truth).length,1);
assert.deepEqual(inventory(game),f.originalCards);
});
for (const method of ['onceAround','silent'] as const) void test(
`Advanced ${method} seller honors a Truthtrance Yes and retains its physical Black Market card`,() => {
const original=fixture(method);
let game=original.game;
if (method === 'onceAround') {
const first=game.richeseAuction!.active; assert.ok(first); assert.notEqual(first,original.owner);
game=act(game,first,{type:'richeseBid',event:original.lot,amount:1,allyPayment:0});
}
const f={...original,game,target:original.owner};
const asked=ask(f,'richeseBid');
assert.ok(viewGame(asked,f.target).truthRicheseBidAnswers?.includes('yes'));
game=passTruthRicheseFreshDiscard(act(asked,f.target,{type:'truthAnswer',answer:'yes'}));
const beforeHand=player(game,f.owner).hand.map(card => card.id);
const beforeSeller=player(game,f.owner).spice, beforeEmperor=player(game,original.target).spice;
if (method === 'onceAround') {
while (game.richeseAuction?.event === f.lot && game.richeseAuction.active !== f.owner) {
const actor=game.richeseAuction.active; assert.ok(actor);
game=act(game,actor,{type:'richeseBid',event:f.lot,amount:null});
}
}
const guide=viewGame(game,f.owner).richeseBidPromiseGuide; assert.ok(guide);
assert.equal(guide.action.amount,4);
game=act(game,f.owner,guide.action);
if (method === 'silent') {
assert.equal(viewGame(game,f.asker).richeseAuction?.ownBid,null);
assert.equal(viewGame(game,f.asker).richeseAuction?.revealedBids,null);
assert.deepEqual(player(game,f.owner).hand.map(card => card.id),beforeHand);
for (const actor of [f.asker,original.target])
game=act(game,actor,{type:'richeseBid',event:f.lot,amount:0,allyPayment:0});
}
assert.deepEqual(player(game,f.owner).hand.map(card => card.id),beforeHand);
assert.equal(player(game,f.owner).spice,beforeSeller-4);
assert.equal(player(game,original.target).spice,beforeEmperor+4);
assert.equal(game.richeseBidding?.blackMarketSold,true);
assert.deepEqual(inventory(game),f.originalCards);
});
+4 -1
View File
@@ -39,6 +39,8 @@ void test('phase bid editor preserves the current turn and accepts only whole po
const props = { value, onChange(next: PhaseBidClaim) { changes.push(next); } }; const props = { value, onChange(next: PhaseBidClaim) { changes.push(next); } };
const html = renderToStaticMarkup(createElement(PhaseBidClaimFields, props)); const html = renderToStaticMarkup(createElement(PhaseBidClaimFields, props));
assert.match(html, /Turn 2/); assert.match(html, /Turn 2/);
assert.match(html, /ordinary auction bid/);
assert.match(html, /Richese cache and Black Market bids do not count/);
assert.match(html, /before Bidding ends this turn/); assert.match(html, /before Bidding ends this turn/);
assert.match(html, /Earlier bids do not count/); assert.match(html, /Earlier bids do not count/);
for (const minimum of [1, 7, Number.MAX_SAFE_INTEGER]) edit(props, minimum); for (const minimum of [1, 7, Number.MAX_SAFE_INTEGER]) edit(props, minimum);
@@ -62,7 +64,8 @@ void test('phase promises remain visible and do not expose another player’s pr
const before = structuredClone(game); const before = structuredClone(game);
const html = renderToStaticMarkup(createElement(PhaseBidPromises, { game, busy: false, send() {} })); const html = renderToStaticMarkup(createElement(PhaseBidPromises, { game, busy: false, send() {} }));
assert.match(html, /Your Bidding phase promises/); assert.match(html, /Your Bidding phase promises/);
assert.match(html, /No forbids qualifying bids through Bidding close/); assert.match(html, /No forbids qualifying ordinary bids through Bidding close/);
assert.match(html, /Richese cache and Black Market bids do not count/);
assert.match(html, /Fulfilled: this commitment is complete/); assert.match(html, /Fulfilled: this commitment is complete/);
assert.match(html, /Released: this commitment is no longer possible/); assert.match(html, /Released: this commitment is no longer possible/);
assert.match(html, /Your next bid opportunity is still ahead/); assert.match(html, /Your next bid opportunity is still ahead/);
@@ -40,8 +40,8 @@ for (const advanced of [false, true]) void test(
const asker = viewGame(b.declared.game, f.asker); const asker = viewGame(b.declared.game, f.asker);
assert.ok(asker.truthPhaseBidTargets.includes(f.target)); assert.ok(asker.truthPhaseBidTargets.includes(f.target));
const authored = truth(asker); const authored = truth(asker);
assert.match(authored, /<option value="phaseBid">Bind a bid this Bidding phase<\/option>/); assert.match(authored, /<option value="phaseBid">Bind an ordinary bid this Bidding phase<\/option>/);
assert.match(table(asker), /Bind a bid this Bidding phase/); assert.match(table(asker), /Bind an ordinary bid this Bidding phase/);
// Server rendering does not operate the stateful question selector; the // Server rendering does not operate the stateful question selector; the
// fixture's actual native question is submitted by its engine action. // fixture's actual native question is submitted by its engine action.
const respondent = viewGame(b.asked, f.target); const respondent = viewGame(b.asked, f.target);
+1
View File
@@ -26,6 +26,7 @@ void test('phase bid claim is one positive safe turn and threshold, with no lot
const claim = parsePhaseBidClaim({ turn: 2, minimum: 6 }); const claim = parsePhaseBidClaim({ turn: 2, minimum: 6 });
assert.deepEqual(claim, { turn: 2, minimum: 6 }); assert.deepEqual(claim, { turn: 2, minimum: 6 });
assert.match(phaseBidClaimText(claim), /bid of at least 6 spice/); assert.match(phaseBidClaimText(claim), /bid of at least 6 spice/);
assert.match(phaseBidClaimText(claim), /ordinary auction bid/);
assert.match(phaseBidClaimText(claim), /Bidding phase closes/); assert.match(phaseBidClaimText(claim), /Bidding phase closes/);
for (const field of ['turn', 'minimum'] as const) for (const field of ['turn', 'minimum'] as const)
for (const value of [0, -1, 1.5, NaN, Infinity, Number.MAX_SAFE_INTEGER + 1, '6', null, undefined]) for (const value of [0, -1, 1.5, NaN, Infinity, Number.MAX_SAFE_INTEGER + 1, '6', null, undefined])