sim-balance: adapter fixes for engine core v1 (seq, nullable pageId)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 23:40:55 -05:00
co-authored by Claude Opus 5.5
parent 78dcc231aa
commit b4f06001cd
+2 -2
View File
@@ -18,7 +18,7 @@ export function projectedLanes(state: MatchState, seat: Seat): [number, number][
const lanes = state.lanes.map(l => ({ ...l, cards: [[...l.cards[0]], [...l.cards[1]]] as [CardInPlay[], CardInPlay[]] }));
for (const play of me.queue) {
const card = me.hand.find(c => c.cardId === play.cardId);
if (card) lanes[play.lane].cards[seat].push({ card, owner: seat, lane: play.lane, turn: state.turn, bonus: 0 });
if (card) lanes[play.lane].cards[seat].push({ card, owner: seat, lane: play.lane, turn: state.turn, bonus: 0, seq: 1e9 + lanes[play.lane].cards[seat].length });
}
const view = { ...state, lanes } as MatchState;
return lanes.map((_, i) => orient(lanePower(view, i), seat));
@@ -94,7 +94,7 @@ export function starterPoolCards(): GameCard[] {
/** Card id without its copy suffix (`loaner:123:1` -> `loaner:123`). */
export const baseId = (id: string) => id.replace(/:\d+$/, '');
const copyOf = (c: GameCard, copy: number): GameCard => ({ ...c, cardId: `${c.cardId}:${copy}` });
const pageKey = (c: GameCard) => c.pageId;
const pageKey = (c: GameCard): string | number => c.pageId ?? baseId(c.cardId);
/**
* Fill a deck of `size` from `pool`, best `score` first (score <= 0 = excluded, ties: higher power),