This .NET MAUI implementation of the classic card game of Blackjack is a simple yet interactive application inspired by classic casino gameplay. The project focuses on core game logic, object-oriented structure, and UI-driven event handling to provide a smooth and fun experience for the user.
Players can draw a card ("HIT") or end their turn ("Stand"), while the dealer (computer) plays automatically based on basic Blackjack rules. The interface of the application shows the real-time hand value of the player, has animations when cards are dealt, and stores a history of past results.
Note: This project was created as part of a school assignment. According to the institution's academic integrity policy, the source code cannot be shared publicly. However, the logic of the program as well as demonstrations of the interface and functionality are below. Special thanks to @aybarsiya for designing the CardView and CardViewContainers utilized in this project.
| Class | Description |
|---|---|
BlackjackPlayer |
Inherits from Player and handles hand value calculation and decision logic for the dealer bot |
BlackjackGame |
Inherits from CardGame and manages player and dealer turns, draws cards, and determines the winner |
BlackjackPage |
The main UI page that connects the backend logic with MAUI controls (buttons, card containers, and alerts) |
Each card contributes to the running total:
- Aces = 1, Face cards = 10, others = their rank value
GetHandValue() calculates the player's total hand value
MakeDecision() controls the decision making for the dealer bot:
- Hits if the total is under 17
- Stands if the total is 17 or above
Initializes the player and dealer
Handles the dealer's turn automatically through repeated Hit actions until the hand value is 17 or above
DetermineWinner() compares the hand values of the player and dealer:
- If a hand is greater than 21 -> Bust
- Whoever has the higher hand (after checking for busts) wins
- When the hands are equal -> Tie
- Deals two cards to player and dealer (only one dealer card shown)
- Resets containers, buttons, and score displays
- Draws a card for the player
- Updates score
- If score > 21 -> Player busts -> Dealer wins.
- Reveals all dealer cards.
- Runs dealer logic via
PlayDealerTurn() - Displays final result and both hand values
- Each completed game (player vs dealer result) is logged in an ObservableCollection
- The most recent results appear at the top
The MAUI XAML layout features:
- Card containers for player and dealer hands
- Buttons for Hit / Stand / New Game
- Animated card dealing using fade and scale effects
- Background image (
blackjack_background.jpg) for casino theme - Game history list with previous outcomes
Framework: .NET MAUI
Languages: C#, XAML
IDE: Visual Studio 2022
- Add betting mechanics
- Support multiple players locally
- Incorporate smart AI behaviour that uses large datasets to make decisions




