4/14/2022»»Thursday

Card Counting App Blackjack

4/14/2022
    46 - Comments

You can use the Card Counting tutor below to practice your blackjack card counting skills. Train for 1,2,4,6,or even 8 decks of cards! You can select between the counting methods listed below: To display the next card, click on the pile on the right. To display the previous card. Card Counter Game - Learn Blackjack Card Counting. Card Counter 4 is now available for iOS and Android smartphones and tablets! Completely rewritten from scratch to support landscape. Card counting is a system that experienced blackjack players use to get a profitable advantage over the casino. There are many individual “counts” or systems. Many of them are named after colorful.

Welcome, Dear Readers, to the latest edition of my long-running Modeling Practice series!

The newest game for this series is now available on my sister site BlazorGames.net, and it's a casino favorite: Blackjack!

Blackjack has been a staple of casinos and other gambling parlors since at least 1768, and it remains one of the most popular games today. This is at least partly due to the fact that it is easy to play, can have a considerable amount of strategy, and may even be more winnable than other casino-style games.

Let's model Blackjack as a C# and Blazor WebAssembly program! In the process, we'll discuss how to model complicated real-world scenarios such as this one, what kinds of decisions we need to make, and what sort of compromises we might encounter when trying to make the real world into a computer program.

Rules of Blackjack

If you already know how to play Blackjack, skip to the 'Modeling the Game' section below.

Blackjack is a casino-style card game in which the player(s) attempt to beat a dealer's score while getting as close to 21 points as possible, without going over. It is played with a standard four-suit, 52-card deck. Players do not compete against each other.

In order to know how to model a real-world problem as a program, we need to know the rules and boundaries of the problem. Lucky for us, Blackjack has a well-defined set of rules and regulations, and it all starts with betting.

Betting

Each player makes a bet before the initial deal. The bet can be any amount up to the amount of money they brought with them to the Blackjack table. This bet is lost if the player loses the hand.

The Initial Deal

After bets are made, the dealer then deals two cards to each player (this is called the initial deal) where each card is worth a certain number of points:

  • 2-9 cards are worth the amount shown.
  • Ten, Jack, Queen, and King cards are worth 10 points, and are collectively referred to as 'ten-cards'.
  • Aces are worth either 1 or 11 points, at the player's discretion.

The dealer also receives two cards, the first face-down and the second face-up.

Hit, Stand, and Bust

After each player has two cards, each player may choose to either stand or hit. If the player stands, the dealer will not deal them any more cards; the score they have is now their final score for this hand.

If the player chooses to hit, the dealer deals them another card face-up. The player can keep hitting until they decide to stand or they bust, meaning their cards have a value of more than 21. If the player busts, they lose their bet.

Dealer Behavior

The dealer's turn occurs after all players have had their turns. On the dealer's turn, they flip over their face-down card, and then either hit or stand based on the score of their cards.

The dealer will always behave in the same manner. They must hit on all scores of 16 or less, and stand on all scores of 17 or more.

Naturals AKA Blackjack

A 'natural', AKA a 'blackjack', is an Ace and a ten-card. If a player is dealt a blackjack, it is an automatic win for the player (unless the dealer also has a blackjack) and they receive one-and-a-half times the amount of their bet. So, if the player has bet $20 and is dealt a blackjack, they get their $20 bet back, plus $30 in winnings.

Payouts

After the dealer has had their turn, the dealer will pay out any players that won their hands, and collect the bets of the players that lost their hands. The payouts and collections are calculated according to these rules:

  1. As mentioned above, if the player has a blackjack and the dealer does not, the player receives one-and-a-half times their bet.
  2. If the dealer has a blackjack and the player does not, the player has gone bust, or the dealer's score is higher than the player's score, the player loses their bet.
  3. If the dealer has gone bust, or the player has a higher score, the player wins their bet (so a bet of $20 returns the bet and gets an additional $20).
  4. If the dealer and the player have the same score, no money changes hands. This is referred to as a push.

After the payouts and collections are complete, a new hand can begin.

Special Plays

In addition to the 'normal' gameplay of Blackjack, there are a few special plays the player can make in certain situations.

Double Down

If the player, after the initial deal, has 9, 10, or 11 points showing in their hand, they can choose to 'double down'. This doubles their original bet, and the player receives one additional card. After this, the player is forced to stand.

If the player wins the hand, they get their doubled bet back, plus the doubled bet again. In other words, if the original bet was $20 and the player chooses to double down, their bet increases to $40. If the player wins the hand, they get the $40 bet back, plus an additional $40.

The dealer does not have the option to double down.

Insurance

