Quick Blackjack Tutorial
Quick Tutorial On Blackjack May 8, 2017 Posted in Betting Strategies by admin. No Comments At this point, the game of blackjack remains synonymous in virtually every segment of the gambling industry. Three Card Poker Introduction. Three Card Poker is one of the earliest and most successful new table games. The concept is simple, the player and dealer each get three cards, the higher hand wins. Color coded to make finding the correct move QUICK and EASY. We link you to the files so you can print them out as often as you wish. Blackjack Casino Rules & Conditions. Lifetime access to listings of blackjack rules being offered in all of the casinos in Las Vegas, Reno, Atlantic City, Lake Tahoe, Macau, China, and more. A step-by-step guide to building your own home poker table for under $300! Easy-to-follow instructions with images, CAD blueprints and instruction video.
Introduction
Every now and then I like to give myself a fun little programming challenge. I'll randomly pick some enjoyable task, like programming a game or blogging engine or what not, and impose a time limit, anywhere from an hour to an afternoon. Such little challenges keep the fun in programming and help me mentally recharge. After spending a week of programming boring data entry forms, such toy projects help remind me why I enjoy computer science and programming!
Anyway, a few months ago I decided to see if I couldn't create a simple online Blackjack game that would allow a single person to come to the site, enter their name and starting bankroll, and play Blackjack against a dealer. Blackjack is a popular casino game where players are playing against the House, which has a pre-defined set of rules. See the Blackjack Wikipedia entry for rules and basic strategy.
I was able to complete the task during an afternoon and thought I'd share it here for a more fun article during this holiday season. The application is created as an ASP.NET 2.0 web application and the complete code can be downloaded from the end of this article. Do keep in mind it was written in about three hours, so there may be some rough edges, but it does allow you to 'create' multiple players, allows for doubling down, and so on. Read on to learn more about the code and technology used to create this game.
Blackjack in a Nutshell
Blackjack is a card game where one or more players sit down at the table, facing off against the House (the dealer). The dealer deals from a dealing shoe that may hold multiple decks of cards to reduce the effect of card counting. Each player starts by making a wager. Then, all players (including the dealer) are delt two cards, with one of the dealer's cards delt face up and the other face down. The objective is to construct a hand that is closer to 21 'points' than the dealer's, where face cards are worth 10 points, non-face cards worth their natural value, and the Ace being able to be worth either 11 or 1 (it assumes the value that is most beneficial to the hand it is part of). A player 'busts' if their score exceeds 21 and they lose the hand.
After all players have completed their turn, the dealer reveals his face down card and must continually hit until his score is greater than or equal to 17 or he busts. If the dealer busts, all remaining players (those who did not bust) win. If the dealer did not bust, all players who had a lower score lose; those with an equivalent score 'push', meaning they neither win nor lose their wager.
That's the concept behind blackjack. There are some edge cases not discussed here, such as splitting and doubling down and buying insurance, but these are the core rules.
Examining the Game's Workflow
The online blackjack game's workflow can be divided into two sections. First there's the initialization logic. After that, there is a workflow for playing a hand, and this workflow loops until a player reaches $0.00, at which point the system throws an Exception. I'm afraid I didn't have time to address this, so I'll leave this as a challenge for the reader! (Ideally, it should remove the user(s) who hit $0.00, or maybe let them go talk to the burly guy in the corner about a short-term loan. But as it stands, the system blows up if any user reaches $0.00 or less... so there's one incentive to bet conservatively.)
The initialization workflow starts by allowing the user to choose how many decks of cards will be in the dealing shoe. Next, the user is asked to specify the names and starting bankrolls of those players who will be sitting at the table. Each player is modeled by a User
object, which is defined by the User.cs
class in the App_Code
folder. There's also a Game
class that models the game and a GameEngine
class that has methods that operates against the current Game
instance that is stored in session state.
The GameEngine
class has static methods for performing high-level, game-related operations: creating a new game, managing the Game
object in session state, dealing, adding a player to the game, and getting a list of current players. This GameEngine
class is used by an ObjectDataSource on the PickUsers.aspx
page to add new users to the game through a DetailsView and to list the current players in a GridView, as the screenshot below shows.
Once the game's players have been entered, the in-game workflow begins. Each user is shown their current bankroll and asked how much they want to wager. A RangeValidator is used to ensure that the user's bet does not exceed their bankroll.
Next, list of users and their cards are displayed and each user can decide whether they want to hit or stay. (I also implemented doubling down, which is a blackjack variant where you double your bet but get only one card dealt and then your turn ends.) The dealer's one face up card is also shown. After each player makes his moves, the dealer reveals her hand and follows the rules prescribed to the House. The workflow then ends by adjusting the player's bankrolls based on the end results. In the screenshot below, Scott and Jisun busted because they exceeded 21 points. Sam reached 21, while Dave stayed on 19. The dealer ended up with 20, meaning Sam was the only winner!
Clicking the Play Again restarts the in-game workflow, returning to the page where they players may make their bets.
Suggestions for Improvement |
---|
Avid 4Guys reader Tim L. wrote in to share the following suggestion for improving the application: The most universal way to represent cards in text form is [to] represent numbers 2 through 9 with that digit, represent 10 as 'T', and Jack through Ace with the first letter (always [uppercase]). Suit can then be expressed as 'c', 'd', 'h' or 's' (always lowercase).Thanks for the suggestion, Tim! |
The Benefits of this Toy Application
If you decide to download and poke through this application, please do bear in mind that it was purposefully rushed, as I was racing against the clock to complete the project. Consequently, the code may be rather tattered in places, there are likely many spots where it should be refactored, and there are next to no comments. Regardless, I think that this application's code does offer some benefits for those brave enough to plow through it:
- It illustrates using the ObjectDataSource to interface with custom classes - all ASP.NET pages except for the trivial
Default.aspx
use ObjectDataSource controls to interface with the classes in theApp_Code
folder. In all but the game-playing page (PlayHand.aspx
), there's virtually no code in the page as it's all handled by the ObjectDataSource and data Web controls in the page. - It's a working (fun!) game - Next time you're in that meeting with your laptop, but no Internet connection, open this project in Visual Studio and start playing! If your boss catches you or asks what in tarnation you are doing, you can explain you are multi-tasking - attending the meeting and improving your ASP.NET development skills
Happy Programming!
By Scott MitchellFurther Reading:
Attachments
(in ZIP format)
Blackjack is a card game that, along with Roulette and Slots, is one of the most popular games in casinos, both online and offline.
The game is played against a Dealer with the aim of getting a higher score than them and as close to 21 as possible without ‘Busting’ – going over. It is normally played with either 6 or 8 decks of cards and can involve several other Players, all of whom are playing directly against the Dealer.
How to Play Blackjack
Goal of the game
The aim of the game is to beat the Dealer’s hand. You do this by getting your hand as close to 21 as possible without going over this amount and ‘Busting’.
Card values
1. All numbered cards from 2 to 10 are counted at face value.
2. All picture cards (Jack, Queen, and King) count as 10.
3. An Ace can be either 1 or 11.
Setting-up the game
1. Set your budget – We recommend that you take the equivalent of 40 hands to a table before you sit down and start playing.
2. Choose your table – All will have a minimum and maximum amount you can bet, choose one where you can play a hand for around a fortieth of your budget. i.e. if you have a bankroll of £200, you should be looking at playing £5 per hand.
3. Take a seat – You can choose any empty seat at the table, more than one if you wish, and whilst the choice of the seat makes no difference to the outcome of any given hand, the Dealer starts from one end when dealing and the action starts with the first Player to be dealt with and goes around until everyone has finished.
4. Decide how much you would like to change up and play with. These funds are then changed into Chips which are used for the game, you can cash them into real money and walk away at the end of any hand.
Blackjack Rules
1. Place your bet (Remember, if there is room at the table you can play more than 1 hand if you do this you will need to place a bet for each hand you wish to play).
2. You will be dealt 2 cards face up so all other Players and the Dealer can view them.
3. The Dealer normally deals 2 cards for him/her, 1 face-up, and 1 face down. Some versions of Blackjack see the Dealer giving themselves 1 card only at this point (in this case, the 2nd card is dealt face up after all Players have finished their actions).
4. You now need to decide your move on each of your hands. The 2 main choices are Hit or Stand. Hit means receive another card. Stand means you don’t want another card and you are satisfied with what you have. If you Stand, you take no further action in the hand, if you Hit you have the same decision to make again after receiving your next card. There are sometimes 3 other decisions you can make, Double, Split, and Insurance. These will be explained later.
5. After all, Players have completed their hands, the Dealer deals him/herself cards until they have at least 17. It is worth noting that the Dealer has no say in what they do, they have to Hit until they get at least 17, even if all Players have only 15 and the Dealer has 16.
6. Once the dealer has 17, 18, 19, 20, or 21 he will Stand. If he gets 22 or more, the dealer busts, and all Players left in the hand win.
As mentioned above, there are 3 other actions you can sometimes take:
Double Down
This Doubles your bet (you need to place a further bet the same amount as your initial bet) and gives you 1 further card, after which your hand is finished irrespective of what card you get. If you win, you get Double your total bet.
You would normally only Double if you have a 9, 10, or 11 and the Dealer doesn’t have an Ace or a 10 – See the chart below for more details.
Split Cards
If you get 2 cards of the same value, you can Split them and play with 2 hands, each containing 1 of the cards. You will need to pay a bet equal to your initial bet and you will get dealt another card for each hand. You then decide for each hand whether to Hit or Stand. If you get 21 after Splitting, this only counts as 21 and not Blackjack. If you Split Aces, you will only get dealt 1 more card and will then need to Stand. At most casinos, if your 2nd card is the same as the first, you will be allowed to Split again if you wish.
Blackjack Insurance
If the Dealer shows an Ace as their face-up card, all Players have the option of Insurance. If you choose to take Insurance, you will place a bet equal to half your initial bet. If the Dealer then gets Blackjack, so the 2nd card has a value of 10, you will get Double your bet, if not you lose the Insurance bet.
The game ends
1. The hand ends for a Player when either your hand goes over 21 meaning you Bust and lose your bet, or when the Dealer completes their actions.
2. Once the Dealer has completed their action, the payouts take place for all remaining Players still in the hand.
3. If you have a higher total than the Dealer and both totals are 21 or below, you win the hand and get Double your bet. If you and the Dealer have the same total, you Push the hand and get your stake back (Unless one of you has 21 with their first cards, known as Blackjack and the other has 21 with 3 cards or more, in which case whoever has Blackjack will win the Hand). If the Dealer has a higher total than you and both are 21 or less, the Dealer wins and you lose your stake.
4. If the Dealer gets over 21, they Bust and all remaining Players win Double their stake.
5. If you get 21 with 2 cards, you have Blackjack, and if the Dealer doesn’t have 21 with their first 2 cards, you get 1.5 your bet back, as well as the bet itself – equivalent to 2.5 times your bet. If the Dealer also has Blackjack, you Push and get your stake returned.
Blackjack Definitions
Hit
Hit means to draw another card. You can request a hit as many times as you like, but if your total goes over twenty-one, you will bust and lose the hand.
Stand
Stand means the player receives no more cards. The hand as it currently stands will be judged against the dealers.
Split
If you have two cards of the same denomination, a Split button will appear. You can split your cards into two hands and play each hand separately. Your original bet will be duplicated for the new hand. Each hand will be played out as usual except when splitting Aces, where only one additional card per hand is dealt. The split option can only be used once per hand — you cannot split part of a split hand. Any winning 21 obtained after splitting a pair is paid 1-to-1.
Double Down
If you select this option, two things will happen: you will get exactly one more card, your turn will end, and your bet will be doubled.
Surrender
Where permitted (usually on a Blackjack Surrender table), a player may give up his first two cards and lose only one-half his original bet.
Blackjack Payouts
If you win the hand, you will get back your original bet plus the same amount in profit. A hand that consists of an Ace and any ten-value card is called a natural twenty-one, or a natural blackjack (except in the case of a Split hand – see details above). If you win with a natural blackjack, you will be paid off at three-to-two, which means you get your original bet back plus a 150% profit. (So if you bet £50 and win with a natural twenty-one, you get £50 (your bet) plus £75 (your bet plus half of your bet), which totals to £125).
Blackjack Odds
Knowing the blackjack odds will make you a better player and hopefully beat the odds when playing at a casino. If you want to apply any gambling strategy successfully you need to know the odds of the game you’re playing. It goes without saying but we’ll say it anyway: the odds are always in favor of the house. How else do you think they can create billion-dollar mega-casinos in Las Vegas? The Blackjack rules are carefully structured to ensure a house edge. But just how heavily are the Blackjack odds weighed in favor of the house? If you’re a smart player, you know the house edge not as great as one might think – and certainly not insurmountable. You will be able to calculate the following:
- Blackjack odds variations
- Odds of busting
- Player advantage VS dealer up-card
Blackjack Odds Variations
If you want to be serious about playing blackjack you need to be able to calculate your odds for the game you’re playing. The blackjack odds depend on the different types of rule variations. Some online blackjack sites can be unclear about this so you need to pay attention. You can also adjust your blackjack strategy according to these rules. The following table shows the effect that rule variations have on the player’s expected return after taking the proper strategy adjustments. These changes are relative to the standard Atlantic City rules which result in a player’s expected return of -0.43%: 8 decks, dealer stands on soft 17, the player can double on any first 2 cards, the player may double after splitting and the player may split to 4 hands. I will explain some of the rule variations under the table.
Rule Variations | Effect |
---|---|
Five Card Charlie | +1.46% |
Player 21-points is automatic winner | +0.54% |
Early surrender against ace | +0.39% |
Early surrender against ten | +0.24% |
Player may double on any number of cards | +0.23% |
Player may draw to split aces | +0.19% |
Six card Charlie | +0.16% |
Player may resplit aces | +0.08% |
Late surrender against ten | +0.07% |
Seven card Charlie | +0.01% |
Late surrender against ace | +0.00% |
Split to only 2 hands | -0.01% |
No-peek: ace showing | -0.01% |
Player may double on 9-10-11 only | -0.09% |
No-peek ten showing | -0.10% |
Player may not resplit | -0.10% |
Player may not double after splitting | -0.14% |
Player may double on 10-11 only | -0.18% |
Blackjack pays 6-5 | -1.39% |
Player loses 17 ties | -1.87% |
Blackjack pays 1 to 1 | -2.27% |
Player loses 17-18 ties | -3.58% |
Player loses 17-19 ties | -5.30% |
Player loses 17-20 ties | -8.38% |
Player loses 17-21 ties | -8.86% |
Dealer bust on 22 is a push | -9.53% |
Five, six and seven-card Charlie:
a Charlie is an automatic winner, so in a six-card Charlie the player wins on any six-card hand that didn’t bust.
No-peek rule:
The dealer doesn’t peek to see if he has a Blackjack.
How to calculate? You start with the basic Atlantic City rules (-0.43%) and take the rule variations according to the game you are playing to calculate the effect it has on the expected return. For example “Player may double on any number of cards” (+0.23%) and “Player may not resplit” (-0.10%). The expected player return would now be -0.43% +0.23% -0.10%= -0.30%. These blackjack odds (-0.30%) are better for the player than under the standard Atlantic City rules (-0.43).
Blackjack Odds of busting
This table is used to calculate the blackjack odds of the player busting if he hits. This can be useful but I think a smart person already knows that if he hits on 16 he has more chances of busting when he hits on 12.
Hand | % Bust if hit |
---|---|
21 | 100% |
20 | 92% |
19 | 85% |
18 | 77% |
17 | 69% |
16 | 62% |
15 | 58% |
14 | 56% |
13 | 39% |
12 | 31% |
11 or less | 0% |
Player advantage VS the dealers up-card
This table is more useful than the odds of busting because it calculates how much the dealer’s up-card has a positive effect on your odds and the odds of him/her (the dealer) busting.
Dealer Up Card | Dealer bust % | Player Advantage % |
---|---|---|
2 | 35.32% | 9.5% |
3 | 37.58% | 13.6% |
4 | 40.27% | 18.4% |
5 | 42.88% | 23.1% |
6 | 42.10% | 23.8% |
7 | 26.00% | 14.6% |
8 | 23.84% | 5.4% |
9 | 23.34% | -4.4% |
10,J,Q,K | 21.47% | -16.8% |
A | 11.62% | -15.9% |
Blackjack Basic Strategy
For Blackjack Basic Strategy the first thing to look at is the tables below. This has details of what you should do to optimize your chances with every version of your starting hand versus the Dealers visible card.
It is useful if you can remember this as best you can to give you the best possible advantage against the House.
If your hand contains an Ace, look at the 2nd chart, if you have a pair the same value, look at the bottom chart. For all others, the top chart is the place to look.
Blackjack Chart
Use this Blackjack strategy chart as a cheatsheet if you will. It will help you memorize what actions to take with your opening hand.
How to Play Hard Hands:
A hard hand is two starting cards that do not contain an ace.
If you have eight or less, always Hit.
If you have Nine: Double if the Dealer has 3 to 6 – otherwise Hit.
If you have Ten: Double if the Dealer has 2 to 9 – otherwise Hit.
If you have Eleven: Double if the Dealer has 2 to 10, Hit if the Dealer has Ace.
If you have Twelve: Hit if the Dealer has 2 or 3, Stand if the Dealer has 4 to 6, otherwise Hit.
If you have 13- 16: Stand if the Dealer has 2 to 6, otherwise, Hit.
If you have 17 – 21: Always Stand.
How to Play Soft Hands:
A soft hand is when one of your starting hands contains an ace.
If you have Ace 2 or Ace 3: Double if the Dealer has 5 or 6 – otherwise Hit.
If you have Ace 4 or Ace 5: Double if the Dealer has 4 to 6 – otherwise Hit.
If you have Ace 6: Double if the Dealer has 3 to 6 – otherwise Hit.
If you have Ace 7: Stand if the Dealer has 2, 7 or 8. Double 3 -to 6 – otherwise Hit.
If you have Ace 8 or Ace 9: Always Stand.
How to Play Pairs
If you have a pair of Aces or Eights: Always Split.
If you have a pair of twos or threes: Split if the Dealer has 2 – 7, otherwise Hit.
If you have a pair of fours: Split if the Dealer has 5 or 6 – otherwise Hit.
If you have a pair of fives: Double if the Dealer has 2 to 9 – otherwise Hit.
If you have a pair of sixes: Split if the Dealer has 2 to 6 – otherwise Hit.
If you have a pair of sevens: Split 2 to 7 – otherwise Hit.
If you have a pair of nines: Split 2 to 6, and 8 or 9. Stand if the Dealer has 7, 10 or Ace.
If you have a pair of tens: Always Stand.
Strategy Card
Blackjack Tips
Quick Poker Tutorial
Taking Insurance or Even Money
Blackjack is a gambling game, so hedging your bet and playing safe by taking Insurance or even money doesn’t make much sense. In around 7 out of ten instances the Dealer shows an Ace they will not have blackjack, so buying Insurance is a losing long-term strategy and should be avoided.
Splitting Tens when Dealer shows 6
It is always a good idea to maximize your bets when the Dealer shows a 6 as this gives them the biggest chance of Busting, and although you will still expect to make money if you Split (less than $18 extra per $100), you can expect to make over $70 per $100 in bets by doing nothing and Standing on 20. There is a high chance that the Dealer will Bust, so always Stand on a hard 17 or greater.
Standing on 16 when Dealer shows Ace
Standing on 16 when the Dealer has a Ten is not nearly as bad as when the Dealer has an Ace. There is a good chance you will Bust when Hitting on 16, but at least you give yourself a chance to win or push the hand, otherwise in order to win you have to count on the Dealer Busting with an Ace.
Standing on Soft 18 when Dealer shows 6
As mentioned above, the Dealer having a 6 is the best possible hand for the Player as it presents the best chance of the Dealer Busting. You need to, therefore, try and maximize your returns in this situation, so Double and try to take down a bigger win. You can’t bust by taking one more card, so go for it!
Standing on Soft 18 when Dealer shows 9
This is a common one, and although 18 isn’t a bad total in Blackjack, when the Dealer has a 9 there is a high chance they will get a Ten or an Ace (38% of the time to be exact), so give yourself a chance to win and Hit it!
Hitting 11 when Dealer shows Ten
One of the best things about Blackjack is being able to control when to put more money on the table. If you have an 11 and the Dealer doesn’t get more money down by Doubling. You can expect to make about $18 for every $100 you bet, while Hitting will only earn you about $12.
Quick Roulette Tutorial How To Play
Standing on a 12 when Dealer shows 2
This one divides Players a lot as plenty won’t want to risk Busting. However, there are plenty of cards that can save a Dealer who has a 2, so instead of hoping they Bust, take another card and try and get a better total.
Doubling 11 when Dealer shows Ace
Any time the Dealer has an Ace you need to be cautious. Just Hit instead of Doubling, there is no point betting more money against the Dealers Ace.
Hitting 2/2 when Dealer shows 7
Another important one of our Blackjack tips. Twos are actually reasonable cards to start with for a Player. It is likely the Dealer has a “stiff hand” or a 17, therefore Split that 2/2 and make some money.
Hitting 4/4 when Dealer shows 6
There is a consensus that you should Double 4/4 against a 6 to try and maximize your returns as the Dealer has a high chance of Busting, but we would recommend you Split the hand against a Dealers 6. When the Dealer shows a 6, you generally want to play as many hands as possible because the Dealer is likely to Bust.
Related Blackjack Articles:
Counting Cards in Blackjack
Blackjack Multi-Deck vs Single-Deck
Real Money Blackjack Sites