Is it possible to card count a blackjack computer?

The header picture is a five dollar blackjack machine in Las Vegas (at the Palazzo), and a very good game it is too. I spent quite a few hours playing it (basic strategy). I did see another version of the machine – at Monte Carlo and Mirage, and I actually prefer those machines as they seemed a little slicker, but that is purely a personal preference.

When playing the machine, the question I had was “There are all these people using phones whilst playing blackjack, what is to stop them running an app and card counting?

After looking at the rules, I realised how the casinos have this covered. The computer uses four packs of cards (so 208 cards), and shuffles after 80 cards have been dealt. If you know anything about physical blackjack you’ll know that penetration is around 75%. That is about 75% of the cards are dealt before the cards are shuffled. Although casinos usually use six or eight decks in their shoes, if they used four decks, they would deal about 156 cards before they shoe was shuffled.

The fact that they shuffle when round 38% (80*100)/208)) of the cards have been dealt effectively makes card counting irrelevant. At least, I think it does, I have not done the maths, but it certainly means that any card counting strategy is not as effective if 156 cards were dealt before a shuffle.

But you can’t blame the casinos. The machines fill a need. There are players that want to play blackjack for $5 a hand, whereas all the tables (at least in many of the casinos on the Las Vegas strip) have a starting minimum of $10. Presumably, it is not cost effective to open a physical table with a $5 minimum and so a computer meets that need. At least it does if you don’t have to have somebody man it, which you would if you had to monitor for card counters.

So, whilst it is interesting to look at the card counting potential, it is also good that the casinos, even the higher class casinos, are willing to offer a $5 blackjack game.

As an aside, if I was to offer one suggestion to the manufacturers, I would change the video a little. Not sure how many times I saw the same cocktail waitress with a try of the same drinks and how many times I saw the guy in the red suit (he’s there now, as is the cocktail waitress!) walk up to the bar, look around and then walk off. I saw these images hundreds of times (as they repeat every thirty seconds or so). It can’t be that hard to make the video more interesting?

As a further aside, you might be interested in a paper I wrote on blackjack a few years ago.


I also published this post on LinkedIn.

Videos on the basics of Java

Videos on the basics of Java

Whilst looking through youtube (see my previous posts – here and here – for why I am doing this), I have come across some very nice youtube videos on the basics of Java. A very nice series of videos by Jose Vidal starts from the the basics of Java:

Eclipse Java ‘Hello World’ Introduction Tutorial

… but moves quickly on to topics such as:

Javadoc

Constructors

Java Wrapper Classes

Java Immutable Classes

Java Packages

Java Arrays

Java Expanding Array

Java Selection Sort

Java Multidimensional Array

Java Inheritance Tutorial

Java Polymorphism

Java Reading a CSV file

Java Reading and Writing Binary Files

Java Serializable interface: Reading and writing Objects to a file

Java Arraylist

Java HashSet HashMap Demonstration

Java Generics Tutorial

Java Iterators

Java Building your own Iterator using Inner Classes

Eclipse Tips and Tricks for Beginners Tutorial

Java Set: HashSet TreeSet LinkedHashSet

Jose has many other videos in his collection and if you find the above useful you should check out his youtube channel.

 

Other useful videos

As I have said before, there are many (many, many) youtube videos out there that can help teach the basics of Java. They are too numerous to list, but here are just a few that I have either found helpful, or that I plan to watch later (and I might just keep adding to this list so that all the videos I found useful are kept in one place).

In no particular order.

Iterators Part 1 (Java)

I realise that many of the topics above are very basic for a seasoned programmer but I think that there is also some advanced material there as well (e.g. inheritance, polymorphism, iterators etc.), so hopefully it will be of interest to a wide variety of people.

I can certainly say (from my own persepctive) that to get your head around this in MFC/VS/C++ would certainly be a lot mor work (for me anyway).

The football prediction project

You can read more about this project by looking at the posts for this football prediction project.

Blackjack in Java

Whilst looking through youtube (see my previous posts – here and here – for why I am doing this), I came across a very nice resource that showed how to implement Blackjack in Java. I am sure the video’s presenter will be the first to admit that the project is far from complete (for example, there is no double down, no splitting etc.). But that is not the point of the exercise. It was to show how to develop a complete application rather than developing a complete Blackjack player in Java.

The video was very useful. It started from an empty project and added classes as they were needed (Card, Deck, Player) and showed how they all linked together.

To be honest, it did not teach me anything I did not know already about the language syntax (as it is very close to C++) but it was very good to see somebody build a complete application from scratch.

Blackjack in Java

If you want to watch the video, take a look at the video below.

Previous interest in blackjack

Blackjack in Java
Blackjack Table (Downloaded from Google, via Wikepedia Commons – labelled as free to reuse); URL: http://commons.wikimedia.org/wiki/File:Blackjack_board.JPG

I must admit to being a little biased towards this video, as I have published an academic paper on blackjack, which evolved a blackjack player so that it could play blackjack and win money. Of course, we could never use this in a casino (for many reasons!) but it was a fun project and it would be interesting to ressurect the project in Java – but that really is for another day. But I might go and see if I can find some open source classes for a deck of cards, then I could do my version of Blackjack in Java!

The football prediction project

You can read more about this project by looking at the posts for this football prediction project.

Claude Shannon, Edward Thorp, Roulette and Blackjack

I guess many people have heard of Claude Shannon (information theory/entropy).

Perhaps not as many people have also heard of Edward Thorpe? I have known of his work for many years as he was chiefly responsible for making the gambling industry change the rules of blackjack1,2. Not only did he develop something called basic strategy (the best strategy to minimise the house edge) but he also developed card counting (keeping track of certain cards to maximise the chances of winning). Due to Thorp’s work (and also earlier work by Baldwin et al.3) casinos started using more than one deck and shuffling before the end of the shoe (the implement used to hold the cards) so as to minimise the effect of card counters (card counting is not actually illegal, but casinos don’t like it and can ask you to leave).

So, I had known of the work of both Shannon and Thorp but I never realised that they had worked together on roulette. I found this gem in a book I am currently reading4. They worked together on a device to predict what segment of the wheel the ball would land in. I’m not sure of the outcome of their work yet, as I am still reading the book. But, the point is, I had never associated these two scientists as working together; which I found interesting.

References
1: Thorp E.O. (1961) A Favorable Strategy for Twenty-One. Proceedings of the National Academy of Sciences, 47:110-112

2: Thorp E.O. (1966) Beat the Dealer: A Winning Strategy for the Game of Twenty-One. New York: Random House (revised edition of 1962 book)

3: Baldwin R.R., Cantey W.E., Maisel H. and McDermott J.P. (1956) The Optimum Strategy in Blackjack. Journal of the American Statistical Association, 51:429-439

4: Poundstone W. (2005) Fortune’s Formula: The Untold Story of the Scientific Betting System that Beat the Casinos and Well Street, Hill and Wang