If the dealer's face-up card is an Ace after the initial deal, the player may choose to make an insurance bet. This bet is up to half the amount of the original bet, and is placed separately of it.

If the player makes an insurance bet, the dealer looks at the face-down card. If it is a ten-card (meaning the dealer has a blackjack), the dealer flips it over, pays the player twice the insurance bet, and (if the player does not also have a blackjack), collects the player's original bet. In this way, the player is 'protected' from the dealer having a blackjack.

To model this, say the original bet was $20 and the dealer is showing an ace. The player can bet up to $10 as an insurance bet. If the dealer has a blackjack, the player 'loses' their $20 bet but gains $20 from the insurance bet. In effect, the player loses no money.

However, if the dealer does not have a blackjack when the player makes an insurance bet, the player immediately loses the insurance bet amount, and play continues normally.

Modeling the Game

Before we can begin creating the C# classes and Blazor components necessary to model Blackjack, we must think about the different parts of the game that we need to model.

There are two ways to do this: top-down, and bottom-up. In the top-down method, we would look at the game as a whole and divide it into pieces, which would then be divided into more pieces, until we couldn't make a meaningful division anymore. This method is useful for situations in which you do not already understand or know about each piece.

This entire series will use the bottom-up method. In this method, we look for objects that do not have any dependencies, model them, and them model the classes that rely on them, so on up the chain until we have modeled each object.

Assumptions

Prior to modeling this game in earnest, we must discuss any assumptions that we are making in order to have an implementable and not-too-complex model.

First, we will assume that we only need to model a single player and a dealer. Since the players do not compete against each other, modeling multiple players would model the real-world more accurately, but make the implementation much more complex.

Second, we will assume that our game will only use a single deck of cards, and will reshuffle that deck when needed. In the real world, casinos use many decks of cards shuffled together to prevent card counting, but since this is not the real world, we will conveniently ignore that fact.

With the assumptions made, we can continue with our bottom-up modeling method. In Blackjack, the smallest object with no dependencies is the playing card, so we will start by modeling the cards and the deck they're drawn from.

Cards and the Deck

We must consider the kinds of attributes each playing card will have in order to model them.

Individual cards will each have a suit (e.g. Clubs, Diamonds, etc.) and a value (e.g. Queen, Jack, Six, etc.). For the purposes of Blackjack, the suit doesn't actually matter, but we will include it because looking at a playing card with no suit makes very little sense. Given that there are a known and limited number of suits and values, we will make both the suit and the value into enumerations.

Per the rules of Blackjack, each card has a score. This is different from the value because of ten-cards; a card's value may be a Queen, but its score is still ten points.

System

Best Blackjack Card Counting App

In short, the card object will need:

  • A suit
  • A value
  • A score

Now let us consider the deck, which we will treat as a fully separate object and not just a collection.

The deck will need an underlying collection of some kind that keeps all the cards currently in the deck; this could be an array or something more complex. The deck will also need to be able to instantiate itself (i.e. create all the cards it needs and add them to the deck) and shuffle itself.

The dealer will need to interact with the deck, primarily to draw cards from it; we will need a method for that. Since the deck must be able to create and store the cards on instantiation, we'll need a method to add cards to the deck as well.

Therefore, the card deck will need:

  • The ability to create all the necessary cards and add them to the deck.
  • The ability to shuffle.
  • Methods to add cards to and draw cards from the deck.

Dealer and Player Commonalities

One of the ways in which I ask programmers to better understand the problem they are trying to model is to consider two objects and find their commonalities, the things they both need to do.

In this spirit, let's consider the player and the dealer. In many ways, they are the same; they each need a set of cards for their hand, they each need to know and show their score, and they each need to know if they are busted.

So, there will be a common object that both player and dealer can inherit from. We'll call that object Person, and it will need the following abilities:

  • Keep a hand of cards
  • Use the hand to calculate a score
  • Use the hand to determine if they are busted

True Score vs Visible Score

There is one thing that might trip us up here: the dealer's true score (i.e. the combined score of all their cards) and their visible score (the combined score of all face-up cards) are different, and the player can only know about the latter. The true score is a commonality, but the visible score is not. We'll need to deal with that in some way.

Dealer Object

We already know that the Dealer object will inherit from the Person object we discussed in the last section. The dealer will need some attributes that are unique to him/her, including:

  • The ability to deal cards to themselves and any player.
  • The ability to flip over their face-down cards.

We now need to consider the special play called Insurance. In that play, they player can make a special bet if and only if the dealer is showing an Ace face-up. So, the dealer needs one additional property:

  • Check if they have an Ace showing face-up.

