Back to Projects

Software Development

Blackjack Game

Jun 2025

A Blackjack game built with Python and Pygame featuring a persistent four-deck shoe, automated dealer logic, natural Blackjack detection, dynamic Ace scoring, and win/loss tracking.

PythonPygameGame LogicState Management
Blackjack Game project preview

Project Overview

What I built

The Blackjack project was built to practise state management, probability-based game mechanics, and reusable program logic. The application maintains a persistent four-deck shoe across multiple hands while tracking player actions, dealer behaviour, outcomes, and session records.

Challenge

The problem I needed to solve

The program needed to correctly handle dynamic Ace values, natural Blackjack, dealer behaviour, repeated hands, and a multi-deck shoe without incorrectly duplicating cards or resetting the deck after every round.

Approach

How I approached it

I developed structured deck and hand-management logic in Python and Pygame, including hit and stand controls, automatic dealer play, natural Blackjack detection, dynamic Ace scoring, bust handling, win/loss/push tracking, and automatic shoe replenishment when cards run low.

Implementation

Key implementation details

  • Implemented a persistent four-deck shoe that carries remaining cards across multiple hands.
  • Added automatic shoe replenishment when the number of remaining cards becomes low.
  • Implemented natural Blackjack detection for both player and dealer, including Blackjack-versus-Blackjack pushes.
  • Handled dynamic Ace values while calculating the strongest valid hand total.
  • Built hit, stand, dealer draw, bust, win, loss, and push logic with safe event handling.
  • Tracked wins, losses, and draws across repeated rounds through an interactive Pygame interface.