Skip to content

TurbulentRice/blackjack-basic-strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Blackjack Basic Strategy

A mobile app for learning and practicing blackjack basic strategy for casino play.

๐ŸŽฏ Overview

Clean, simple, ad-free and free-to-use mobile application designed to help players learn and master basic strategy for casino blackjack. Built using React Native and Expo.

โœจ Features

๐Ÿ“Š Learn Mode - Interactive Strategy Chart

  • Complete Strategy Matrix: All hard totals, soft totals, and pairs
  • Color-Coded Display: Visual cues for each action type
  • Interactive Highlighting: Tap cells to highlight row and column
  • Three Sections: Easy tabs to switch between hand types
  • Mobile-Optimized: Fits perfectly on iPhone and Android screens
  • Legend: Quick reference for action colors

๐ŸŽฎ Practice Mode - Hands-On Learning

  • Random Hand Generation: Realistic blackjack scenarios
  • Action Buttons: Hit, Stand, Double, Split
  • Instant Feedback: Immediate correct/incorrect indication
  • Detailed Explanations: Learn why each decision is correct
  • Statistics Tracking: Monitor accuracy and improvement
  • Streak Counter: Stay motivated with fire streaks! ๐Ÿ”ฅ
  • Continuous Practice: Seamless hand-to-hand flow

๐Ÿ“ธ App Screenshots

Learn Mode

Learn Mode screen

Practice Mode

Practice Mode screen

๐Ÿ“ˆ Progress Tracking

  • Real-time accuracy percentage
  • Correct vs. total decisions
  • Current and best streaks
  • Motivation through gamification

๐ŸŽจ Beautiful Design

  • Vegas-inspired green felt aesthetic
  • Gold accent highlights with app logo
  • Professional card display with suit colors (โ™ฅโ™ฆโ™ฃโ™ )
  • Clean, intuitive interface
  • Smooth animations and transitions

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Expo CLI (npm install -g expo-cli)
  • EAS CLI (npm install -g eas-cli) for building

Installation

# Clone the repository
git clone <your-repo-url>
cd blackjack-basic-strategy

# Install dependencies
npm install

# Start the development server
npm start

Development Commands

# Start development server
npm start

# Run on iOS simulator (Mac only)
npm run ios

# Run on Android emulator
npm run android

# Run in web browser
npm run web

# Type checking
npm run type-check

# Linting
npm run lint

# Run tests
npm test

๐Ÿ“ฑ Building & Deployment

Setup EAS (One-time)

# Install EAS CLI globally
npm install -g eas-cli

# Login to your Expo account
eas login

# Configure your project (already done)
# eas build:configure

Build for Testing (Preview Builds)

iOS Preview Build (requires Apple Developer account - $99/year):

eas build --platform ios --profile preview
  • Creates a TestFlight build automatically
  • Share with up to 10,000 beta testers
  • No need for physical device access

Android Preview Build (free):

eas build --platform android --profile preview
  • Creates an APK you can install directly
  • Share the download link with anyone
  • No Google Play account needed

Build for Production (App Stores)

iOS Production Build:

eas build --platform ios --profile production
eas submit --platform ios

Android Production Build:

eas build --platform android --profile production
eas submit --platform android

Installation on Devices

iOS (TestFlight):

  1. Build completes โ†’ Apple automatically creates TestFlight build
  2. Add testers via email in App Store Connect
  3. Testers receive email with install link
  4. Open on iPhone โ†’ Install via TestFlight app

Android (APK):

  1. Build completes โ†’ EAS provides download link
  2. Share link with testers
  3. Open link on Android device
  4. Enable "Install from Unknown Sources" if prompted
  5. Install APK

Sharing with Friends

For iOS Friends:

  • Add their email addresses to TestFlight (in App Store Connect)
  • They'll receive an invitation email
  • Limit: 10,000 external testers

For Android Friends:

  • Share the APK download link from EAS dashboard
  • They can install directly on their devices
  • No limit on testers

๐Ÿ“ฑ How to Use

Learn Tab

  1. View the complete basic strategy chart
  2. Switch between Hard Totals, Soft Totals, and Pairs
  3. Tap any cell to highlight that row and column
  4. Use the legend to understand action colors
  5. Study patterns and memorize decisions

Practice Tab

  1. A random hand is automatically dealt
  2. View dealer's up card and your two cards
  3. Select the correct action (Hit, Stand, Double, or Split)
  4. Get instant feedback with explanation
  5. Review statistics at the top
  6. Continue practicing to improve your skills!

๐ŸŽ“ What You'll Learn

Following basic strategy reduces the house edge to approximately 0.5%, making blackjack one of the best casino games for the player.

  • Hard Totals: Hands without an Ace, or where Ace counts as 1
  • Soft Totals: Hands with an Ace counted as 11
  • Pairs: When to split, when to hit or stand
  • Dealer Considerations: How dealer's up card affects decisions

๐Ÿ› ๏ธ Tech Stack

  • Framework: Expo SDK 54 / React Native 0.81
  • Language: TypeScript 5.3
  • Navigation: Expo Router 6.0 (file-based routing)
  • State Management: React Context
  • Testing: Jest + React Native Testing Library
  • Build System: EAS Build
  • Styling: React Native StyleSheet with custom theme system

๐Ÿ“‚ Project Structure

