Combine Basic bid and revival commitments
Verify and publish checkpoint container / container (push) Successful in 10m53s
Verify and publish checkpoint container / container (push) Successful in 10m53s
This commit is contained in:
1 parent
ecc4eb658a
commit
c3e13a2525
4 files changed
+168
-1
No files matched your search
+32
-1
@@ -18449,13 +18449,44 @@ function phaseBidFuturePlannerUnsupported(g: Game, p: Player): boolean {
|
||||
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[],
|
||||
witness: PhaseBidOpportunity): PhaseBidOpportunity | null {
|
||||
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) ||
|
||||
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);
|
||||
if (!range || uncommittedSpice(g,p) < range.minimum) return null;
|
||||
const source = structuredClone(g);
|
||||
source.truthtrance = null;
|
||||
source.phaseBidPromises = (source.phaseBidPromises ?? []).filter(row => row.player !== 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};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function viablePhaseBidWitnesses(g: Game, p: Player, promises: readonly PhaseBidPromise[]) {
|
||||
const lot = bidOpportunity(g);
|
||||
const live = livePhaseBidPromises(promises,p.id,g.turn);
|
||||
const otherCommitments = phaseBidFuturePlannerUnsupported(g,p);
|
||||
return phaseBidWitnesses(g,p).flatMap(witness => {
|
||||
if (witness.kind === 'future') {
|
||||
if (otherCommitments) return [];
|
||||
if (otherCommitments) {
|
||||
const joint = phaseBidRevivalWitness(g,p,promises,witness);
|
||||
return joint ? [joint] : [];
|
||||
}
|
||||
if (hasBribePromises(g,p.id,true)) {
|
||||
// Quote only currently funded payments; no future income is invented.
|
||||
// Current-lot combined forecasts remain unsupported.
|
||||
|
||||
Reference in new issue
Block a user