# Blackjack 21 - Casino Card Game

A feature-rich Blackjack app for iOS built with SwiftUI. Master basic strategy, learn card counting, and enjoy an authentic casino experience — all without risking real money.

![Platform](https://img.shields.io/badge/platform-iOS%2026%2B-blue)
![Swift](https://img.shields.io/badge/Swift-6.2-orange)
![SwiftUI](https://img.shields.io/badge/SwiftUI-✓-green)

## Features

### 🎰 Authentic Casino Gameplay
- Full Blackjack gameplay with all standard actions: Hit, Stand, Double Down, Split, Surrender
- Insurance betting when dealer shows an Ace
- Realistic multi-deck shoe with configurable penetration
- Animated card dealing with sound effects and haptic feedback
- Reshuffle notifications when the cut card is reached

### 🃏 Multiple Rule Variations
| Style | Description |
|-------|-------------|
| **Vegas Strip** | 6 decks, dealer stands on soft 17, double after split, 3:2 blackjack |
| **Atlantic City** | 8 decks, late surrender, re-split aces allowed |
| **European** | No hole card (dealer gets second card after player acts) |
| **Custom** | Configure every rule to your preference |

### 💰 Side Bets
Optional side bets for extra excitement:

**Perfect Pairs** — Bet on your first two cards forming a pair:
- Mixed Pair (different colors): 6:1
- Colored Pair (same color): 12:1
- Perfect Pair (same suit): 25:1

**21+3** — Poker hand from your two cards + dealer's upcard:
- Flush: 5:1
- Straight: 10:1
- Three of a Kind: 30:1
- Straight Flush: 40:1
- Suited Trips: 100:1

### 📚 Basic Strategy Hints
- Real-time strategy suggestions for every hand
- Accounts for game rules (surrender availability, dealer hits soft 17, etc.)
- Learn the mathematically optimal play for every situation

### 🎓 Card Counting Trainer
Professional-grade tools for learning the Hi-Lo system:
- **Running Count** — Live count as cards are dealt
- **True Count** — Adjusted for remaining decks
- **Betting Hints** — Recommendations based on count advantage
- **Illustrious 18** — Count-adjusted strategy deviations

### 📊 Statistics Tracking
- Win rate, blackjack count, bust rate
- Session net profit/loss
- Biggest wins and losses
- Complete round history

### ☁️ iCloud Sync
- Balance and statistics sync across devices
- Settings persist via CloudKit

## Architecture

```
Blackjack/
├── BaccaratApp.swift          # App entry point
├── ContentView.swift          # Root view
├── Engine/
│   ├── BlackjackEngine.swift  # Core game logic, basic strategy, card counting
│   └── GameState.swift        # Observable state machine
├── Models/
│   ├── BetType.swift          # Bet type definitions
│   ├── GameResult.swift       # Hand results and round outcomes
│   ├── GameSettings.swift     # User preferences and rule configuration
│   ├── Hand.swift             # BlackjackHand model
│   └── SideBet.swift          # Side bet types and evaluation
├── Storage/
│   └── BlackjackGameData.swift # Persistence models
├── Theme/
│   └── DesignConstants.swift  # Design system tokens
├── Views/
│   ├── Development/           # Dev-only views (branding, icons)
│   ├── Game/                  # Main game UI components
│   ├── Sheets/                # Modal views (settings, stats, rules)
│   └── Table/                 # Table layout components
└── Resources/
    └── Localizable.xcstrings  # Localization strings
```

## Tech Stack

- **iOS 26.0+** target
- **Swift 6.2** with strict concurrency
- **SwiftUI** with `@Observable` for state management
- **CasinoKit** — Shared package for cards, chips, sounds, and common UI
- **CloudKit** — iCloud sync for game data and settings

## Requirements

- Xcode 16.0+
- iOS 26.0+ deployment target
- Swift 6.2+

## Getting Started

1. Open `CasinoGames.xcworkspace` in Xcode
2. Select the **Blackjack** scheme
3. Build and run on a simulator or device

## Localization

The app supports:
- English (en)
- Spanish - Mexico (es-MX)
- French - Canada (fr-CA)

Strings are managed via String Catalogs (`Localizable.xcstrings`).

## Design System

All UI values are centralized in `DesignConstants.swift`:
- Spacing, corner radii, font sizes
- Opacity and shadow values
- Animation durations
- Semantic color definitions

## Accessibility

- Full VoiceOver support with meaningful labels and hints
- Dynamic Type for scalable text
- Accessibility announcements for game events

## License

This project is proprietary software. All rights reserved.

---

*Built with ❤️ using SwiftUI*

