Check Advanced victory after Mentat actions
Verify and publish checkpoint container / container (push) Successful in 10m42s
Verify and publish checkpoint container / container (push) Successful in 10m42s
This commit is contained in:
1 parent
c608d6fea6
commit
64706cc7e0
12 files changed
+339
-27
No files matched your search
@@ -48,9 +48,14 @@ function reachMentat(game: Game): Game {
|
||||
g = applyAction(g, g.decision.player, { type: 'decision', done: true });
|
||||
return g;
|
||||
}
|
||||
function finishMentat(game: Game): Game {
|
||||
let g = game;
|
||||
for (const p of g.players) g = applyAction(g, p.id, { type: 'ready' });
|
||||
return g;
|
||||
}
|
||||
function offer(game: Game): NonNullable<Game['victoryContinuation']> {
|
||||
const pending = game.victoryContinuation;
|
||||
assert.ok(pending, 'The original Collection and Mentat transition offers a public agreement');
|
||||
assert.ok(pending, 'The Mentat victory check offers a public agreement');
|
||||
return pending;
|
||||
}
|
||||
function act(game: Game, player: string, mode: 'finish' | 'continue' | 'accept', extra?: number): Game {
|
||||
@@ -72,10 +77,12 @@ function completeVotes(game: Game, extra: number): Game {
|
||||
}
|
||||
|
||||
void test('Advanced public simultaneous victory waits for each qualifying participant and rejects other actions', () => {
|
||||
const game = reachMentat(position());
|
||||
const opened = reachMentat(position());
|
||||
assert.equal(opened.phase, 8); assert.ok(!opened.victoryContinuation);
|
||||
const game = finishMentat(opened);
|
||||
assert.equal(game.phase, 8); assert.equal(game.status, 'playing'); assert.deepEqual(game.winner, []);
|
||||
const pending = offer(game);
|
||||
assert.equal(pending.resume, 'mentat');
|
||||
assert.equal(pending.resume, 'advance');
|
||||
assert.deepEqual(pending.sides, [['ix'], ['at', 'em']]);
|
||||
assert.deepEqual(pending.voters, ['ix', 'at', 'em']);
|
||||
assert.deepEqual(pending.accepted, []);
|
||||
@@ -91,7 +98,7 @@ void test('Advanced public simultaneous victory waits for each qualifying partic
|
||||
});
|
||||
|
||||
void test('declining the common proposal settles the original winners and correct private prediction', () => {
|
||||
const game = reachMentat(position({ prediction: true }));
|
||||
const game = finishMentat(reachMentat(position({ prediction: true })));
|
||||
const vote = offer(game);
|
||||
assert.deepEqual(game.winner, []);
|
||||
const publicIx = viewGame(game, 'ix').victoryContinuation;
|
||||
@@ -105,11 +112,11 @@ void test('declining the common proposal settles the original winners and correc
|
||||
assert.ok(!next.victoryContinuation);
|
||||
});
|
||||
|
||||
void test('unanimous continuation raises the ordinary solo and alliance targets without losing Mentat', () => {
|
||||
const original = reachMentat(position());
|
||||
void test('unanimous continuation raises targets and advances once after completed Mentat', () => {
|
||||
const original = finishMentat(reachMentat(position()));
|
||||
const beforeForces = original.players.map(player => ({ id: player.id, forces: player.forces, reserves: player.reserves }));
|
||||
const next = completeVotes(original, 2);
|
||||
assert.equal(next.status, 'playing'); assert.equal(next.phase, 8); assert.equal(next.turn, original.turn);
|
||||
assert.equal(next.status, 'playing'); assert.equal(next.phase, 0); assert.equal(next.turn, original.turn + 1);
|
||||
assert.deepEqual(next.winner, []); assert.ok(!next.victoryContinuation);
|
||||
assert.equal(next.victoryExtraStrongholds, 2);
|
||||
assert.deepEqual(next.players.map(player => ({ id: player.id, forces: player.forces, reserves: player.reserves })), beforeForces);
|
||||
@@ -117,15 +124,11 @@ void test('unanimous continuation raises the ordinary solo and alliance targets
|
||||
assert.equal(progress.find(row => row.player === 'ix')?.target, 5);
|
||||
assert.equal(progress.find(row => row.player === 'at')?.target, 6);
|
||||
assert.equal(progress.find(row => row.player === 'at')?.qualifies, false);
|
||||
let completed = next;
|
||||
for (const p of completed.players) completed = applyAction(completed, p.id, { type: 'ready' });
|
||||
assert.equal(completed.turn, original.turn + 1);
|
||||
assert.equal(completed.victoryExtraStrongholds, 2);
|
||||
});
|
||||
|
||||
void test('zero-increase agreement preserves ordinary targets for the next turn', () => {
|
||||
const next = completeVotes(reachMentat(position()), 0);
|
||||
assert.equal(next.status, 'playing'); assert.equal(next.phase, 8);
|
||||
const next = completeVotes(finishMentat(reachMentat(position())), 0);
|
||||
assert.equal(next.status, 'playing'); assert.equal(next.phase, 0);
|
||||
assert.equal(next.victoryExtraStrongholds ?? 0, 0);
|
||||
const progress = viewGame(next, 'ix').victoryProgress;
|
||||
assert.equal(progress.find(row => row.player === 'ix')?.target, 3);
|
||||
@@ -138,13 +141,28 @@ void test('Basic multiple qualifiers can agree while one qualifying side still w
|
||||
assert.ok(basic.victoryContinuation);
|
||||
const settled = act(basic, basic.victoryContinuation.voters[0], 'finish');
|
||||
assert.equal(settled.status, 'finished');
|
||||
const single = reachMentat(position({ onlyAlliance: true }));
|
||||
const single = finishMentat(reachMentat(position({ onlyAlliance: true })));
|
||||
assert.equal(single.status, 'finished'); assert.ok(single.winner.length > 0);
|
||||
assert.ok(!single.victoryContinuation);
|
||||
});
|
||||
|
||||
void test('a saved legacy Advanced agreement resumes its original Mentat opportunity', () => {
|
||||
// Stage the old opening-time receipt using the still-supported Basic path.
|
||||
// This controlled saved frame is not a historical-room recovery proof.
|
||||
const game = reachMentat(position({ advanced: false }));
|
||||
assert.equal(offer(game).resume, 'mentat');
|
||||
game.advanced = true;
|
||||
assert.equal(game.mentatVictoryAfterActions, undefined);
|
||||
const next = completeVotes(game, 1);
|
||||
assert.equal(next.status, 'playing'); assert.equal(next.phase, 8);
|
||||
assert.equal(next.turn, game.turn); assert.ok(!next.victoryContinuation);
|
||||
const advanced = finishMentat(next);
|
||||
assert.equal(advanced.turn, game.turn + 1);
|
||||
assert.equal(advanced.phase, 0);
|
||||
});
|
||||
|
||||
void test('all four minimal bot profiles produce a legal response for the public continuation', () => {
|
||||
const game = reachMentat(position());
|
||||
const game = finishMentat(reachMentat(position()));
|
||||
for (const level of DIFFICULTIES) {
|
||||
const view = viewGame(game, 'ix');
|
||||
view.players.find(player => player.id === 'ix')!.bot = level;
|
||||
|
||||
Reference in new issue
Block a user