The game area (which we will discuss later) can check that property to see if the player is allowed to use the Insurance play.

Player Object

The player, like the dealer, will inherit from the Person object and gain their attributes. They will also have certain attributes unique to them, and first and foremost among these is funds.

Funds

Our simulation will assume that each player sits at the Blackjack table with a limited amount of 'starter' funds. These funds allow the player to make bets, and are added to or subtracted from when the player wins or loses.

Bets

Each player has a bet that is unique to him/her that they make at the start of each hand. The player object must track these bets, as well as the special Insurance bet.

Does Card Counting Work Online Blackjack

Change Amount

In our simulation, a 'bet' is money that has not yet left the Player's funds. It is instead being 'risked'. So our player will need to track how their funds will change after the current hand, based on whether they win, lose, or push. We will call this the change amount.

At the end of each hand, the player object uses the change amount to determine what their new funds amount is.

Standing

Players have the option to 'stand', which means they stop drawing more cards. We'll need a property to identify if a player has decided to stand, because at that point it becomes the dealer's turn.

Summary

In short, the player object must store:

  • Their bets, including Insurance and Double Down bets.
  • Their remaining funds.
  • The change amount, the amount by which the player's funds will change after the current hand is complete.
  • Whether or not the player has stood.

The Game Area

In a real-world game of blackjack, blackjack is played at a specialized table. Here, the dealer is in charge of everything, including whether or not players can use one of the special plays.

In our implementation, we don't want to make the Dealer object in charge of notifying the Player about whether or not they can make a special play, because doing so would require a kind of messaging system between the two objects, and that is too complex for this sort of modeling.

Instead, we will introduce a Game Area object that manages situations such as these. The Game Area will need to know

  • What the player's and dealer's scores are.
  • What part of the game is currently happening (betting, dealing, hit/stand, etc.).
  • What special plays are currently available to the player, if any.

Because getting a Blackjack is a big deal in this game, we will want to output a special message to the display when a Blackjack occurs. Therefore the Game Area will want to know:

  • Whether the player or the dealer (or both) has a Blackjack.

Game Status

In Blackjack, certain things can only happen at certain times. For example, if a player has stood, they are not allowed to hit again on the same hand.

To keep track of the game and what state it is currently in, we will need an enumeration of the possible states. As we code up the C# model, we will determine what game states are needed and define them as members of this enumeration.

What I'm Leaving Out: Splitting

In a real-world game of blackjack, if the player is dealt two cards with the same value (e.g. two sixes, two eights, two Aces, etc.) they can choose to 'split' the hand and copy their original bet for the second hand. The two hands are then treated independently, and a player can hit or stand or use special plays on each of them. Payouts are also dealt with separately.

I am leaving this out because modeling this tended to break my design in ways I couldn't resolve nicely. I'm still working on how to model this efficiently and in a way that I can explain simply, which doesn't involve duplicating all the affected attributes and properties or making a collection of collections. If I do get to that point, there will be another blog post about it.

Summary

The model for our Blazor implementation of Blackjack is complete, and here are the objects we need to code:

  • Card, including suits and values
  • CardDeck
  • Person
  • Dealer
  • Player
  • The game status
  • The game area

The objects for the last two items are not clearly defined yet. As we build our C# model, we will determine how best to implement those two objects.

Did I miss something? Is there a better way of modeling Blackjack in C# and Blazor? Or can you make my implementation better? I want to know about all these things! Sound off in the comments below.

In the next part of this series, we will code up the C# model for Blackjack, including each of the objects above and how they interact. Card counters, get ready for some action!

Happy Coding!

Card counting is a system that experienced blackjack players use to get a profitable advantage over the casino. There are many individual “counts” or systems. Many of them are named after colorful professional gamblers from times past.

The 2008 movie “21” bought card counting to the attention of the general public. It followed the true story of members of the MIT blackjack team as they won millions from casinos in LasVegas. This movie also highlighted the key challenge faced by card counters. To make a profit using these systems, you need to bet significantly more when the odds turn in your favor. Casinos are aware of this — and will quickly ban players they believe are counting cards.

This page has everything you need to know to get started with card counting. Below you will find the basics of how it works. Famoussystems, the ideal games for counters and how online blackjack can help you learn to count are also covered below.

How to count cards in blackjack

Blackjack is a game of incomplete information. Players act based on their own two cards and the single dealer up-card. Players must risk busting in many situations, even though the decisions are mathematically correct.

Small cards are the enemy of blackjack players. Values of two through six can make for the trickiest decisions. In fact, if you remove any significant number of small cards from the shoe, blackjack not only becomes easier, the player gets a mathematical edge over the house.

