NOTICE: Attempting to login/signup may not be functional at times. This is due to the deallocation of the database server to avoid incurring cloud service charges as the purpose of this project was to gain experience using different technologies and the cloud. If you would still like to play the game without logging in/signing up, you may use the link below to download the v1.3.0 release. If you would like to login/register and the credential functionalities are not working, please contact me directly via email: [email protected]. Thank you for your interest!
Blackjack console game created using the .NET Framework programmed in C#.
All code is written and owned by me.
To play the game without creating an account, download the Blackjack v1.3.0 Release (Docker image unavailable)
You may choose either of the three methods that best suits you
Download the .ZIP
- Download the latest release .ZIP folder for your respective OS
- Unzip the folder in your desired location
- Run the Blackjack application
Download the Docker Image
- Run the command below in your terminal
docker pull ghcr.io/deepthepatel/blackjack:latest
- Run the command below. The
-it
flag ensures the image runs in interactive mode. You may renameblackjack-container
docker run -it --name blackjack-container ghcr.io/deepthepatel/blackjack:latest
To run the app again with the existing container:
docker start blackjack-container
docker attach blackjack-container
NOTE: After running the attach command, the terminal may appear to do nothing, press
Enter
to see the application running
Clone the Repository
- Clone the project into a folder on your computer
git clone https://github.com/DeepThePatel/Blackjack.git
- Ensure you have the .NET SDK installed
- Open the project folder in a new terminal in Visual Studio
- Download the necessary packages
- Run
dotnet build
- Then
dotnet run
Upon successful login/account creation, player will be notified of their initial balance.
The player will have the choice to pick from three (3) different casinos:
- Las Vegas (Min. $50)
- Monte Carlo (Min. $200)
- Dubai (Min. $500)
Player will also have the option to quit (Q
) the game.
Once the preferred casino is selected, player is prompted to enter a bet within the accepted value range or to exit (Q
) the casino.
Once a valid bet is placed, the program begins to deal the player and dealer their hands in an alternating fashion.
Once the cards are dealt and in the event that the dealer's first card is an Ace (where the player does NOT have a blackjack), the player has the ability to bet Insurance
.
- The player is able to bet up to half of their original bet or
0
if they do not wish to take insurance. - If insurance is taken and the player wins, they will receive their original bet and 2x their insurance.
- If insurance is taken and the player loses, they will lose their original bet and their insurance.
- If insurance is not taken, the game will continue.
Before the program continues, it checks to see whether the player or the dealer have a blackjack.
- If either the player or the dealer have a blackjack, the player will be notified and the round will end.
- In the event that both the player and the dealer have a blackjack, the program will notify the player that there is a
Push
.
Once the cards are dealt, player is shown their hand, the total of their hand, and the dealer's hand.
They are then given the option to Hit
or Double
or Stay
. (Players may only double down once on their first turn. Players will NOT be able to double down after hitting a card)
Hit
: A random card is drawn into the player's hand
If the player does not bust:
- The sum of the player's hand is updated
- Player is given the option to
Hit
orStay
- This process is repeated until the player busts or decides to stay
If the player busts:
- Player is notified they busted along with the total of their hand
- Player's balance is updated
- Player is then redirected to beginning where they can choose to bet again or exit the casino
Split
: Player has the ability to split their hand should their initial drawn cards equal in value.
NOTE: In this version of blackjack, the player is NOT able to double down on split hands.
Double
: Player will be given the opportunity to double their bet and draw only one (1) card.
NOTE: In this version of blackjack, the player is able to double down on any sum of their hand, not only 9, 10, and 11.
Stay
: Player does not draw a card and the program proceeds to play the dealer's hand
Once the player decides to stand with their hand or doubles down without busting, the dealer begins to draw cards.
The dealer will continue to draw cards until they either land on at least a soft 17 or bust, which then the program will determine the winner.
This program follows Bicycle Cards official blackjack rules: https://bicyclecards.com/how-to-play/blackjack
Important Notes:
- The Shuffle and Cut section is ignored as the cards dealt are randomly generated by the program.
- In this version of blackjack, player is able to double down on any sum of their hand, not only 9, 10, and 11.
- In this version of blackjack, player is NOT able to double down on split hands.
- Dealer must stand on soft 17
- Blackjack pays 3:2