From c0dd5b2e381cc4c7319dd2827594469323408c48 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 23:11:16 -0500 Subject: [PATCH] QA only (never merge): #duel-live real bot match on duel-core engine-wip + duel-cards sample Co-Authored-By: Claude Opus 5.5 --- src/game/duel/LivePreview.tsx | 19 +++++++++++++++++++ src/main.tsx | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/game/duel/LivePreview.tsx diff --git a/src/game/duel/LivePreview.tsx b/src/game/duel/LivePreview.tsx new file mode 100644 index 0000000..b201c3d --- /dev/null +++ b/src/game/duel/LivePreview.tsx @@ -0,0 +1,19 @@ +// QA ONLY (branch night2/ui-duel/engine-preview, never merged): a real bot match on duel-core's +// engine-wip with duel-cards' derived sample. The player's "deck" is 40 sample cards, because QA has no +// wallet here; the real DuelBotMatch only takes owned cards. Route: #duel-live[/]. +import sample from '../../../docs/game/duel-card-sample.json'; +import { duelEngine, DEFAULT_DUEL_RULESET } from '../../../shared/duel/index.ts'; +import type { DuelCard } from './contract.ts'; +import { EASY_BOT, NORMAL_BOT } from './bots.ts'; +import { DuelBotMatch } from './DuelBotMatch.tsx'; + +const POOL = (sample as unknown as { cards: DuelCard[] }).cards; +const mine = POOL.slice(0, 40); +const cards = mine.map(c => ({ tokenId: c.cardId, title: c.title, duel: c })); +const botPool = POOL.slice(40); + +export function LivePreview() { + const bot = location.hash.includes('easy') ? EASY_BOT : NORMAL_BOT; + return c.tokenId)} cards={cards} engine={duelEngine} rules={DEFAULT_DUEL_RULESET} bot={bot} botPool={botPool} + playerName="QA" onExit={() => { location.hash = '#duel-live'; location.reload(); }} onFinish={() => { location.hash = '#duel-live'; location.reload(); }} />; +} diff --git a/src/main.tsx b/src/main.tsx index d3a09b9..5613b00 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -7,5 +7,6 @@ import './themes.css'; // ui-duel review aid: `#duel-preview` renders static duel board scenes from card-sample.json. const DuelPreview = lazy(() => import('./game/duel/DuelPreview.tsx').then(m => ({ default: m.DuelPreview }))); -const root = location.hash.startsWith('#duel-preview') ? : ; +const LivePreview = lazy(() => import('./game/duel/LivePreview.tsx').then(m => ({ default: m.LivePreview }))); +const root = location.hash.startsWith('#duel-live') ? : location.hash.startsWith('#duel-preview') ? : ; ReactDOM.createRoot(document.getElementById('root')!).render({root});