This project is a complete command-line Blackjack game implemented in Java. It follows the official rules of Blackjack and was designed for the APCS course as a capstone project. The game logic includes card management, betting, dealer behavior, and player decision-making. Built and tested on the CodeHS platform.
- Card.java: Represents a single playing card with suit and rank. Includes support for evaluating Ace as 1 or 11.
- Deck.java: Contains a standard 52-card deck. Supports shuffling and dealing.
- Shoe.java: Represents one or more decks combined. Automatically reshuffles when running low on cards.
- Hand.java: A hand of cards for either a player or dealer. Calculates total value with Ace flexibility.
- Player.java: Holds a player's bankroll and current hand. Implements decision-making like hitting or doubling down.
- Dealer.java: Contains the main game logic: dealing cards, determining outcomes, and handling house rules.
- Game.java: Main driver class. Instantiates Dealer and begins the game loop.
Each class (except Game.java
) includes a corresponding Tester file to validate correctness:
CardTester.java
DeckTester.java
ShoeTester.java
HandTester.java
PlayerTester.java
DealerTester.java
- Accurate Blackjack rules:
- Dealer hits on 16, stands on 17
- Blackjack pays 3:2
- Push when hands tie
- Ace handling (1 or 11)
- Full game loop:
- Betting system with bankroll
- Double down (only on initial hand)
- Game ends when bankroll is depleted
- Enhancements:
- Discard pile tracking and reshuffling
- Multiple hand support
- Bullet-proofing user inputs
All major classes were tested using dedicated tester files. These ensure that methods behave as expected and validate interactions like:
- Drawing cards from a shoe
- Calculating hand values correctly
- Dealer and player decisions
- Handling busts, Blackjacks, and pushes
All classes include Javadoc-style comments and inline documentation for clarity and maintainability.
- The code is designed specifically for the CodeHS environment and may require adjustment to run locally.
- The project uses terminal output only; no GUI was implemented.
This project meets all benchmark requirements:
- UML diagrams (7 classes)
- Javadocs and commenting
- Code organization and Java conventions
- Complete and playable game