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
@@ -17,6 +17,14 @@ open mode gates.
|
||||
|
||||
## Current checkpoint and work
|
||||
|
||||
**Basic phase-bid and force Revival Truthtrance commitments — 16 November.
|
||||
Prototyped / Partial.** Both answer orders now use a shared owned-spice witness
|
||||
before Bidding; affordable commitments continue through actual bidding and
|
||||
paid Revival, and the same spice cannot be voluntarily spent twice. Fifteen
|
||||
related files pass 139 cases, and type checking and lint pass. Advanced, other
|
||||
factions and commitments, later lots, complete games and deployed acceptance
|
||||
remain open. [Scope](TRUTHTRANCE_BID_PROMISES.md#basic-phase-wide-bid-with-force-revival--16-november-2026).
|
||||
|
||||
**Basic independent Ecaz cards with Nexus and Kull — 16 November. Prototyped /
|
||||
Partial.** Explicitly selected cards survive public setup; Nexus Kull may spend
|
||||
each physical Ecaz card, and Richese can claim or pass it with Semuta. Recruits
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# Truthtrance ordinary bid commitments
|
||||
|
||||
## Basic phase-wide bid with force Revival — 16 November 2026
|
||||
|
||||
**Prototyped / Partial.** In a Basic classic-faction game before Bidding,
|
||||
players may now commit to both a phase-wide ordinary bid and ordinary force
|
||||
Revival when a shared native witness can fund them, in either answer order.
|
||||
The forecast checks the existing eligible physical lot and hand capacity,
|
||||
reserves one concrete qualifying bid from the player's current uncommitted
|
||||
spice, and quotes the actual later Revival against the remaining purse. It
|
||||
assumes no Charity, allied funds, Karama payment or future income. A positive
|
||||
answer is only offered for a checked amount; the same spice cannot fund both
|
||||
commitments. Native bid and Revival actions still fulfill their own records.
|
||||
|
||||
The joint witness is deliberately limited to classic Basic, pre-Bidding and
|
||||
ordinary force Revival without other live transport, leader, expression,
|
||||
bribe, Charity or whole-turn commitments. A missing witness is not exhaustive
|
||||
proof of impossibility; the existing external-change policy remains. The FAQ's
|
||||
general current-turn question guidance supports the underlying commitment,
|
||||
but this forecast is a provisional online policy, not a printed procedure.
|
||||
|
||||
[Public-game regressions](../tests/truth-phase-bid-revival-joint.test.ts)
|
||||
cover both answer orders, exact affordability and one-spice conflict, a real
|
||||
voluntary payment rejection, the existing external-debit policy, actual bid and
|
||||
paid Revival. They stage conserved Tanks and unopened Spice order. Advanced,
|
||||
other factions/commitments, later lots, full games and deployed acceptance
|
||||
remain open.
|
||||
|
||||
## Basic phase-wide bids through Ixian and Richese preparation — 28 October 2026
|
||||
|
||||
**Prototyped / Partial.** A pre-Bidding `{kind:'phaseBid'}` answer can now
|
||||
|
||||
+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.
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { normalizeAutomaticGame, viewGame, type Game } from '../game/engine';
|
||||
import { forceRevivalQuote } from '../game/revival';
|
||||
import { actTruthBid as act, advanceTruthBid as advance, truthBidClean as clean,
|
||||
truthBidInventory as inventory, truthBidPlayer as player } from './fixture-truth-bid';
|
||||
import { advanceTruthRevival, truthRevivalClean } from './fixture-truth-revival';
|
||||
import { createTruthTurnBidFixture } from './fixture-truth-turn-bid';
|
||||
|
||||
/** Public Harkonnen/Atreides/Emperor setup, with its real starting deal and
|
||||
* Charity phase. Three existing Emperor reserve counters are moved to Tanks;
|
||||
* the unopened Spice order is staged, without adding money or cards. */
|
||||
function fixture() {
|
||||
const f = createTruthTurnBidFixture();
|
||||
let game = structuredClone(f.afterSetup);
|
||||
for (const {position, from, card} of f.spiceOrder) {
|
||||
const [selected] = game.spiceDeck.splice(from, 1);
|
||||
assert.deepEqual(selected, card);
|
||||
game.spiceDeck.splice(position, 0, selected);
|
||||
}
|
||||
game = advance(game, state => state.turn === 1 && state.phase === 2 && clean(state));
|
||||
const emperor = player(game, f.target);
|
||||
assert.equal(emperor.spice, 10);
|
||||
assert.ok(emperor.reserves >= 3);
|
||||
emperor.reserves -= 3;
|
||||
emperor.tanks += 3;
|
||||
assert.deepEqual(inventory(game), f.originalCards);
|
||||
return {f, game};
|
||||
}
|
||||
|
||||
function ask(game: Game, asker: string, card: string, question: object): Game {
|
||||
game = act(game, asker, {type:'card', card});
|
||||
for (let count = 0; game.truthtrance?.stage === 'priority' && count < game.players.length; count++) {
|
||||
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');
|
||||
return act(game, asker, {type:'truthAsk', question});
|
||||
}
|
||||
|
||||
for (const first of ['bid', 'revival'] as const) for (const affordable of [true, false]) {
|
||||
void test(`Basic phase bid and paid Revival in ${first}-first order ${affordable ? 'share enough spice' : 'cannot overcommit spice'}`, () => {
|
||||
const {f, game: initial} = fixture();
|
||||
const bid = {kind:'phaseBid', target:f.target, turn:initial.turn, minimum:affordable ? 6 : 7};
|
||||
const revival = {kind:'revival', target:f.target, turn:initial.turn, counter:'total', minimum:3};
|
||||
const questions = first === 'bid' ? [bid, revival] : [revival, bid];
|
||||
let game = ask(initial, f.asker, f.truths[0], questions[0]);
|
||||
const firstAnswers = first === 'bid' ? viewGame(game, f.target).truthPhaseBidAnswers : viewGame(game, f.target).truthRevivalAnswers;
|
||||
assert.ok(firstAnswers?.includes('yes'), 'Each single obligation is feasible by itself');
|
||||
game = act(game, f.target, {type:'truthAnswer', answer:'yes'});
|
||||
game = ask(game, f.asker, f.truths[1], questions[1]);
|
||||
const secondAnswers = first === 'bid' ? viewGame(game, f.target).truthRevivalAnswers : viewGame(game, f.target).truthPhaseBidAnswers;
|
||||
assert.ok(secondAnswers?.includes('no'));
|
||||
assert.equal(secondAnswers?.includes('yes'), affordable, 'The same spice cannot be reserved twice');
|
||||
if (!affordable) {
|
||||
const before = structuredClone(game);
|
||||
assert.throws(() => act(game, f.target, {type:'truthAnswer', answer:'yes'}));
|
||||
assert.deepEqual(game, before);
|
||||
return;
|
||||
}
|
||||
game = act(game, f.target, {type:'truthAnswer', answer:'yes'});
|
||||
assert.equal(game.truthtrance, null);
|
||||
// A voluntary public payment cannot spend spice needed by the two Yes
|
||||
// answers. The rejected action must leave both original records intact.
|
||||
const withoutPromises = structuredClone(game);
|
||||
withoutPromises.phaseBidPromises = [];
|
||||
withoutPromises.revivalPromises = [];
|
||||
assert.doesNotThrow(() => act(withoutPromises, f.target, {type:'bribe', target:f.asker, amount:1}));
|
||||
const beforeSpend = structuredClone(game);
|
||||
assert.throws(() => act(game, f.target, {type:'bribe', target:f.asker, amount:1}));
|
||||
assert.deepEqual(game, beforeSpend);
|
||||
|
||||
// Simulate an external debit by transferring one existing spice; this is
|
||||
// not a player-authorized spending action or evidence of a native debit
|
||||
// route. Preserve the existing unknown-future policy: an incomplete
|
||||
// planner alone cannot declare the phase bid released.
|
||||
const externallyChanged = structuredClone(game);
|
||||
player(externallyChanged, f.target).spice -= 1;
|
||||
player(externallyChanged, f.asker).spice += 1;
|
||||
const settled = normalizeAutomaticGame(externallyChanged);
|
||||
const pendingBid = settled.phaseBidPromises?.find(row => row.player === f.target && row.minimum === 6);
|
||||
assert.ok(pendingBid);
|
||||
assert.equal(pendingBid.released ?? false, false);
|
||||
assert.equal(pendingBid.fulfilled ?? false, false);
|
||||
assert.equal(player(settled, f.target).spice, 9);
|
||||
assert.deepEqual(inventory(settled), f.originalCards);
|
||||
|
||||
game = advance(game, state => clean(state) && state.phase === 3 && state.auction?.active === f.target);
|
||||
game = act(game, f.target, {type:'bid', amount:6, allyPayment:0});
|
||||
assert.ok(game.phaseBidPromises?.some(row => row.player === f.target && row.fulfilled));
|
||||
game = advance(game, state => clean(state) && state.phase === 4);
|
||||
assert.equal(player(game, f.target).spice, 4, 'The real winning invoice consumed six');
|
||||
const quote = forceRevivalQuote(game, player(game, f.target), 3);
|
||||
assert.equal(quote.free, 1); assert.equal(quote.cost, 4);
|
||||
game = act(game, f.target, {type:'revive', amount:3, elite:0});
|
||||
game = advanceTruthRevival(game, truthRevivalClean);
|
||||
assert.equal(player(game, f.target).spice, 0);
|
||||
assert.equal(player(game, f.target).tanks, 0);
|
||||
assert.ok(game.revivalPromises?.some(row => row.player === f.target && row.fulfilled));
|
||||
assert.deepEqual(inventory(game), f.originalCards);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user