forked from WikiDeck/wikideck
Mobile-first game UI in src/game/, built against a UI-side EngineAdapter. A temporary mock 3-lane engine (src/game/mock/) stands in until shared/game lands. Tap a card, then tap a lane; bottom thumb dock; bottom sheets instead of hover; full-screen match on phones. Lobby lists local and peer modes (GET /api/game/modes, parsed defensively) and shows the eom.dev login state through a stub hook for the SSO team. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
695 B
TypeScript
17 lines
695 B
TypeScript
// AI opponents. ui-b owns the real easy/normal bots; this file is the plug-in point.
|
|
import type { MatchView, UIAction } from './types.ts';
|
|
|
|
export type Bot = { id: string; name: string; choose(view: MatchView, legal: UIAction[], rand: () => number): UIAction };
|
|
|
|
/** Placeholder: plays random affordable cards into random open lanes, then ends the turn. */
|
|
export const randomBot: Bot = {
|
|
id: 'random', name: 'Random',
|
|
choose(_view, legal, rand) {
|
|
const plays = legal.filter(a => a.type === 'play');
|
|
if (plays.length && rand() < 0.85) return plays[Math.floor(rand() * plays.length)];
|
|
return { type: 'endTurn' };
|
|
},
|
|
};
|
|
|
|
export const BOTS: Bot[] = [randomBot];
|