The following tutorial is only some kind of “thought provoking” one: shows you some logic and class structure using enums and dynamically created images with Winform application.

Blackjack is the best game in the casino for multiple reasons, even if you’re a total beginner. With just a little bit of practice, it’s the easiest card game to learn how to play besides War. But the house edge is so much better than War that it would be silly to ever even try War. Also, blackjack is one of the few games in the casino which. Online Blackjack Strategy Trainer. The Blackjack Strategy Trainer is a free blackjack game that teaches basic strategy while you play. You select the exact rules that you want, and the Strategy Coach warns you if you make mistakes. Blackjack Strategy Trainer v1 Blackjack Strategy Trainer v2. Sorry, but the Strategy Trainer requires Flash, and your device doesn’t support that.If you are using a mobile device, you can.

In this excellent video tutorial we will take you through all the elements of how to play Blackjack. This includes all the options that you have as a player.

Maybe I skipped some of the official rules. If so, I’m sorry I’m not a big gambler. This tutorial is not for teaching you Blackjack, but showing you some C# practices.

Here are some of the rules I have implemented:

  • we have a shuffled deck of 52 cards
  • the player starting hand has 2 cards
  • the computer hand has also 2 cards: one of them is visible the other one is not
  • the Jack, Queen and King has the value of 10
  • the Ace has the value of 11 or 1 if 11 would be too much in hand
  • the player starts to draw (official phrase is HIT)
  • the main goal is to stop at 21 (or close to 21)
  • the player can skip the drawing phase (STAY) if the total score is 16 at least
  • if player stays, the computer turn comes
  • first we can see the computer’s second (hidden) card
  • the computer starts to draw using the same rules as ours mentioned before

To show you how to use System.Drawing.Graphics class, I create the images of the cards by cutting 1 big image into pieces. Click on the following image to download it:

I have 3 main classes: Card, Deck and Hand. Of course the form has its own Form1 class.

I also have 2 enums: CardValue and CardSuit. Both enum indexing starts from 1. The CardValue contains the type of the cards (Ace, King, 9, 7, 2, etc.). The CardSuit contains the colors (hearts, spades, etc.).

Blackjack Tutorial App

Create a new class: Card.cs

BlackjackTutorial

Under the class place the 2 enums:

The Card class will have 3 properties, 1 constructor, 1 new method and 1 overridden method. What properties does a card have? Of course its value, its color and its picture. So create the private properties with their public encapsulated fields. The Image property won’t have setter, the value and color setter will have the image loader method:

Free Interactive Blackjack Tutorial

With the constructor let’s create a dummy card with no color and value:

The attached image has the following properties: it’s 392 pixel high and 950 wide. So 1 card is about 97 high and 73 wide. The method has to slice the image depending on the following color from the deck (one color in each row on the image) and depending on the value (the image has the values in ascending order).

And the overridden ToString method, just for fun (not used later in the code):

In the next chapter I’ll show you how to create the class for the Hand and the Deck.

Blackjack Trainer Learn

Blackjack Tutorial App

Blackjack Strategy Trainer App

Rules Of the Game

Gameplay & Strategy: The Hit or Stand game works much like any other blackjack game, but your score is determined by your ability to make correct moves on each hand. After the cards are dealt, you have the option to Hit, Stand, Double, or Split. Because this game is a trainer, it is up to you to add the cards and know whether you are allowed to split or double. An illegal move will be counted incorrect. If your move is legal, it will be determined to be correct or incorrect based on the strategy tables provided on the rules and strategy page. While blackjack strategy does change from casino to casino, most casinos fall under one of two categories: Las Vegas rules or Atlantic City rules. A correct move from either the A.C. or Vegas strategy tables will be accepted as correct.

Easy or Difficult: The game has two modes of play: easy and difficult. In both modes you will be dealt 20 hands, and your final score will be the percentage of correct moves you made. In difficult mode, the hands will by more challenging, and you will only have four seconds to make each decision.

Bonus Round: A player who scores a 100% after the 20 hands will qualify to the bonus round. In the bonus round, you will be given one minute to make as many correct moves as possible. For each correct move you will be awarded one bonus point.

For more info visit the rules and strategy page or post a question on the Hit or Stand message board.

Blackjack Words of Caution

Blackjack Odds: Playing Hit or Stand will improve your blackjack strategy, and increase your chances of winning money. However, unless you count cards, the odds of blackjack are against you, even if you are a perfect player. By chance, the outcome may sway in your favor from time to time; but the rule is: the more you gamble the more money you lose.

Gambling Addiction: Gambling is addictive, really. If you find yourself spending an unreasonable amount of time in casinos, or if you find that gambling is having a negative impact on you life and finances, seek help. There should be nothing embarrassing about it. Visit the Gambler's Anonymous website to learn more.

Counting Cards: While counting cards can put the odds of blackjack in your favor, it requires a huge time commitment. It is difficult to learn, and very time consuming to play. You can learn about counting cards from books on our blackjack book list and from websites on our links page. Please remember that many blackjack books and websites are trying to sell you something. They have incentives to convince you of the ease and profitability of card counting. Also note that online casinos shuffle the deck after each deal, so it is impossible to count cards when playing blackjack online.

Gambling can be fun and harmless, if you expect to lose. View your losses as the ticket price for a night of entertainment.