## Abstract

Do you like to play cards? Here's a project that will get you thinking about strategy in card games and help you become a better card player.## Summary

Edited by Andrew Olson, Ph.D., Science Buddies

## Objective

The objective of this project is to prove the best strategy for playing Hi-Lo using basic probability. Using computer simulations, you can verify that a particular strategy is correct and show what happens to the odds of winning when "counting cards."

## Introduction

Hi-Lo is a very simple card game. A dealer ("the house") starts with a deck of cards and turns over the top card. The player then guesses whether the next card in the deck will be higher or lower than that card. If the guess is correct, the player wins that round. If the guess is wrong, the house wins that round. If the two cards are equal, it's a tie: neither side wins or loses.

This process of turning over a card and guessing high or low continues through the rest of the deck. The best strategy allows the player to guess correctly more than 70% of the time. How do you go about finding that strategy?

This is where the math comes in! Probability theory is the branch of mathematics that deals with figuring out the likelihood of outcomes. With a simple card game like Hi-Lo, it is pretty easy to calculate probabilities. For example, let's say that the first card turned over was the two of spades (for the purposes of this project, our rule will be that aces are the lowest cards in the deck and kings are the highest cards). It's pretty obvious that our best guess would be that the next card would be higher, right? Probability theory gives us a way to measure just how good that guess is. In order to calculate the probability that our guess is correct, we need to figure out what the possible outcomes are.

A complete deck has 52 cards. We've turned over one card, so that leaves 51 more. Of these remaining cards, 7 (four aces and the other three 2's) are lower than or equal to a 2. That means that 44 (51−7) of the remaining cards are higher than a 2. So the probability of winning this round is 44/51 = 0.86. So our guess should be right 86% of the time in this situation. Another way to say this is that if we played a large number of games, then our guess would be correct 86% of the time (and wrong 14% of the time). From the example above, you can see how to calculate the probabilities for other situations in Hi-Lo. You should also be able to calculate the overall probability of guessing correctly, by averaging the probabilities for each possible first card.

Now let's take the example a little further. Suppose that we're halfway through the deck. If the deck was randomly shuffled at the beginning of the game, the odds should be the same at any point in the game, right? On the other hand, we've already seen the first 26 cards, so shouldn't that give us an advantage to increase our odds of guessing right? The trouble is, it's hard to remember all of the cards we've seen and recalculate the probabilities on the fly. Do you think there is a way to "count" the cards that have already been shown in order to increase the odds of guessing Hi-Lo correctly?

Your goal in this project is to write a computer program that will allow you simulate the game of Hi-Lo in order to test different guessing strategies. You'll compare a strategy that does not make use of information about previously shown cards (i.e., no "card counting") to one or more strategies that do make use of information about previously shown cards (i.e., one or more "card counting" strategies). Before getting started, you should do some background research on probability theory and card counting. Then you can decide on what strategies you would like to compare when you write your test program.

### Terms and Concepts

To do this project, you should do research that enables you to understand the following terms and concepts:

- Probability theory
- Card counting
- The law of large numbers
- QBASIC programming language

Questions

- How would you calculate the probability that a guess of "higher" would be correct if the first card showing is an ace? a three? a four?

### Bibliography

- Drexel University, 2007. Introduction to Probability, Ask Dr. Math. Retrieved September 11, 2007.
- Bogomolny, A., 2007. Probability, Cut the Knot: Interactive Mathematics, Miscellany and Puzzles. Retrieved September 11, 2007.
- Wikipedia contributors, 2007a. Card Counting, Wikipedia, The Free Encyclopedia. Retrieved September 11, 2007.
- Wikipedia contributors, 2007b. Law of Large Numbers, Wikipedia, The Free Encyclopedia. Retrieved September 12, 2007.

## Materials and Equipment

To do this experiment you will need the following materials and equipment:

- Computer with programming software
- Deck of cards
- Calculator

## Experimental Procedure

- Do your background research so that you are knowledgeable about the terms, concepts, and questions above.
- Play the game a bit by yourself. Develop your own strategy for playing the game.
- For example, if the card is greater than 7 you always guess lower, if the card is less than 7 you always guess higher.
- Test it out by taking a deck of cards and keeping track of how often you can correctly guess whether the next card is higher or lower than the one you turned over.
- If you can guess right more than 70% of the time, you've probably got the right strategy.

- Go through and calculate the probability of a successful guess for each of the thirteen different cards (assuming that it is the first card showing). The example in the Introduction shows how to do this.
- Calculate the average of the thirteen probabilities from step 3. This gives you the overall probability of guessing correctly.
- The next thing to do is to create a computer program that can play Hi-Lo so that you can test the effect of "card counting" strategies.
- Pick a programming language. If you've never programmed before, you should start with QBASIC, which is available for free at many internet sites, and is as close to English as any programming language. You'll write a computer simulation that will play thousands of hands of Hi-Lo for each test.
- Your simulation program needs two parts - the first is a shuffling routine to make sure the deck is random. The second is the actual game-playing strategy.
- You'll also have to write some data collection routines so you know how many times you've won or lost, and on which cards.

- Programming the strategy is the most involved part of this project, and can lead to a lot of results about how to play the game. Have fun with it!

## Ask an Expert

## Variations

- The game of Hi-Lo becomes more complex if the player can bet on his or her guesses. The player can use a simple strategy for setting the wager amount to increase his or her expected winnings by 50% compared to always betting the same amount. Can the player also "count cards" and pick up an even larger advantage?
- A more advanced project would examine different betting and card counting strategies to determine the optimal betting strategy in different circumstances. You can also determine how much "the house" should pay to a player who guesses correctly, how many decks "the house" should use to discourage card counting, and how far the dealer should deal into the decks before shuffling and starting over.
- For an even more advanced project, you could investigate how card counting strategies change the odds in a more complicated card game, like blackjack.

## Careers

If you like this project, you might enjoy exploring these related careers:

## Related Links

## Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.#### MLA Style

*Science Buddies*, 20 Nov. 2020, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Math_p044/pure-mathematics/card-counting?from=Home. Accessed 1 Dec. 2022.

#### APA Style

*The Effects of Card Counting on a Simple Card Game.*Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Math_p044/pure-mathematics/card-counting?from=Home