From b4f06001cdfeaa2e9a1a54502a4b38dce90b9c1a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 23:40:55 -0500 Subject: [PATCH] sim-balance: adapter fixes for engine core v1 (seq, nullable pageId) Co-Authored-By: Claude Opus 5.5 --- shared/bots/game-adapter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/bots/game-adapter.ts b/shared/bots/game-adapter.ts index 3458458..6ac82da 100644 --- a/shared/bots/game-adapter.ts +++ b/shared/bots/game-adapter.ts @@ -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),