blackjack-basic-strategy/
โ”œโ”€โ”€ app/                    # Screens (Expo Router)
โ”‚   โ”œโ”€โ”€ (tabs)/            # Tab navigation
โ”‚   โ”‚   โ”œโ”€โ”€ _layout.tsx    # Tab layout with logo header
โ”‚   โ”‚   โ”œโ”€โ”€ index.tsx      # Learn screen (strategy chart)
โ”‚   โ”‚   โ””โ”€โ”€ practice.tsx   # Practice screen (game)
โ”‚   โ””โ”€โ”€ _layout.tsx        # Root layout with providers
โ”‚
โ”œโ”€โ”€ components/            # Reusable UI components
โ”‚   โ”œโ”€โ”€ AppLogo.tsx        # App logo component
โ”‚   โ”œโ”€โ”€ Card.tsx           # Playing card display
โ”‚   โ”œโ”€โ”€ Hand.tsx           # Multi-card hand
โ”‚   โ”œโ”€โ”€ ActionButton.tsx   # Action button with animations
โ”‚   โ”œโ”€โ”€ ActionButtons.tsx  # Button grid
โ”‚   โ”œโ”€โ”€ ChartCell.tsx      # Strategy chart cell
โ”‚   โ”œโ”€โ”€ ChartLegend.tsx    # Action legend
โ”‚   โ”œโ”€โ”€ ChartTabs.tsx      # Animated tab selector
โ”‚   โ”œโ”€โ”€ StrategyChart.tsx  # Strategy chart grid
โ”‚   โ”œโ”€โ”€ FeedbackMessage.tsx # Result feedback
โ”‚   โ”œโ”€โ”€ StatBar.tsx        # Statistics display
โ”‚   โ””โ”€โ”€ Screen.tsx         # Screen wrapper
โ”‚
โ”œโ”€โ”€ constants/             # Constants and configuration
โ”‚   โ”œโ”€โ”€ basicStrategy.ts   # Complete strategy matrix
โ”‚   โ”œโ”€โ”€ gameRules.ts       # Game configuration
โ”‚   โ”œโ”€โ”€ colors.ts          # Color palette
โ”‚   โ””โ”€โ”€ theme.ts           # Design system (with web-compatible shadows)
โ”‚
โ”œโ”€โ”€ contexts/              # React Context providers
โ”‚   โ””โ”€โ”€ PracticeContext.tsx # Practice game state
โ”‚
โ”œโ”€โ”€ types/                 # TypeScript definitions
โ”‚   โ””โ”€โ”€ index.ts           # All type definitions
โ”‚
โ”œโ”€โ”€ utils/                 # Utility functions
โ”‚   โ”œโ”€โ”€ cardUtils.ts       # Card & deck operations
โ”‚   โ”œโ”€โ”€ handUtils.ts       # Hand evaluation
โ”‚   โ”œโ”€โ”€ strategyUtils.ts   # Strategy lookups
โ”‚   โ”œโ”€โ”€ practiceGame.ts    # Practice logic
โ”‚   โ””โ”€โ”€ chartUtils.ts      # Chart data conversion
โ”‚
โ”œโ”€โ”€ assets/                # App assets
โ”‚   โ”œโ”€โ”€ icon.png           # App icon (device)
โ”‚   โ”œโ”€โ”€ adaptive-icon.png  # Android adaptive icon
โ”‚   โ”œโ”€โ”€ logo.png           # In-app logo
โ”‚   โ”œโ”€โ”€ splash.png         # Splash screen
โ”‚   โ””โ”€โ”€ favicon.png        # Web favicon
โ”‚
โ”œโ”€โ”€ __tests__/             # Test suites
โ”‚   โ”œโ”€โ”€ handUtils.test.ts
โ”‚   โ””โ”€โ”€ strategyUtils.test.ts
โ”‚
โ””โ”€โ”€ docs/                  # Documentation
    โ”œโ”€โ”€ README.md          # Documentation index
    โ”œโ”€โ”€ BASIC_STRATEGY_RULES.md
    โ”œโ”€โ”€ TECHNICAL.md
    โ”œโ”€โ”€ DESIGN_SPECS.md
    โ””โ”€โ”€ DEVELOPMENT_HISTORY.md

๐Ÿงช Testing

The app includes comprehensive unit tests for all game logic:

npm test
# โœ… 52/52 tests passing

Tests cover:

  • Hand evaluation (all edge cases)
  • Strategy lookups (all scenarios)
  • Ace handling (soft/hard transitions)
  • Pair detection
  • Action validation

๐ŸŽฏ Strategy Rules

The app implements the mathematically optimal basic strategy for:

  • Multiple decks (4-8 decks)
  • Dealer stands on soft 17 (S17)
  • Double after split allowed (DAS)
  • Standard 3:2 blackjack payout

These are the most common casino rules. Following this strategy gives you the best odds against the house.

๐Ÿ’ฐ Cost Breakdown

  • Development: FREE (open source tools)
  • Android Distribution: FREE (can distribute APKs directly or use Google Play)
  • iOS Distribution: $99/year (Apple Developer Program - required for TestFlight & App Store)
  • EAS Build Service: FREE tier available, or $29/month for unlimited builds

๐ŸŽจ Design Philosophy

Vegas Elegance Meets Modern Simplicity

  • Clean, uncluttered interface
  • Vegas-inspired color scheme
  • Professional card aesthetics with custom logo
  • Intuitive navigation
  • Instant visual feedback
  • Mobile-optimized for all screen sizes

๐Ÿ“„ License

Private project - All rights reserved

๐ŸŽฐ Acknowledgments

Basic strategy charts based on mathematical analysis of blackjack probabilities by Edward Thorp, Julian Braun, and others. Verified by computer simulations.

๐Ÿ“ž Support

For issues or questions, please refer to the documentation in the /docs folder.

๐Ÿ”’ Privacy


Start learning basic strategy today and improve your blackjack game! ๐Ÿƒโ™ ๏ธ

Made with โค๏ธ for blackjack enthusiasts

About

Mobile app to help you learn blackjack basic strategy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published