Blackjack Premium - Component API
Blackjack Premium Component API
Complete reference for components, hooks, and game engine APIs in Blackjack Premium.
React Components
Game Component
Main game container component
<Game initialBalance={1000} minBet={10} maxBet={500} onGameEnd={(result) => {}}/>Props:
initialBalance(number) - Starting player balanceminBet(number) - Minimum wagermaxBet(number) - Maximum wageronGameEnd(function) - Callback when game ends
Card Component
Individual playing card display with animations
<Card suit="♠" rank="A" faceUp={true} animated={true}/>Props:
suit(string) - ♠ ♥ ♦ ♣rank(string) - A, 2-10, J, Q, KfaceUp(boolean) - Show or hide cardanimated(boolean) - Play entrance animation
Hand Component
Display player or dealer hand with value
<Hand cards={[card1, card2]} position="player" showValue={true}/>Props:
cards(Card[]) - Array of cardsposition(“player” | “dealer”) - Hand positionshowValue(boolean) - Display total value
ActionButtons Component
Hit, Stand, Double, Split controls
<ActionButtons canHit={true} canStand={true} canDouble={true} canSplit={false} onHit={() => {}} onStand={() => {}} onDouble={() => {}} onSplit={() => {}}/>BetControls Component
Betting interface with chip buttons
<BetControls balance={1000} currentBet={50} minBet={10} maxBet={500} onBetChange={(amount) => {}}/>Custom Hooks
useGame
Main game state hook
const game = useGame({ initialBalance: 1000, minBet: 10, maxBet: 500});
// Returns:// {// balance: number// currentBet: number// dealerHand: Card[]// playerHands: Card[][]// gamePhase: 'betting' | 'playing' | 'results'// deal: () => void// hit: () => void// stand: () => void// double: () => void// split: () => void// }useHand
Hand evaluation and management
const hand = useHand(cards);
// Returns:// {// value: number// isBust: boolean// isBlackjack: boolean// canSplit: boolean// }useRNG
Random number generation interface
const rng = useRNG();
// Methods:rng.shuffle(deck) // Shuffle deckrng.deal() // Draw random cardrng.verify() // Verify fairnessGame Engine
Deck Management
const deck = new Deck();deck.shuffle(); // Randomize deckconst card = deck.deal(); // Get next cardconst remaining = deck.remaining(); // Cards leftHand Evaluation
const hand = new Hand([cardA, cardB]);const value = hand.getValue(); // 21const isBust = hand.isBust(); // falseconst isBlackjack = hand.isBlackjack(); // trueDealer Logic
const dealer = new Dealer(hand);const shouldHit = dealer.shouldHit(); // booleandealer.playHand(); // Execute dealer turnType Definitions
interface Card { suit: 'spades' | 'hearts' | 'diamonds' | 'clubs'; rank: 'A' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | 'J' | 'Q' | 'K';}
interface Hand { cards: Card[]; value: number; isBust: boolean; isBlackjack: boolean;}
interface GameState { phase: 'betting' | 'playing' | 'results'; playerBalance: number; currentBet: number; dealerHand: Card[]; playerHands: Card[][]; result: 'win' | 'lose' | 'push' | null;}Next Steps
- Getting Started - Install and play
- Game Mechanics - Rules and gameplay
- Integration Guide - Use in your project