This is where card counting comes in.

Counters track the proportion of small cards to face cards and aces. At a certain point, the deck turns “positive.” The higher proportion of face cards means every hand played will generate long term profit for the player — not the house. This is because profit comes from doubling, splitting and hitting blackjack (natural21). All of these are more frequent when there are more high cards in the shoe.

To take advantage of this edge, counting players must boost their bet size. Without this bet size boost, money spent playing while waiting for the deck to turn positive would cancel out any wins.

There are multiple factors that affect whether a specific game is a candidate for card counting. The number of decks of cards in play, the rules on splitting and doubling down, and how the dealer reacts to a soft 17 all come into play. To get the best from counting cards, you need to find the games with the lowest house edge.

Level 3 card counting systems & true count explained

Card counting systems have three levels of complexity. The simplest systems are Hi-LoCounts. You count low cards as +1 and high cards as -1. The higher the count, the bigger the proportion of high cards to low cards.

Advantage players will increase their bets once a specific count is reached. To be sure that they have an advantage, they need to translate the current total into the “true count” first. This involves dividing the count by the number of decks still in play. If the count is +10, with five decks remaining in a six-deck shoe, then the “true count” is 10/5 = 2. This means games like double-deck blackjack are better for counting. Players do not need to play through those first decks in the shoe while waiting for the true count to be positive.

Level two and level three counting systems are more accurate. They assign +2 to some cards and +1 to others. This splits the twos and sevens from cards three throughsix, with some systems also counting nines differently. There are systems with separate counts for aces. Your bet sizes need to increase in line with the positive count — for example adding a unit every time the true count increases by two points.

If you are new to cardcounting, then a simple Hi-Lo Count is the place to start. Once you have mastered keeping track of the count while playing each hand perfectly and chatting with the other players, you will be ready to move to the next level.

Examples of card counting systems

The systems below range from level one to three. These are five of hundreds of possible systems, giving you an overview of how different systems vary in their complexity.

  • Hi-Lo Count: This is a balanced count and is the first system that new counters use. You add one to the total for each card value from two through six — and subtract one for 10s through aces. Seven, eight and nine are neutral. You then divide this count by the number of undealt decks and round up as needed. You should increase your bets when the count is positive — betting more the larger the positive number that you count. The advantage of the Hi-Lo system is simplicity. Compared with other blackjack counts, Hi Lo card counting does lackprecision.
  • Hi-Opt1 and 2: These systems were developed by LanceHumble, though they can be traced back to the 1960s. There are many more“neutral”cards compared to the Hi-Lo Count. Hi-Opt 1 uses aces, twos, sevens, eights and nines as zero for the count. Three, four, five and six are +1, and 10s through kings are -1. This system works best for single deckgames. Hi-Opt 2 makes 10s through kings -2 on the count, with +2 for fours and fives, +1 for twos, threes, sixes and sevens. Aces, eights and nines are neutral. These are accurate systems, though with single deck games rare (and closely watched), it can be difficult to find a suitable game to use them.
  • Ace-Five System: You will need to double your bet repeatedly as the count increases to make the Ace-Five System work. This is a simple count, involving only aces andfives. Every time a five is dealt, you add one, and every ace you see removes one. When the count is +2, you double your bet. Increasing it again for every +2 that gets added. If the count reverts to +1 or less, you go back to your initial bet size. The key advantage of this system is the simplicity. The always-changing bet size is likely to attract the attention of casino pit bosses.
  • Uston Advanced Count: Ken Uston was a famous card counter, known for his flamboyant lifestyle. His most complex system is the “Uston Advanced Count.” Aces count as zero in this system. Fives are +3; 10s through kings are -3; nines are -1; twos and eights are +1; and threes, fours, sixes and sevens are +2. As with the other systems, you increase your bets in line with how positive the count gets — keeping the number of decks in mind. This system is designed to work best with a separate count of theaces. The complexity means that it is for experienced card counters only.
  • KO Counting System: This system works like Hi-Lo, with an extra feature involving the insurance against dealer blackjack bet. It counts cards two through seven as +1, eight and nine as neutral and 10 through ace as -1. You should increase your bet at +2 or more (based on the true count). At +3 or greater, the insurance side bet becomes profitable and should be taken.

Which blackjack games are best for card counting?

Big casino resorts in Las Vegas, AtlanticCity, downtown Detroit and elsewhere run a wide selection of blackjack games. At the lowest buy-ins (typically $5 and up per hand), the rules give the casino a huge edge over theplayers. Examples include paying 6:5 instead of 3:2 for blackjack, limiting doubles after splits and having the dealer hit on soft 17. These unfavorable rules can easily boost the house edge to 3% or even more. With six or eight decks, getting a true count can be difficult.

