@chrischall/warapp-mcp 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/analysis/arena.js +389 -0
- package/dist/analysis/plan/captures.js +35 -60
- package/dist/analysis/plan/dead-advance.js +77 -0
- package/dist/analysis/plan/deploy-estimates.js +38 -2
- package/dist/analysis/plan/estimates.js +15 -46
- package/dist/analysis/plan/fogged-break.js +86 -0
- package/dist/analysis/plan/guard-off.js +1 -2
- package/dist/analysis/plan/holds.js +28 -9
- package/dist/analysis/plan/orders.js +39 -2
- package/dist/analysis/plan/report.js +5 -11
- package/dist/analysis/plan/shared.js +18 -0
- package/dist/analysis/plan/siege.js +1 -49
- package/dist/analysis/plan/stand-still.js +3 -4
- package/dist/analysis/plan/state.js +1 -0
- package/dist/analysis/plan/stockpile.js +0 -16
- package/dist/analysis/plan/strike-stack.js +1 -6
- package/dist/analysis/plan/strike.js +10 -0
- package/dist/analysis/plan/targets.js +34 -31
- package/dist/analysis/plan/threats.js +26 -9
- package/dist/analysis/plan/withdraw.js +3 -3
- package/dist/analysis/planner.js +181 -48
- package/dist/bundle.js +800 -347
- package/dist/tools/check-plan.js +4 -1
- package/dist/tools/stress-opponents.js +1 -0
- package/dist/tools/turn.js +7 -4
- package/dist/version.js +1 -1
- package/manifest.json +1 -1
- package/package.json +3 -3
- package/server.json +2 -2
- package/dist/analysis/plan/horizon.js +0 -42
|
@@ -8,7 +8,7 @@ import { bonusTerritories } from '../bonuses.js';
|
|
|
8
8
|
import { neighborsOf } from '../graph.js';
|
|
9
9
|
import { twoStepReaches } from '../lookahead.js';
|
|
10
10
|
import { opensBehind } from '../opens.js';
|
|
11
|
-
import { BREACH_WEIGHT, CITE_CLOSE, CITE_OPEN, CITE_SEP, CONCEDE_FACTOR, MIN_ENEMY_DEPLOY, nearMissMargin, } from './shared.js';
|
|
11
|
+
import { BREACH_WEIGHT, HUB_WEIGHT, CITE_CLOSE, CITE_OPEN, CITE_SEP, CONCEDE_FACTOR, MIN_ENEMY_DEPLOY, nearMissMargin, } from './shared.js';
|
|
12
12
|
import { relaxedFor } from './relations.js';
|
|
13
13
|
import { byNum } from './util.js';
|
|
14
14
|
import { lateArrivals, reconsiderAndGarrison, withdrawals } from './withdraw.js';
|
|
@@ -141,7 +141,7 @@ export function holdBasics(pc, ps, book, threats) {
|
|
|
141
141
|
*/
|
|
142
142
|
export function soloLeaderHolds(pc, ps, book, threats, prev) {
|
|
143
143
|
const { g, ffaLeader, paybackTurns, label, bonusName, unitsAt, toTake, myCommanders } = pc;
|
|
144
|
-
const { valueOf, stakeAt, pools } = book;
|
|
144
|
+
const { valueOf, stakeAt, pools, hubWorthOf } = book;
|
|
145
145
|
const { borders, borderAt, safeAtStart } = threats;
|
|
146
146
|
const { uneconomic, stayAt } = prev;
|
|
147
147
|
if (!ffaLeader)
|
|
@@ -220,7 +220,8 @@ export function soloLeaderHolds(pc, ps, book, threats, prev) {
|
|
|
220
220
|
continue;
|
|
221
221
|
let joint = 0;
|
|
222
222
|
let single = 0;
|
|
223
|
-
|
|
223
|
+
// #593: a hub among its threatened members adds its share once.
|
|
224
|
+
let worth = bonus.value + hubWorthOf(bonus.id, members);
|
|
224
225
|
let recent = false;
|
|
225
226
|
const lowered = [];
|
|
226
227
|
for (const t of members) {
|
|
@@ -503,9 +504,9 @@ export function twoStepHolds(pc, ps, book, threats, hb, pass, prev) {
|
|
|
503
504
|
}
|
|
504
505
|
/** Rule 1a: judge each threatened border, hold it or concede it, and say why (rule 1k's commander included). */
|
|
505
506
|
export function holdOrConcede(pc, ps, book, threats, hb, prev) {
|
|
506
|
-
const { goal, paybackTurns, label, unitsAt, bombOn, toTake, myCommanders } = pc;
|
|
507
|
+
const { goal, paybackTurns, label, bonusName, unitsAt, bombOn, toTake, myCommanders } = pc;
|
|
507
508
|
const { warnings, rationale, locked } = ps;
|
|
508
|
-
const { deploy, valueOf, stakeAt, cutOff, breachAt, opensAt } = book;
|
|
509
|
+
const { deploy, valueOf, stakeAt, cutOff, breachAt, opensAt, hubsAt } = book;
|
|
509
510
|
const { borders, recentlyTakenFrom } = threats;
|
|
510
511
|
const { threatened, conceded } = hb;
|
|
511
512
|
const { stayAt } = prev;
|
|
@@ -519,6 +520,8 @@ export function holdOrConcede(pc, ps, book, threats, hb, prev) {
|
|
|
519
520
|
const breachNoted = new Set();
|
|
520
521
|
/** #291: the gates whose opened value is already named. */
|
|
521
522
|
const opensNoted = new Set();
|
|
523
|
+
/** #593: the hubs whose value is already named. */
|
|
524
|
+
const hubNoted = new Set();
|
|
522
525
|
/** Rule 1a's pre-deploy threat warning per border, restated once the deploys are known. */
|
|
523
526
|
const threatWarnings = new Map();
|
|
524
527
|
const assessThreats = () => {
|
|
@@ -564,6 +567,12 @@ export function holdOrConcede(pc, ps, book, threats, hb, prev) {
|
|
|
564
567
|
const more = opens.ids.length > MAX_CUT_NAMED ? ` and ${opens.ids.length - MAX_CUT_NAMED} more` : '';
|
|
565
568
|
rationale.push(`${label(b.id)} is the only way in to ${named}${more} (+${opens.income} income): losing it opens them to the enemy, so its value counts half of that (+${opens.worth}) (#291).`);
|
|
566
569
|
}
|
|
570
|
+
// #593: a hub of a held bonus says what its fall takes.
|
|
571
|
+
if (!hubNoted.has(b.id))
|
|
572
|
+
for (const h of hubsAt(b.id)) {
|
|
573
|
+
hubNoted.add(b.id);
|
|
574
|
+
rationale.push(`${label(b.id)} borders ${h.borders} of bonus ${bonusName(h.bonusId)}'s ${h.others} other members: its fall takes the rest, so its value counts ${HUB_WEIGHT * 100}% of the bonus more (+${h.worth}) (#593).`);
|
|
575
|
+
}
|
|
567
576
|
const from = recentlyTakenFrom(b.id);
|
|
568
577
|
threatened.push({
|
|
569
578
|
id: b.id,
|
|
@@ -635,7 +644,7 @@ export function holdOrConcede(pc, ps, book, threats, hb, prev) {
|
|
|
635
644
|
export function heldBonusUnits(pc, ps, book, threats, hb, prev) {
|
|
636
645
|
const { g, paybackTurns, label, bonusName, incomeAfter, toTake } = pc;
|
|
637
646
|
const { warnings, rationale, locked } = ps;
|
|
638
|
-
const { deploy, undeploy, pools, roomAt, stakeAt } = book;
|
|
647
|
+
const { deploy, undeploy, pools, roomAt, stakeAt, hubWorthOf, hubsAt } = book;
|
|
639
648
|
const local = pools !== null && pools.bonuses.length > 0;
|
|
640
649
|
const { expectedAt } = threats;
|
|
641
650
|
const { threatened, conceded, units } = hb;
|
|
@@ -670,7 +679,9 @@ export function heldBonusUnits(pc, ps, book, threats, hb, prev) {
|
|
|
670
679
|
// the unit's cost and its payback test. A hold rule 1k could not fully fund still counts.
|
|
671
680
|
const paying = members.filter((m) => !commanderHeld.has(m.id));
|
|
672
681
|
const cost = paying.reduce((n, m) => n + m.holdCost, 0);
|
|
673
|
-
|
|
682
|
+
// #593: a hub among the members it pays for adds HUB_WEIGHT × its value, once.
|
|
683
|
+
const hub = hubWorthOf(b.id, paying.map((m) => m.id));
|
|
684
|
+
const worth = b.value + hub + paying.reduce((n, m) => n + (m.have + stakeAt(m.id)) / paybackTurns, 0);
|
|
674
685
|
// It pays back within PAYBACK_TURNS, and (as rule 1a asks of every border) costs at
|
|
675
686
|
// most CONCEDE_FACTOR × its worth, unless a member was just taken from a weak opponent.
|
|
676
687
|
const recent = members.some((m) => m.recentFrom !== undefined);
|
|
@@ -690,6 +701,9 @@ export function heldBonusUnits(pc, ps, book, threats, hb, prev) {
|
|
|
690
701
|
conceded: false,
|
|
691
702
|
floored: false,
|
|
692
703
|
contested: false,
|
|
704
|
+
...(hub > 0 && !recent && net <= paybackTurns * b.value && net <= CONCEDE_FACTOR * worth && net > CONCEDE_FACTOR * (worth - hub)
|
|
705
|
+
? { hubOnly: true }
|
|
706
|
+
: {}),
|
|
693
707
|
});
|
|
694
708
|
}
|
|
695
709
|
};
|
|
@@ -697,7 +711,10 @@ export function heldBonusUnits(pc, ps, book, threats, hb, prev) {
|
|
|
697
711
|
const inLiveUnit = (id) => units.some((u) => !u.conceded && u.members.some((m) => m.id === id));
|
|
698
712
|
/** `t` judged on its own: its protected value less the bonuses of the units conceded with it. */
|
|
699
713
|
const residual = (t) => {
|
|
700
|
-
|
|
714
|
+
// #593: a conceded bonus takes its hub share with it.
|
|
715
|
+
const lost = units
|
|
716
|
+
.filter((u) => u.conceded && u.members.some((m) => m.id === t.id))
|
|
717
|
+
.reduce((n, u) => n + u.value + (hubsAt(t.id).find((h) => h.bonusId === u.bonusId)?.worth ?? 0), 0);
|
|
701
718
|
const value = Math.max(0, t.value - lost);
|
|
702
719
|
return { ...t, value, worth: value + (t.have + stakeAt(t.id)) / paybackTurns };
|
|
703
720
|
};
|
|
@@ -1389,7 +1406,9 @@ export function floorTier(pc, ps, book, threats, hb, prev) {
|
|
|
1389
1406
|
// #118: CONCEDE_FACTOR and the payback test concede a floored unit only when the armies have
|
|
1390
1407
|
// a better use: it is kept, and held whole after the captures if what is left covers it.
|
|
1391
1408
|
const losing = units.filter((u) => u.loss);
|
|
1392
|
-
|
|
1409
|
+
// #593: a unit paying only for its hub share gets the same floor first, but still competes to be held whole; when it
|
|
1410
|
+
// cannot be, `floorOrConcede` finds the floor in place and keeps it contested.
|
|
1411
|
+
floorUnits([...losing, ...units.filter((u) => !u.loss && u.hubOnly)]);
|
|
1393
1412
|
for (const u of losing)
|
|
1394
1413
|
contest(u);
|
|
1395
1414
|
const items = [
|
|
@@ -9,7 +9,7 @@ import { neighborsOf } from '../graph.js';
|
|
|
9
9
|
import { chargeDeploys, deployPools } from '../local-deploy.js';
|
|
10
10
|
import { territoryIncome } from '../player.js';
|
|
11
11
|
import { opensBehind } from '../opens.js';
|
|
12
|
-
import { BREACH_WEIGHT, OPENS_WEIGHT, WASTELAND_FACTOR, visibleState } from './shared.js';
|
|
12
|
+
import { BREACH_WEIGHT, HUB_DEGREE, HUB_MIN_MEMBERS, HUB_WEIGHT, OPENS_WEIGHT, WASTELAND_FACTOR, visibleState } from './shared.js';
|
|
13
13
|
import { byNum } from './util.js';
|
|
14
14
|
import { secondLineOf } from './guard-off.js';
|
|
15
15
|
/** Open the deploy book of one pass: sets `ps.budget`, `ps.holdings` and the starting `avail`. */
|
|
@@ -326,6 +326,39 @@ export function deployBook(ctx, ps, previousBoard) {
|
|
|
326
326
|
return out;
|
|
327
327
|
};
|
|
328
328
|
const opensCache = new Map();
|
|
329
|
+
/**
|
|
330
|
+
* #593: the bonuses my `t` is a hub of — positive, held in full, at least {@link HUB_MIN_MEMBERS} members, `t`
|
|
331
|
+
* bordering at least {@link HUB_DEGREE} of the others: its fall takes the rest (on 16 lost 1v1s' boards such a
|
|
332
|
+
* member lost 78% of the rest by the next turn, one bordering < 50% 20%, and none was ever retaken). Each counts
|
|
333
|
+
* {@link HUB_WEIGHT} × its value on top of the bonus. Never double-counted: #235's cut counts bonuses wholly cut
|
|
334
|
+
* off, #275's breach and #291's opens bonuses not containing `t`, so none of them counts `t`'s own bonus.
|
|
335
|
+
*/
|
|
336
|
+
const hubsAt = (t) => {
|
|
337
|
+
const cached = hubCache.get(t);
|
|
338
|
+
if (cached)
|
|
339
|
+
return cached;
|
|
340
|
+
const out = [];
|
|
341
|
+
if (ps.holdings.has(t)) {
|
|
342
|
+
const near = new Set(neighborsOf(g, t));
|
|
343
|
+
for (const b of [...g.map.bonuses].sort((x, y) => x.id - y.id)) {
|
|
344
|
+
if (b.value <= 0)
|
|
345
|
+
continue;
|
|
346
|
+
const ts = bonusTerritories(g, b.id);
|
|
347
|
+
if (ts.length < HUB_MIN_MEMBERS || !ts.includes(t) || !ts.every((x) => ps.holdings.has(x)))
|
|
348
|
+
continue;
|
|
349
|
+
const others = ts.filter((x) => x !== t);
|
|
350
|
+
const borders = others.filter((x) => near.has(x)).length;
|
|
351
|
+
if (borders < HUB_DEGREE * others.length)
|
|
352
|
+
continue;
|
|
353
|
+
out.push({ bonusId: b.id, value: b.value, borders, others: others.length, worth: Math.round(HUB_WEIGHT * b.value * 10) / 10 });
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
hubCache.set(t, out);
|
|
357
|
+
return out;
|
|
358
|
+
};
|
|
359
|
+
const hubCache = new Map();
|
|
360
|
+
/** #593: the hub worth of bonus `bonusId` among `members` (once per bonus, however many of them are its hubs). */
|
|
361
|
+
const hubWorthOf = (bonusId, members) => members.map((m) => hubsAt(m).find((h) => h.bonusId === bonusId)?.worth ?? 0).reduce((a, b) => Math.max(a, b), 0);
|
|
329
362
|
const protectedValue = (t) => {
|
|
330
363
|
// Each bonus is visited once, so it counts once however many of its borders are threatened.
|
|
331
364
|
// #235: plus the income of what losing it cuts off from the rest of my holdings.
|
|
@@ -346,7 +379,8 @@ export function deployBook(ctx, ps, previousBoard) {
|
|
|
346
379
|
if (b.value === 0)
|
|
347
380
|
continue;
|
|
348
381
|
if (ts.every((x) => ps.holdings.has(x))) {
|
|
349
|
-
|
|
382
|
+
// #593: a hub's fall takes the rest of the bonus, which comes back only member by member.
|
|
383
|
+
v += b.value + (hubsAt(t).find((h) => h.bonusId === b.id)?.worth ?? 0);
|
|
350
384
|
continue;
|
|
351
385
|
}
|
|
352
386
|
// An incomplete bonus I am working on (T is in it): lost access if T is my only way in.
|
|
@@ -418,6 +452,9 @@ export function deployBook(ctx, ps, previousBoard) {
|
|
|
418
452
|
breachCache,
|
|
419
453
|
opensAt,
|
|
420
454
|
opensCache,
|
|
455
|
+
hubsAt,
|
|
456
|
+
hubCache,
|
|
457
|
+
hubWorthOf,
|
|
421
458
|
stakeAt,
|
|
422
459
|
};
|
|
423
460
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// (#167) and the turns to eliminate each opponent (#179). planPass runs them where they ran before:
|
|
8
8
|
// the expected outcome and the offence report after Order Priority for a strike, the plan last,
|
|
9
9
|
// after the move order (plan/move-order.ts).
|
|
10
|
-
import {
|
|
10
|
+
import { siegeLines, siegeReport } from './siege.js';
|
|
11
11
|
import { bonusTerritories } from '../bonuses.js';
|
|
12
12
|
import { DEFAULT_DEFENSIVE_KILL_RATE, DEFAULT_OFFENSIVE_KILL_RATE, straightKills } from '../combat.js';
|
|
13
13
|
import { classifyExchange } from '../exchange.js';
|
|
@@ -96,10 +96,6 @@ export function reportExpected(pc, ps, book, threats, hd, tgt, caps) {
|
|
|
96
96
|
const { short, deployable } = poolShortfall(g, keptHeld(after), frontier.income, lacks);
|
|
97
97
|
return { player, gates: list, need, onGates, deficit, income: frontier.income, short, deployable };
|
|
98
98
|
})();
|
|
99
|
-
// Warned only when this plan's own captures open a gate the budget cannot pay for (the shortfall alone is in the report).
|
|
100
|
-
const opened = gates ? gates.gates.filter((x) => captured.has(x.id)).map((x) => x.id) : [];
|
|
101
|
-
if (gates && gates.short > 0 && opened.length)
|
|
102
|
-
warnings.push(`Gate budget (#297): this plan's capture of ${opened.map(label).join(', ')} opens ${opened.length === 1 ? 'a gate' : 'gates'} the income cannot hold — ${gates.gates.length} gates facing player ${gates.player}${gates.gates.some((x) => x.conceded) ? ` (${gates.gates.filter((x) => x.conceded).length} conceded)` : ''} need ${gates.need} against its one floating deploy; ${gates.onGates} stand on them, ${gates.deficit} short across them, and the next income is ${gates.income}${gates.deployable !== undefined ? ` (${gates.deployable} of it deployable on them under Local Deployment)` : ''}: ${gates.short} short.`);
|
|
103
99
|
const startCost = startHold();
|
|
104
100
|
const outgrown = frontier.holdCost > frontier.income && frontier.holdCost > startCost;
|
|
105
101
|
// A capture stopped by one pass but taken by a later one (the next income grew in between) is
|
|
@@ -530,6 +526,9 @@ export function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSp
|
|
|
530
526
|
if (lead.spare < sure)
|
|
531
527
|
return `a lead strike (my army lead is ${leadText()}, over ${SECOND_FRONT_LEAD}×) needs ${sure} — sized for its ${defenceAt(n)} defenders plus player ${p}'s ~${extra} deploy — and the most a neighbour of mine can spare for it is ${lead.spare}${lead.spare > 0 ? ` (${label(lead.x)})` : ''}${deployText}`;
|
|
532
528
|
}
|
|
529
|
+
// #593: a member of a bonus probably held behind the fog is a break candidate that was not funded.
|
|
530
|
+
if (tgt.foggedMember.has(n))
|
|
531
|
+
return `${label(best.x)} could spare ${best.spare} for it, and it probably breaks a bonus behind the fog (#593), but that break, sized for a partial deploy, did not fit or ranked below what the turn funded`;
|
|
533
532
|
return `${label(best.x)} could spare ${best.spare} for it, but it breaks no bonus and is no counter-attack, finishing blow or strike — the only reasons the plan attacks a player's territory (rule 2), besides rule 4e's fallback when nothing else is captured${!ffaLead
|
|
534
533
|
? ''
|
|
535
534
|
: !leadLever
|
|
@@ -705,14 +704,9 @@ export function finishPlan(pc, ps, pass, threats, hd, tgt, expected, sentAt, slo
|
|
|
705
704
|
warnings.push(pc.siegeWarning);
|
|
706
705
|
if (pc.siege)
|
|
707
706
|
rationale.unshift(...siegeLines(pc.siege, label, pc.bonusName));
|
|
708
|
-
const chose = pc.siege ? siegeFitLine(pc.siege, pc.bonusName) : undefined;
|
|
709
|
-
if (chose)
|
|
710
|
-
rationale.unshift(chose);
|
|
711
|
-
if (pc.siegeHandBack)
|
|
712
|
-
rationale.push(pc.siegeHandBack);
|
|
713
707
|
return {
|
|
714
708
|
goal: pc.opts.goal === 'siege' || pc.siege ? 'siege' : goal,
|
|
715
|
-
...(pc.siege ? { siege: siegeReport(pc.siege, g, captured
|
|
709
|
+
...(pc.siege ? { siege: siegeReport(pc.siege, g, captured) } : {}),
|
|
716
710
|
profile,
|
|
717
711
|
// Deploys interleave like moves, and the order they land in shows the opponent my income and
|
|
718
712
|
// the move order: next to a visible enemy first, in the back after (ascending id within each).
|
|
@@ -16,6 +16,24 @@ export const BREACH_WEIGHT = 0.5;
|
|
|
16
16
|
* reaches only through it) that its protected value counts — the enemy still has to walk in, as with a breach.
|
|
17
17
|
*/
|
|
18
18
|
export const OPENS_WEIGHT = 0.5;
|
|
19
|
+
/**
|
|
20
|
+
* #593: a member of a positive bonus I hold in full with at least this many members whose fall can take the rest of
|
|
21
|
+
* the bonus (a hub, {@link HUB_DEGREE}). Smaller bonuses are left out: in a 2- or 3-member bonus every member borders
|
|
22
|
+
* most of the others, and the follow-on loss was measured on 4+ members only.
|
|
23
|
+
*/
|
|
24
|
+
export const HUB_MIN_MEMBERS = 4;
|
|
25
|
+
/** #593: the share of the bonus's other members a hub borders (at least). */
|
|
26
|
+
export const HUB_DEGREE = 0.75;
|
|
27
|
+
/**
|
|
28
|
+
* #593: the share of the bonus's value a hub's protected value counts on top of the bonus itself. Measured on 16 lost
|
|
29
|
+
* 1v1s' history boards: when a held bonus of 4+ members lost its first member, a member bordering ≥ 75% of the
|
|
30
|
+
* others lost 78% of the rest by the next turn (the whole bonus 6 of 9; every one of 3 hubs bordering all), one
|
|
31
|
+
* bordering < 50% lost 20% (never the whole bonus, 0 of 19), and no lost member was ever retaken (0 of 48). The
|
|
32
|
+
* excess follow-on loss, 0.78 − 0.20 = 0.58 ≈ 0.6 (the owner's choice, 2026-11-27), is the rest of the bonus that has to
|
|
33
|
+
* be taken back member by member before it pays again. Once rule 1c counts this turn's captures, a bonus they complete has hubs too (owner,
|
|
34
|
+
* 2026-11-27).
|
|
35
|
+
*/
|
|
36
|
+
export const HUB_WEIGHT = 0.6;
|
|
19
37
|
/** #201: the shortest payback horizon once the game is decided. */
|
|
20
38
|
export const DECIDED_PAYBACK_MIN = 3;
|
|
21
39
|
/** …or when one remaining territory alone costs more than this many times its value (a wasteland). */
|
|
@@ -190,53 +190,6 @@ export function siegeOf(o) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
// ---- The profile's siege (#382 item 2) ----
|
|
193
|
-
/** A sure break fits a siege when it costs at most this many turns of the income it takes away. */
|
|
194
|
-
export const SIEGE_FIT_TURNS = 2;
|
|
195
|
-
/** … one turn only when the target retook that bonus on this many earlier siege turns or more. */
|
|
196
|
-
export const SIEGE_RETAKEN_TURNS = 2;
|
|
197
|
-
/** In a free-for-all the target must earn this multiple of every other opponent in contact with me. */
|
|
198
|
-
export const SIEGE_FFA_DOMINANCE = 1.5;
|
|
199
|
-
/**
|
|
200
|
-
* Whether the profile picks the siege (no explicit goal; #382). It fits when, against the siege's target:
|
|
201
|
-
* - the format is a 1v1 or a free-for-all (a team game focuses its fire by `teams-focus`), in contact
|
|
202
|
-
* (phase `contact` or `late`);
|
|
203
|
-
* - I am not ahead (ahead, the assault and the 1v1 pressure rules play; an unknown standing is no fit);
|
|
204
|
-
* - in a free-for-all the target is the leader on strength (not me) and earns at least
|
|
205
|
-
* {@link SIEGE_FFA_DOMINANCE} × every other opponent in contact with me (one war, not two fronts);
|
|
206
|
-
* - a sure break (every member in view, a member next to mine) costs at most {@link SIEGE_FIT_TURNS} turns of
|
|
207
|
-
* its bonus — one when the target retook it on {@link SIEGE_RETAKEN_TURNS} earlier siege turns — and at most
|
|
208
|
-
* my income, so one turn's deploys can pay for a break every turn (a siege that cannot afford its breaks only
|
|
209
|
-
* holds the assault back: corpus case 921, where it idled a 23-army stack beside a sure capture).
|
|
210
|
-
* Once the assault trigger fires the siege hands back (`handBack`): the profile's own goal plays the assault.
|
|
211
|
-
*/
|
|
212
|
-
export function siegeFit(s, o) {
|
|
213
|
-
if (o.format === 'teams' || (o.phase !== 'contact' && o.phase !== 'late'))
|
|
214
|
-
return { fits: false };
|
|
215
|
-
if (o.standing !== 'even' && o.standing !== 'behind')
|
|
216
|
-
return { fits: false };
|
|
217
|
-
if (o.format === 'ffa' && (o.leader !== s.target || s.rivals.some((r) => r.income * SIEGE_FFA_DOMINANCE > s.opponentIncome)))
|
|
218
|
-
return { fits: false };
|
|
219
|
-
const retakes = (b) => s.earlier.filter((t) => t.breaks.includes(b)).length;
|
|
220
|
-
const fits = s.breaks.flatMap((b) => {
|
|
221
|
-
if (b.probable || b.cost === null)
|
|
222
|
-
return [];
|
|
223
|
-
const retaken = retakes(b.bonusId) >= SIEGE_RETAKEN_TURNS;
|
|
224
|
-
const turns = retaken ? 1 : SIEGE_FIT_TURNS;
|
|
225
|
-
return b.cost <= turns * b.value && b.cost <= s.myIncome ? [{ bonusId: b.bonusId, value: b.value, cost: b.cost, turns, retaken }] : [];
|
|
226
|
-
});
|
|
227
|
-
if (!fits.length)
|
|
228
|
-
return { fits: false };
|
|
229
|
-
if (s.ready)
|
|
230
|
-
return { fits: false, handBack: s.trigger };
|
|
231
|
-
return { fits: true, fit: fits[0] };
|
|
232
|
-
}
|
|
233
|
-
/** The line that says why the profile chose the siege. */
|
|
234
|
-
export function siegeFitLine(s, bonusName) {
|
|
235
|
-
const f = s.auto;
|
|
236
|
-
if (!f)
|
|
237
|
-
return undefined;
|
|
238
|
-
return `The profile chose the siege on player ${s.target} (#382): in contact, not ahead, ${s.rivals.length ? `every other opponent beside me earning at most 1/${SIEGE_FFA_DOMINANCE} of its income, ` : ''}and ${bonusName(f.bonusId)} (+${f.value}) for ${f.cost} breaks within ${f.turns} turn${f.turns === 1 ? '' : 's'} of its income${f.retaken ? ` (counted one turn: retaken after ${SIEGE_RETAKEN_TURNS} earlier breaks)` : ''}. Breaking it costs less than it takes away, so attrition beats an assault until the trigger fires; an explicit goal overrides it.`;
|
|
239
|
-
}
|
|
240
193
|
/** The rationale lines a siege adds (first in the plan's rationale). */
|
|
241
194
|
export function siegeLines(s, label, bonusName) {
|
|
242
195
|
const ratio = s.ratio === null ? 'it earns nothing' : `my ${s.myIncome} is ${s.ratio}× its income`;
|
|
@@ -262,7 +215,7 @@ export function siegeLines(s, label, bonusName) {
|
|
|
262
215
|
return [head, breaks, state];
|
|
263
216
|
}
|
|
264
217
|
/** The report of a siege once the plan's captures are known. */
|
|
265
|
-
export function siegeReport(s, g, captured
|
|
218
|
+
export function siegeReport(s, g, captured) {
|
|
266
219
|
const brokenThisTurn = s.breaks
|
|
267
220
|
.filter((b) => bonusTerritories(g, b.bonusId).some((t) => captured.has(t)))
|
|
268
221
|
.map((b) => ({ bonusId: b.bonusId, value: b.value }));
|
|
@@ -293,7 +246,6 @@ export function siegeReport(s, g, captured, bonusName) {
|
|
|
293
246
|
ratio: s.ratio,
|
|
294
247
|
fallenTo: s.fallenTo,
|
|
295
248
|
...(memory ? { memory } : {}),
|
|
296
|
-
...(s.auto ? { auto: siegeFitLine(s, bonusName ?? ((b) => `bonus ${b}`)) } : {}),
|
|
297
249
|
brokenThisTurn,
|
|
298
250
|
breaks: s.breaks,
|
|
299
251
|
ready: s.ready,
|
|
@@ -332,7 +332,7 @@ export function neverStandStill(pc, ps, book, threats, hd, tgt, caps) {
|
|
|
332
332
|
const { growthOf, facing } = threats;
|
|
333
333
|
const { conceded } = hd;
|
|
334
334
|
const { targets, bonusTarget, targetScoreCost, toFinish, plans, finishCost, sizeOf } = tgt;
|
|
335
|
-
const { stopped, outgrows
|
|
335
|
+
const { stopped, outgrows } = caps;
|
|
336
336
|
/**
|
|
337
337
|
* #125: the step rule 4e ranked first and could not afford this turn (its size, nothing else):
|
|
338
338
|
* the leftover saves toward it (rule 5) and idle stacks stage toward it (rule 6).
|
|
@@ -617,9 +617,8 @@ export function neverStandStill(pc, ps, book, threats, hd, tgt, caps) {
|
|
|
617
617
|
failed.set(st.t, { kind: 'hold', ...short });
|
|
618
618
|
continue;
|
|
619
619
|
}
|
|
620
|
-
// #114: in contact rule 4d is a cost (ranked above), not a veto
|
|
621
|
-
|
|
622
|
-
const stop = contact ? gateStop(st.t) : outgrows(st.t);
|
|
620
|
+
// #114: in contact rule 4d is a cost (ranked above), not a veto (#603: nor is #297's gate budget any more).
|
|
621
|
+
const stop = contact ? null : outgrows(st.t);
|
|
623
622
|
if (stop === null) {
|
|
624
623
|
taken = pick;
|
|
625
624
|
break;
|
|
@@ -4,8 +4,6 @@ import { neighborsOf } from '../graph.js';
|
|
|
4
4
|
export const STOCKPILE_TURNS = 4;
|
|
5
5
|
/** #421: the visible-army lead over one opponent beside me that turns a stockpile into a strike stack facing it. */
|
|
6
6
|
export const STOCKPILE_LEAD = 2;
|
|
7
|
-
/** #421 (owner decision, 2026-11-20): the share of a flat income held out of captures for the strike stack. */
|
|
8
|
-
export const STRIKE_SHARE = 0.25;
|
|
9
7
|
/** My armies in view and each other player's (special units counted), visible territories only. */
|
|
10
8
|
export function armiesInView(a) {
|
|
11
9
|
const by = new Map();
|
|
@@ -56,20 +54,6 @@ export function stockpileOf(a) {
|
|
|
56
54
|
line: `${my} armies of mine stand on the board, ${turns} turns of my flat ${a.income} income, ${ratio} player ${p}'s in view`,
|
|
57
55
|
};
|
|
58
56
|
}
|
|
59
|
-
/**
|
|
60
|
-
* #421 (owner decision, 2026-11-20): in contact on a flat income — where rule 0p.3c builds a strike stack
|
|
61
|
-
* (a 1v1 adapting, a siege, or the stockpile above) — {@link STRIKE_SHARE} of my income, rounded down, is
|
|
62
|
-
* held out of captures for the stack. Holds still take their exact need first; the leftover deploy then
|
|
63
|
-
* gives the stack what the captures left, ahead of comfort margins. 0 otherwise.
|
|
64
|
-
*/
|
|
65
|
-
export function strikeShareOf(a) {
|
|
66
|
-
if (!a.incomeTrend?.flat || a.income <= 0)
|
|
67
|
-
return 0;
|
|
68
|
-
const stack = (a.siege !== undefined && a.contact.has(a.siege)) ||
|
|
69
|
-
(a.auto && a.format === '1v1' && a.goal !== 'defend' && a.contact.size > 0) ||
|
|
70
|
-
stockpileOf({ ...a, siege: a.siege !== undefined, facing: a.contact }) !== undefined;
|
|
71
|
-
return stack ? Math.floor(STRIKE_SHARE * a.income) : 0;
|
|
72
|
-
}
|
|
73
57
|
/**
|
|
74
58
|
* #421 (owner decision, 2026-11-20): the contested bonuses an all-in completion could take on the pile — a
|
|
75
59
|
* positive bonus I hold a member of, whose every missing member is in view (armies shown) beside a territory of
|
|
@@ -5,7 +5,7 @@ import { neighborsOf } from '../graph.js';
|
|
|
5
5
|
import { MIN_ENEMY_DEPLOY, visibleState, } from './shared.js';
|
|
6
6
|
import { byNum, pct } from './util.js';
|
|
7
7
|
import { stackFacing } from './strike.js';
|
|
8
|
-
import {
|
|
8
|
+
import { stockpileOf } from './stockpile.js';
|
|
9
9
|
/** Rule 0p.3c (#72, #120, #201, #421): the strike stack's border (a 1v1, a siege or a stockpile), chosen before the leftover deploy. */
|
|
10
10
|
export function chooseStrikeStack(pc, ps, book, threats, open, stays) {
|
|
11
11
|
const { g, income, profile, auto, goal, estimates, deployOf, incomeOfPlayer, paybackTurns, territories: state, label, mine, armiesOf, unitsAt, defenceAt, completedBy, inFocus, guard, rates, costAt, noSplit, } = pc;
|
|
@@ -151,11 +151,6 @@ export function chooseStrikeStack(pc, ps, book, threats, open, stays) {
|
|
|
151
151
|
...(stockpile ? { facing: stockpile.why } : {}),
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
// #421 (owner decision, 2026-11-20): the share the estimates phase held out of captures.
|
|
155
|
-
if (pc.strikeShare > 0)
|
|
156
|
-
rationale.push(stack
|
|
157
|
-
? `Strike share (#421): ${pc.strikeShare} of my flat ${income} income (${STRIKE_SHARE * 100}%) was held out of captures for the strike stack on ${label(stack.id)}, ahead of comfort margins; holds took their exact need first.`
|
|
158
|
-
: `Strike share (#421): ${pc.strikeShare} of my flat ${income} income (${STRIKE_SHARE * 100}%) was held out of captures for a strike stack, but no border could carry one this turn: it goes to the leftover as usual.`);
|
|
159
154
|
return { stack, smallExpansion };
|
|
160
155
|
}
|
|
161
156
|
/** #102: spend the strike stack on the enemy territories next to it, once the leftover deploy is in. */
|
|
@@ -361,7 +361,13 @@ export function finishOffHelper(pc, ps, book, threats, hd, tgt, cap) {
|
|
|
361
361
|
if (uncoverable)
|
|
362
362
|
return { best, bestUnfunded, canEliminate };
|
|
363
363
|
const sizes = tried.map(() => 0);
|
|
364
|
+
// An attempt is `enough` only when at least `need` targets fall (or all, under pressure), and a target
|
|
365
|
+
// falls only when attacked: sizings that attack fewer are never tried (nothing they could yield is used).
|
|
366
|
+
const need = pressure ? ts.length : Math.max(1, Math.min(ts.length - 1, Math.ceil(ts.length / 2)));
|
|
367
|
+
let attacking = 0;
|
|
364
368
|
const visit = (i) => {
|
|
369
|
+
if (attacking + tried.length - i < need)
|
|
370
|
+
return;
|
|
365
371
|
if (i === tried.length) {
|
|
366
372
|
const a = attempt([...sizes]);
|
|
367
373
|
restore(reserved);
|
|
@@ -379,7 +385,11 @@ export function finishOffHelper(pc, ps, book, threats, hd, tgt, cap) {
|
|
|
379
385
|
}
|
|
380
386
|
for (const e of sharesOf[i]) {
|
|
381
387
|
sizes[i] = e;
|
|
388
|
+
if (e !== SKIP)
|
|
389
|
+
attacking++;
|
|
382
390
|
visit(i + 1);
|
|
391
|
+
if (e !== SKIP)
|
|
392
|
+
attacking--;
|
|
383
393
|
}
|
|
384
394
|
};
|
|
385
395
|
if (tried.length)
|
|
@@ -8,6 +8,7 @@ import { byNum } from './util.js';
|
|
|
8
8
|
import { denialsOf, emptyEnemiesOf, fogVacated, VACATED_FOG_ARMIES } from './vacated.js';
|
|
9
9
|
import { breakableBonuses } from './siege.js';
|
|
10
10
|
import { ALL_IN_VALUE_TURNS } from './bonus-attempts.js';
|
|
11
|
+
import { foggedBreakables } from './fogged-break.js';
|
|
11
12
|
/** The targets, the frontier costs and the bonus plans, in the order planPass defined them. */
|
|
12
13
|
export function targetsPhase(pc, ps, input, threats, hd) {
|
|
13
14
|
const c0 = breakTargets(pc, input);
|
|
@@ -19,7 +20,9 @@ export function targetsPhase(pc, ps, input, threats, hd) {
|
|
|
19
20
|
// pass 3 may take, each judged once on the board as it stands.
|
|
20
21
|
const denials = denialsOf(pc);
|
|
21
22
|
const emptyEnemies = emptyEnemiesOf(pc, input.previousBoard, threats.reinforcementAt, (t) => c4.targets.has(t) || c4.repulsed.has(t) || pc.truce.noTarget(t));
|
|
22
|
-
|
|
23
|
+
// #593: the bonuses an earlier plan of this turn advanced while conceding another member of them.
|
|
24
|
+
const deadBonuses = input.deadAdvance ?? new Map();
|
|
25
|
+
return { ...c4, denials, emptyEnemies, deadBonuses };
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* #430 (owner decision of 2026-11-22): a retake of a held bonus's lost members costs at most this many
|
|
@@ -38,6 +41,13 @@ export function breakTargets(pc, input) {
|
|
|
38
41
|
// is that opponent's or hidden. Such a break is "probable".
|
|
39
42
|
const breakable = balanced ? breakableBonuses(g, state, foe, input.tracks) : [];
|
|
40
43
|
const breakMember = new Set(breakable.flatMap((b) => bonusTerritories(g, b.bonusId)));
|
|
44
|
+
// #593: in a 1v1, the opponent's bonuses behind the fog (a member in view its and beside mine, no member
|
|
45
|
+
// shown with another owner), and on the opening turns the ones it is one neutral short of. Their members
|
|
46
|
+
// in view are break targets (`foggedMember`), scored and sized by rule 4a (plan/fogged-break.ts).
|
|
47
|
+
const foggedBreaks = balanced && pc.profile.format === '1v1'
|
|
48
|
+
? foggedBreakables(g, state, foe, mineSet, new Set(breakable.map((b) => b.bonusId)), pc.turnNow)
|
|
49
|
+
: [];
|
|
50
|
+
const foggedMember = new Set(foggedBreaks.flatMap((b) => b.members));
|
|
41
51
|
// ---- counter-attacks (under `balanced`, #72) ----
|
|
42
52
|
// An enemy stack next to me that shrank since the previous board by attacking me: visible on
|
|
43
53
|
// both boards under the same owner (F1, #69), every neighbour visible on both, one of them a
|
|
@@ -91,14 +101,14 @@ export function breakTargets(pc, input) {
|
|
|
91
101
|
counterAt.set(id, { player: p, from: was.armies, to: st.armies, costNow, costThen });
|
|
92
102
|
}
|
|
93
103
|
}
|
|
94
|
-
return { breakable, breakMember, counterAt };
|
|
104
|
+
return { breakable, breakMember, counterAt, foggedBreaks, foggedMember };
|
|
95
105
|
}
|
|
96
106
|
/** Rule 2: the targets next to mine, and the lead steps into a bonus on an army lead (#203). */
|
|
97
107
|
export function captureTargets(pc, ps, input, threats, prev) {
|
|
98
108
|
const { g, foe, profile, auto, goal, balanced, territories: state, label, mineSet, unitsAt, uncounted, uncountedKind, defenceAt, bonusTs, costAt, noSplit, leadLever, leadText, } = pc;
|
|
99
109
|
const { warnings, rationale } = ps;
|
|
100
110
|
const { reinforcementAt, hiddenFoe, hiddenMovable, hiddenPool } = threats;
|
|
101
|
-
const { breakMember, counterAt } = prev;
|
|
111
|
+
const { breakMember, counterAt, foggedMember } = prev;
|
|
102
112
|
// ---- 2. targets ----
|
|
103
113
|
const targets = new Map();
|
|
104
114
|
/**
|
|
@@ -332,7 +342,7 @@ export function captureTargets(pc, ps, input, threats, prev) {
|
|
|
332
342
|
continue;
|
|
333
343
|
}
|
|
334
344
|
const enemy = st.owner.kind === 'player';
|
|
335
|
-
if (enemy && goal !== 'complete-bonus' && !(balanced && (breakMember.has(t) || counterAt.has(t))) && !pileMembers.has(t) && !retakeMembers.has(t)) {
|
|
345
|
+
if (enemy && goal !== 'complete-bonus' && !(balanced && (breakMember.has(t) || counterAt.has(t) || foggedMember.has(t))) && !pileMembers.has(t) && !retakeMembers.has(t)) {
|
|
336
346
|
if (!leadStepsOn || unitsAt(t) > 0 || droppedMembers.has(t) || !g.map.bonuses.some((b) => b.value > 0 && bonusTs.get(b.id).includes(t)))
|
|
337
347
|
continue;
|
|
338
348
|
const defenders = defenceAt(t);
|
|
@@ -371,15 +381,22 @@ export function frontierCosts(pc, threats, hd, prev) {
|
|
|
371
381
|
* held; facing an enemy when a visible enemy is next to it, and then `need` is the deploys it
|
|
372
382
|
* needs next turn to hold (the R3 arithmetic: threat = movable + max(deploy, growth) per player).
|
|
373
383
|
*/
|
|
384
|
+
// #603: the opponent's one floating deploy counts once, at the border it adds most to, not on every border.
|
|
385
|
+
const deployOnce = pc.opts.experiments?.includes('legacy-frontier') !== true;
|
|
374
386
|
const borderOf = (x, held, have) => {
|
|
375
387
|
if (neighborsOf(g, x).every((n) => held.has(n)))
|
|
376
|
-
return { border: false, enemy: false, need: 0 };
|
|
388
|
+
return { border: false, enemy: false, need: 0, needStack: 0, player: -1 };
|
|
377
389
|
// G2: next turn's threat — a player a Diplomacy card shields me from only this turn counts.
|
|
378
390
|
const th = nextTurnAt(x, (n) => held.has(n));
|
|
379
391
|
if (!th)
|
|
380
|
-
return { border: true, enemy: false, need: 0 };
|
|
392
|
+
return { border: true, enemy: false, need: 0, needStack: 0, player: -1 };
|
|
381
393
|
const units = mineSet.has(x) ? unitsAt(x) : 0;
|
|
382
|
-
|
|
394
|
+
const need = Math.max(0, holdArmies(th.threat) - have - units);
|
|
395
|
+
if (!deployOnce)
|
|
396
|
+
return { border: true, enemy: true, need, needStack: need, player: th.player };
|
|
397
|
+
const st = nextTurnAt(x, (n) => held.has(n), 0);
|
|
398
|
+
const needStack = st ? Math.min(need, Math.max(0, holdArmies(st.threat) - have - units)) : 0;
|
|
399
|
+
return { border: true, enemy: true, need, needStack, player: th.player };
|
|
383
400
|
};
|
|
384
401
|
/**
|
|
385
402
|
* A border's cost in armies: {@link NEUTRAL_BORDER_COST}, plus its hold need when it faces an
|
|
@@ -446,13 +463,20 @@ export function frontierCosts(pc, threats, hd, prev) {
|
|
|
446
463
|
let borders = 0;
|
|
447
464
|
let enemyBorders = 0;
|
|
448
465
|
let holdCost = 0;
|
|
466
|
+
/** deploy-once: per opponent, the most its one floating deploy adds to any one border's need. */
|
|
467
|
+
const floating = new Map();
|
|
449
468
|
for (const x of [...held].sort(byNum)) {
|
|
450
469
|
const b = borderOf(x, held, haveOf(x));
|
|
451
470
|
borders += Number(b.border);
|
|
452
471
|
enemyBorders += Number(b.enemy);
|
|
453
|
-
if (!conceded.has(x) || stood.has(x))
|
|
454
|
-
holdCost += b.
|
|
472
|
+
if (!conceded.has(x) || stood.has(x)) {
|
|
473
|
+
holdCost += b.needStack;
|
|
474
|
+
if (b.need > b.needStack)
|
|
475
|
+
floating.set(b.player, Math.max(floating.get(b.player) ?? 0, b.need - b.needStack));
|
|
476
|
+
}
|
|
455
477
|
}
|
|
478
|
+
for (const v of floating.values())
|
|
479
|
+
holdCost += v;
|
|
456
480
|
return { borders, enemyBorders, holdCost };
|
|
457
481
|
};
|
|
458
482
|
/**
|
|
@@ -498,16 +522,6 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
498
522
|
const wasteShare = s.wastelands && s.wastelands.count > 0 && s.wastelands.size > 0 && g.territoryById.size > 0
|
|
499
523
|
? Math.min(1, s.wastelands.count / g.territoryById.size)
|
|
500
524
|
: 0;
|
|
501
|
-
/**
|
|
502
|
-
* #432: a visible neutral at the game's wasteland size or more, when the game has wastelands larger than its
|
|
503
|
-
* ordinary neutrals (`neutralArmies`, when the settings give it).
|
|
504
|
-
*/
|
|
505
|
-
const isWasteland = (st) => s.wastelands !== undefined &&
|
|
506
|
-
s.wastelands.count > 0 &&
|
|
507
|
-
s.wastelands.size > (s.neutralArmies ?? 0) &&
|
|
508
|
-
st.owner.kind === 'neutral' &&
|
|
509
|
-
st.armies !== null &&
|
|
510
|
-
st.armies >= s.wastelands.size;
|
|
511
525
|
const wasteCost = wasteShare > 0 ? (costOf(s.wastelands.size) ?? Infinity) : 0;
|
|
512
526
|
const wasteLoss = wasteShare > 0 ? Math.min(wasteCost - 1, straightKills(s.wastelands.size, rates.defensiveKillRate)) + 1 : 0;
|
|
513
527
|
/** Every positive bonus worth completing (net > 0) still missing members: its armies to finish (rule 4e). */
|
|
@@ -614,8 +628,6 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
614
628
|
// #125: the economy test charges the armies lost, not the armies sent.
|
|
615
629
|
let loss = 0;
|
|
616
630
|
let worstLoss = 0;
|
|
617
|
-
/** #432: its missing members in view that are wastelands. */
|
|
618
|
-
const wastelands = [];
|
|
619
631
|
const known = (t, armies) => {
|
|
620
632
|
const c = costAt(t, armies) ?? Infinity;
|
|
621
633
|
cost += c;
|
|
@@ -664,8 +676,6 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
664
676
|
const c = costAt(t) ?? Infinity;
|
|
665
677
|
cost += c;
|
|
666
678
|
worst = Math.max(worst, c);
|
|
667
|
-
if (isWasteland(st))
|
|
668
|
-
wastelands.push(t);
|
|
669
679
|
const l = econCostAt(t);
|
|
670
680
|
loss += l;
|
|
671
681
|
worstLoss = Math.max(worstLoss, l);
|
|
@@ -706,10 +716,7 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
706
716
|
cost += fogged * fogEach + foggedNeutral * neutralEach;
|
|
707
717
|
loss += fogged * fogLoss + foggedNeutral * neutralEachLoss;
|
|
708
718
|
const fogNeutral = foggedNeutral ? { count: foggedNeutral, each: neutralEach, size: neutralSize } : undefined;
|
|
709
|
-
|
|
710
|
-
// unless this turn's captures can complete it (owner decision 2026-11-22: a completing wasteland is taken).
|
|
711
|
-
const wasteStop = !isFocus && pc.shortGates !== undefined && wastelands.length > 0 && !remaining.every(bonusTarget);
|
|
712
|
-
const economic = isFocus || (loss <= paybackTurns * net && worstLoss <= WASTELAND_FACTOR * net && !wasteStop);
|
|
719
|
+
const economic = isFocus || (loss <= paybackTurns * net && worstLoss <= WASTELAND_FACTOR * net);
|
|
713
720
|
// #435: a shared bonus I am nearer to but that is not worth working stays as C3.3 left it — skipped
|
|
714
721
|
// with its members plain expansion, never marked uneconomic (45701358 turn 1: a 344-member super-bonus,
|
|
715
722
|
// 6 members to my teammate's 5, would otherwise have stopped expansion into all its members).
|
|
@@ -724,10 +731,6 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
724
731
|
(economic ? economicMember : uneconomicMember).add(t);
|
|
725
732
|
if (!remaining.some(bonusTarget))
|
|
726
733
|
continue;
|
|
727
|
-
if (!economic && wasteStop && loss <= paybackTurns * net && worstLoss <= WASTELAND_FACTOR * net) {
|
|
728
|
-
rationale.push(`Skip bonus ${b.name} (#${b.id}): finishing it means taking the wasteland${wastelands.length === 1 ? '' : 's'} ${wastelands.map(label).join(', ')} (${s.wastelands.size} armies or more) while the gates facing player ${pc.shortGates.player} are ${pc.shortGates.deficit} short (#432).`);
|
|
729
|
-
continue;
|
|
730
|
-
}
|
|
731
734
|
if (!economic) {
|
|
732
735
|
rationale.push(`Skip bonus ${b.name} (#${b.id}): uneconomic for +${net === b.value ? b.value : `${b.value} (net +${net})`} (${toFinish(cost, { fogged, fogEach, fogNeutral })}, losing ~${loss}; ${worstLoss} lost on its costliest territory).`);
|
|
733
736
|
continue;
|