39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { defineComponent } from "../../src/component";
|
|
|
|
// ── Card ─────────────────────────────────────────────
|
|
/** Each card is its own entity. `order` tracks position within its collection. */
|
|
export const Card = defineComponent("card", {
|
|
rank: "A",
|
|
suit: "♠",
|
|
order: 0,
|
|
});
|
|
|
|
// ── Tag components — mark which collection a card belongs to ─
|
|
export const InDeck = defineComponent("inDeck", {});
|
|
export const InPlayerHand = defineComponent("inPlayerHand", {});
|
|
export const InDealerHand = defineComponent("inDealerHand", {});
|
|
|
|
// ── Dealer state ─────────────────────────────────────
|
|
/** When present (as singleton), the dealer's hole card is hidden. */
|
|
export const HoleHidden = defineComponent("holeHidden", {});
|
|
|
|
// ── Score / state ────────────────────────────────────
|
|
export const Score = defineComponent("score", {
|
|
wins: 0,
|
|
losses: 0,
|
|
pushes: 0,
|
|
chips: 100,
|
|
});
|
|
|
|
export const Bet = defineComponent("bet", {
|
|
amount: 10,
|
|
});
|
|
|
|
/** Current phase of the game. */
|
|
export type Phase = "betting" | "playerTurn" | "dealerTurn" | "roundOver";
|
|
|
|
export const GamePhase = defineComponent("gamePhase", {
|
|
phase: "betting" as Phase,
|
|
message: "",
|
|
});
|