Counting

Contrast this with the best games. An ideal setup is a single deck game, with liberal splitting/doubling rules, dealer standing on soft 17, late surrender and 3:2 for blackjack. With a house edge of 0.5% orless, these games are restricted to the high-limit rooms. This type of game is most likely to be closely monitored. Suddenly increasing your bet would be an instant trigger for experienced casino staff to watch closely.

Successful counters look for games with the lowest natural houseedge. They know the basic blackjack card counting strategy perfectly, so as not to give any edge back to the casino in the form of mistakes. If you do not know how to adapt blackjack strategy to subtle differences in the rules, then you are not yet ready to learn card counting techniques.

Blackjack Apprenticeship App

Is counting cards illegal in the US?

Counting cards is legal, unless you are using a mechanical or electronic device to help you keep track of the cards. Casinos do not want card counters in their games. People who are suspected of counting will be asked to leave the casino. Repeat offenses can see players banned — with trespass laws coming into effect if they attempt to return.

In 1979, Ken Uston took a casino in Atlantic City to court, challenging its right to ban “skilled” players. The court found in his favor. Rather than banning players, AC casinos now implement measures to stop card counting from working. They include regularshuffling, limiting players to flat bet sizes on each shoe and not allowing players to join a game mid-shoe.

Elsewhere, casinos will quickly ban players caught counting. This was the reason that the MIT team played in pairs. One player (betting small) would keep count, then signal to the big bet player when the count was positive. This player could then join the table, betting big amounts, while the original counter continued with smaller bets.

Card counting in other casino games

Very few casino games use a shoe containing several decks of cards. Casino poker variations like Caribbean stud or Ultimate Texas Hold ’em have a continual shuffle system, where a fresh shuffled deck is used for each hand. Baccarat does use a shoe, though it is not suitable for counting due to the complex scoring rules. Edge sorting is used in baccarat, though it is considered illegal in many jurisdictions.

This leaves blackjack variations like Spanish 21 and Free Bet Blackjack as the only candidates for card counting systems. Many variations of blackjack have a higher house edge than the main game. Spanish 21 removes 10s from the deck — starting the count on a negative.

Experienced advantage players use card counting to beat optional side bets. This requires a separate understanding of how each side bet works, with a counting system developed separately. Separate aces counts in blackjack can determine when the insurance against dealer blackjack bet becomes profitable.

Card Counting App Blackjack Poker

Is it possible to count cards online?

Online casinos in regulated states have both live dealer and software-based blackjack options. They also have a range of games with different rules and side bets. Add in the game variations based on the 21 concept — and you will find a wide array of choices.

Advantage play through card counting is not possible at online casinos. Software based games use random number generator software to shuffle the cards for every hand. This means no count is possible. Live dealer games that are dealt in real time use eight deck shoes. What they do differently from brick and mortar casinos is reshuffle after around half of the cards are dealt. This makes it hard to spot situations where there is a positive true count. Add to this software that will instantly detect the bet sizing changes associated with counting.

Best

What you can effectively do online is practice your counting skills. There are live dealer rooms at many of the biggest online casino brands, including Golden Nugget and BetMGM. You can enjoy a game and learn to keep score of the count while you play. Starting with simple systems like Ace-Five and Hi-Lo is ideal — you can move on to the more advanced systems as you gain experience.

If you live in a state with legal online casinos, make sure you keep a close eye on the casino bonus and promotion offers. You never know when a bonus aimed at blackjack players will become available.

Wrapping up: Card counting in blackjack

Card counting has been a part of blackjack since the1960s. Famous players including Humble and Uston published books on beating the house. Many of them are now considered among the classics of gambling literature.

Counting cards in blackjack gives you an edge over the house when there are relatively more high cards in the deck. This takes advantage of the player’s option to split, double down and to take insurance against dealer blackjack. Counting systems are graded into three levels, depending on their complexity. More complex systems are more accurate — though harder to use.

There is an Achilles’ heel for card counters. To make your knowledge of the count profitable, you need to significantly boost your bet sizes when the odds are in your favor. These bet size increases are a flag to casino staff to watch your play closely — which leads to card counters being banned. Card counting is not illegal, unless you use a device to help you keep track.

Online casinos are the perfect place to practice your card counting skills. You will not be able to get an advantage from them — as safeguards are in place. Live dealer casinos show a real table, making this the ideal way to find the right card counting system for you ahead of your next visit to a brick and mortar casino.