Compose Basic bid revival and shipment commitments
Verify and publish checkpoint container / container (push) Successful in 10m33s

This commit is contained in:
Quintine committed 2026-11-16 14:05:28 +11:00
1 parent c3e13a2525
commit 9536c77062
7 files changed
+328 -15

No files matched your search

+33 -14
View File
@@ -18442,24 +18442,27 @@ function phaseBidHonorsTurnActions(g: Game, p: Player, lot: BidOpportunity, acti
* promises awaits their combined planner; do not invent those resources. */
function phaseBidFuturePlannerUnsupported(g: Game, p: Player): boolean {
return liveEarlyRicheseBidPromises(g.earlyRicheseBidPromises ?? [],p.id,g.turn).some(row => row.answer) ||
liveShipmentPromises(g.shipmentPromises ?? [],p.id,g.turn).some(row => row.answer) ||
liveShipmentPromises(g.shipmentPromises ?? [],p.id,g.turn).some(row => matchesShipment(row,null) !== row.answer) ||
hasMovementPromises(g,p.id,true) || liveRevivalPromises(g.revivalPromises ?? [],p.id,g.turn).some(row => row.answer) ||
liveLeaderRevivalPromises(g.leaderRevivalPromises ?? [],p.id,g.turn).some(row => row.answer) ||
liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [],p.id,g.turn).some(row => row.answer) ||
liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [],p.id,g.turn).length > 0 ||
liveTurnActionPromises(g.turnActionPromises ?? [],p.id,g.turn).length > 0 ||
(!!bidOpportunity(g) && hasBribePromises(g,p.id,true));
}
/** A conservative owned-cash witness for a future Basic bid followed by
* ordinary force Revival. Other joint obligations keep their own guards.
* The detached forecast does not assume Charity, income, an ally, or a
* Karama payment; failure to find this witness is not proof of impossibility. */
function phaseBidRevivalWitness(g: Game, p: Player, promises: readonly PhaseBidPromise[],
* native Revival and Shipment commitments. Other obligations keep their own
* guards. No pledged refund, Charity, income, ally or Karama is assumed;
* failure to find this witness is not proof of impossibility. */
function phaseBidRevivalShipmentWitness(g: Game, p: Player, promises: readonly PhaseBidPromise[],
witness: PhaseBidOpportunity): PhaseBidOpportunity | null {
const revivals = liveRevivalPromises(g.revivalPromises ?? [],p.id,g.turn);
const leaders = liveLeaderRevivalPromises(g.leaderRevivalPromises ?? [],p.id,g.turn);
const expressions = liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [],p.id,g.turn);
const shipments = liveShipmentPromises(g.shipmentPromises ?? [],p.id,g.turn);
if (g.advanced || g.expansions.length || g.phase >= 3 || g.auction ||
!liveRevivalPromises(g.revivalPromises ?? [],p.id,g.turn).some(row => row.answer) ||
liveLeaderRevivalPromises(g.leaderRevivalPromises ?? [],p.id,g.turn).length ||
liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [],p.id,g.turn).length ||
liveShipmentPromises(g.shipmentPromises ?? [],p.id,g.turn).length || hasMovementPromises(g,p.id) ||
(![...revivals,...leaders].some(row => row.answer) && !expressions.length &&
!shipments.some(row => matchesShipment(row,null) !== row.answer)) ||
hasMovementPromises(g,p.id) ||
liveEarlyRicheseBidPromises(g.earlyRicheseBidPromises ?? [],p.id,g.turn).length || hasBribePromises(g,p.id) ||
g.charityPromises?.some(row => row.player === p.id && row.turn === g.turn && !row.fulfilled && !row.released)) return null;
const range = phaseBidCompletionRange(promises,witness);
@@ -18467,13 +18470,28 @@ function phaseBidRevivalWitness(g: Game, p: Player, promises: readonly PhaseBidP
const source = structuredClone(g);
source.truthtrance = null;
source.phaseBidPromises = (source.phaseBidPromises ?? []).filter(row => row.player !== p.id);
// The donor's pledged spice can be spent by its ally; an unknown refund is
// not personal cash available for this witness. This changes only the probe.
delete source.aid[p.id];
for (const seed of earlyRevivalCompletionSeeds(structuredClone(source),source,p.id)) {
if (seed.early.length) continue;
const owner = getPlayer(seed.game,p.id);
if (owner.spice < range.minimum) continue;
owner.spice -= range.minimum;
if (currentRevivalPromiseCompletion(seed.game,owner,seed.game.revivalPromises ?? []))
return {...witness,minimum:range.minimum,maximum:range.minimum};
const completed = completeTurnActionRevivalSeed(seed,p.id);
if (!completed || currentRevivalPromiseCompletion(completed.game,getPlayer(completed.game,p.id),
completed.game.revivalPromises ?? [])?.type !== 'ready') continue;
if (shipments.some(row => matchesShipment(row,null) !== row.answer)) {
const future = completed.game;
future.phase = 5;
future.ready = [];
delete future.revivalOrder;
resetGroundMovementForecast(future,p.id);
future.active = p.id;
const shipment = findShipmentCompletion(future,getPlayer(future,p.id),shipments);
if (!shipment || shipment.early?.length || shipment.actions.some(action => action.type !== 'ship')) continue;
}
return {...witness,minimum:range.minimum,maximum:range.minimum};
}
return null;
}
@@ -18484,7 +18502,7 @@ function viablePhaseBidWitnesses(g: Game, p: Player, promises: readonly PhaseBid
return phaseBidWitnesses(g,p).flatMap(witness => {
if (witness.kind === 'future') {
if (otherCommitments) {
const joint = phaseBidRevivalWitness(g,p,promises,witness);
const joint = phaseBidRevivalShipmentWitness(g,p,promises,witness);
return joint ? [joint] : [];
}
if (hasBribePromises(g,p.id,true)) {
@@ -34256,7 +34274,8 @@ function earlyShipmentGuidance(g: Game, p: Player): { preparation: { actions: Ac
if (lot) return {preparation:null,policy:!lot.outcome && lot.eligible.includes(p.id) &&
(lot.method === 'silent' ? !Object.hasOwn(lot.sealed,p.id) : lot.active === p.id)
? [{type:'richeseBid',event:lot.event,amount:lot.method === 'silent' ? 0 : null,allyPayment:0}] : []};
return { preparation: null, policy: g.auction?.active === p.id ? [{ type: 'passBid' }] : [] };
const bidGuide = projectedPhaseBidGuide(g,p.id)?.action ?? projectedBidPromiseGuide(g,p.id)?.action;
return { preparation: null, policy: g.auction?.active === p.id ? [bidGuide ?? { type: 'passBid' }] : [] };
}
if (g.phase === 4 && nativeRevivalOrderBlock(g,p.id)) return {preparation:null,policy:[]};
if (g.phase === 2 && nativeCharityOrderBlock(g,p.id)) return {preparation:null,policy:[]};