Skip to content

calebyhan/3d-blackjack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

3D Blackjack Game

A 3D blackjack game built with React, TypeScript, Three.js (via React Three Fiber), and Zustand.

Project Setup βœ…

The project is already scaffolded with:

  • βœ… Vite + React 19 + TypeScript
  • βœ… All dependencies installed (Three.js, React Three Fiber, Drei, React Spring, Zustand)
  • βœ… Folder structure created
  • βœ… TypeScript configured

Next Steps

Option 1: Use the One-Shot Prompt (Recommended)

Open IMPLEMENTATION_PROMPT.md and use it with Claude or another AI to generate all the implementation code at once. The prompt includes:

  • Complete implementation details for all files
  • Code snippets for every component
  • Game logic (deck, rules, dealer AI)
  • Zustand store setup
  • 3D components (Scene, Table, Card, Hand)
  • UI components (Controls, Scores, Status)
  • Styling

Simply copy the contents of IMPLEMENTATION_PROMPT.md and paste it into your AI assistant.

Option 2: Implement Manually

Follow the file structure in IMPLEMENTATION_PROMPT.md and implement each component step by step.

File Structure

src/
β”œβ”€β”€ game/
β”‚   β”œβ”€β”€ types.ts       # Card, Suit, Rank types
β”‚   β”œβ”€β”€ deck.ts        # Deck creation & shuffling
β”‚   β”œβ”€β”€ rules.ts       # Blackjack scoring logic
β”‚   └── dealer.ts      # Dealer AI
β”œβ”€β”€ store/
β”‚   └── gameStore.ts   # Zustand game state
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Scene.tsx      # Main 3D canvas
β”‚   β”œβ”€β”€ Table.tsx      # Green felt table
β”‚   β”œβ”€β”€ Card.tsx       # 3D card component
β”‚   β”œβ”€β”€ Hand.tsx       # Card collection
β”‚   └── UI/
β”‚       β”œβ”€β”€ GameControls.tsx
β”‚       β”œβ”€β”€ ScoreDisplay.tsx
β”‚       └── GameStatus.tsx
β”œβ”€β”€ App.tsx
└── App.css

Running the Project

# Start development server
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

Tech Stack

  • React 19 - UI framework
  • TypeScript - Type safety
  • Vite - Build tool
  • Three.js - 3D graphics
  • @react-three/fiber - React renderer for Three.js
  • @react-three/drei - Useful Three.js helpers
  • @react-spring/three - Physics-based animations
  • Zustand - State management

Game Features

  • βœ… Basic blackjack rules (Hit/Stand)
  • βœ… Single player vs dealer
  • βœ… 3D card rendering with flip animations
  • βœ… Automatic dealer AI (hits on <17)
  • βœ… Score tracking
  • βœ… Win/loss detection

Development Timeline

Estimated 2-hour implementation:

  • Hour 1: Game logic + Zustand store + Basic 3D scene
  • Hour 2: Card components + UI + Polish

Quick Start Guide

  1. Read IMPLEMENTATION_PROMPT.md
  2. Generate all the code using the prompt with an AI assistant
  3. Run npm run dev
  4. Play blackjack at http://localhost:5173

Good luck! 🎰

About

Submission for Claude Mini Hackathon 2025

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •