Blackjack Source Code A classic game of 21, where your goal is to get cards totaling up to - but not over - the sum of 21. This was built in a console application.
Home / Projects / Tech Academy / Blackjack

Project DetailsInfo behind this project

Initially the app is in a main menu state, asking for your name and what balance you want to start off with. Since we didn't implement any other game it creates a round of Blackjack, every player is then asked to hit or stay. The player with the highest hand that is not over 21 wins

  • Abstract Player Implementation - There are multiple layers of abstraction, from the base Player class that is tied to each Game object. This lets the BlackjackDealer also be a Blackjack player and able to hit/stay without extra logic in the core game itself
  • Input Validation - Players can interact with the game through a simple text-based interface, which has support to parse any value from a bool to a enum with a custom ReadNumeral extension
  • Card Handling - The game simulates a standard deck of 52 playing cards, with functionalities for shuffling and dealing cards to players and the dealer
  • Scoring System - The game is aware of the Ace card that can either be a one or eleven
  • Error Prevention - Basic error handling ensures that the game gracefully handles invalid user input and other unexpected situations through TryDraw(out) methods, which also helps nested try/catches and makes handling much easier
  • Error Handling - In the event of an error, the application self-reports exceptions (including unhandled/uncaught) onto a SQL Server via ADO.NET

Technologies UsedWhat engines, frameworks and tools were used

C# Programming Language

C# (pronounced Sea-Sharp) is an Object Oriented Programming (OOP) language that was developed by Microsoft in 1999. It is designed to work with the .NET Framework, which provides a wide range of libraries and APIs for tasks such as database interaction, networking, and graphics manipulation. C# is widely used for building Windows applications, web services, and mobile apps.

I utilized C# in this project by writing ..

  • .. creating abstract game, player and dealer classes
  • .. creating a Blackjack game controller, player and dealer (which is also a player)
  • .. wrote a Console Extension allowing to read Enums and Numerals from the console with validation

GitHub (Version Control)

Git is a Version Control System (VCS) used to track changes to a codebase over time. GitHub is a centralized Git service owned by Microsoft that lets developers easily collaborate with each other. GitHub also offers other tools for development such as Boards (named GitHub Projects), Issues and automation.

This project pushed changes to a central repository where I kept C# Projects. It is public, so you can browse through the source code here.