Tuesday, May 09, 2006

Baccarat Analysis

The game of baccarat is a game that most people find intimidating. It has been portrayed in James Bond movies as a game for the sophisticated and uber upper class. The game is so special, that it is the only game where the casino lets the players deal the cards.

The only decision you have to make
Playing the game is very simple. As a participant, you only have one of three decisions to make per hand. You can either bet with the "player", bet with the "banker" or bet on a tie. Even though the banker or player might draw more cards, once you make your bet the decision-making part of the game is completely out of the picture. Once you make your bet, your fate is set. The people sitting at the table have no influence on the outcome of the game. They cannot tell the player or the dealer to draw or stand.

Game Play
The game play is somewhat simple as well. Two hands of two cards are dealt on the table. One hand represents the dealer's hand and the other represents the player's hand. The card values are all face value, with the face cards representing zero. The object of the game is to get as close to a 9 total as possible. If a hand value is greater than 9, then the first digit of the total is ignored. For example, a hand of 8 and 7 is worth 5.

If the player or dealer is dealt an eight or nine, the game is over. An initial total of 8 or 9 is called a "natural" and no cards are drawn. Both players show their hands. If they both have the same total, then it is a tie. Otherwise, the higher total wins.

If both the player and the dealer have a total of seven or less, then the player acts first. Based on his total he either draws a single card or stands pat. The dealer then acts, drawing a single card or standing based on his hand total and what card the player drew.

Hit or Stand?
Whether the player hits or stands is simple. If he has a 5 or less, he always draws.

The dealer's decision is a little more complicated.
  • If the player did not draw a card, he will stand with a total of 6 and hit with a total of 5 or less.
  • If the banker's total is 2 or less, he always takes an additional card.
  • If the banker's total is 3, then he stands if the player drew a third card and it was an eight, but hits otherwise.
  • If the banker's total is 4, then he hits unless the player drew a 0, 1, 8 or 9.
  • If the banker's total is 5, then he hits unless the player drew a 4, 5, 6, or 7.
  • If the banker's total is 6, then he hits unless the player drew a 6 or 7.
  • If the banker's total is 7 he always stands.

The House Advantage
The house always has an advantage after every shuffle. If you bet on the player hand, then your Expected Value (EV) is -1.36% (for a typical 8-deck game). This means that for every $100 you bet on the player, you will get back $98.64.

So betting on the banker must mean that for every $100 you bet, you will get $101.36, right? Yes and no. When you bet on the banker and win, then the house usually takes a 5% commission on your winnings. So if you bet $100 and win, you only get $195 back, for a net profit of $95. This results in an EV of -1.17%. Betting on the banker in Baccarat is probably the best bet you can get in a casino without learning complicated Blackjack Basic Strategy charts or wagering tons of money on the craps table.

On the other hand, betting the tie bet is one of the worst bets you will find in a casino. Most slot machines in Vegas are in the -2.5% to -7.5% EV range. Betting the tie in Baccarat (which usually pays 8 to 1 when you hit it) on the other hand, has an EV of -14.12%! This is almost three times the negative EV of roulette!

The Analysis
If you think about it, there are not many possible hand outcomes. The cards are only valued from 0 to 9, so you only have to consider the values of 10 different types of cards (the affect of removing a King is the same as the affect of removing a Ten). Also, there are only two hands, that can have at most 3 cards each. This means that there cannot be no more than 1,000,000 possible hands. Since there are many situations where the player or dealer does not take a card, this number is actually much smaller.

If the banker starts with a Jack-9 and the player has a King-Ten, then only four cards (instead of 6) are used and neither participant draws a card (because the banker has a Natural). This means that our field of 1,000,000 possible outcomes has been reduced by 99. If you only look at the possible outcomes, there are only 339,400 possible banker/player hand combinations.

Another interesting factoid is that only certain card combinations are viable. For example, if the first four cards dealt are all fours, then only four cards will be dealt in the hand. Why? Because both the dealer and the player will be dealt a total of 8. Since they both have naturals, there will never be a 5th or 6th card drawn. The same thing is true if there there are three tens and one nine in the first four cards. Either the dealer or the player will have an initial total of nine.

For each discrete hand combination, there are only a few possible outcomes. For example, if we know that only 4 cards are dealt and we know that the four cards are a 6, 8, 9 and a ten, then we know that 12 times the player will win, and 12 times the banker will win -- there are 4 x 3 x 2 x 1 possible hand combinations (24 total) and 12 of them will result in the player winning and 12 of them will result in the banker winning.

Here is the breakdown of the possible outcomes:
Dealer 9, 10 - Player 6, 8 - Dealer wins with a total of 9
Dealer 9, 10 - Player 8, 6 - Dealer wins with a total of 9
Dealer 10, 9 - Player 6, 8 - Dealer wins with a total of 9
Dealer 10, 9 - Player 8, 6 - Dealer wins with a total of 9
Dealer 8, 10 - Player 6, 9 - Dealer wins with a total of 8
Dealer 8, 10 - Player 9, 6 - Dealer wins with a total of 8
Dealer 10, 8 - Player 6, 9 - Dealer wins with a total of 8
Dealer 10, 8 - Player 9, 6 - Dealer wins with a total of 8
Dealer 8, 9 - Player 6, 10 - Dealer wins with a total of 7
Dealer 8, 9 - Player 10, 6 - Dealer wins with a total of 7
Dealer 9, 8 - Player 6, 10 - Dealer wins with a total of 7
Dealer 9, 8 - Player 10, 6 - Dealer wins with a total of 7

Dealer 6, 8 - Player 9, 10 - Player wins with a total of 9
Dealer 8, 6 - Player 9, 10 - Player wins with a total of 9
Dealer 6, 8 - Player 10, 9 - Player wins with a total of 9
Dealer 8, 6 - Player 10, 9 - Player wins with a total of 9
Dealer 6, 9 - Player 8, 10 - Player wins with a total of 8
Dealer 9, 6 - Player 8, 10 - Player wins with a total of 8
Dealer 6, 9 - Player 10, 8 - Player wins with a total of 8
Dealer 9, 6 - Player 10, 8 - Player wins with a total of 8
Dealer 6, 10 - Player 8, 9 - Player wins with a total of 7
Dealer 10, 6 - Player 8, 9 - Player wins with a total of 7
Dealer 6, 10 - Player 9, 8 - Player wins with a total of 7
Dealer 10, 6 - Player 9, 8 - Player wins with a total of 7

If you only look at the possible card combinations that can be dealt, there are only 6958 different situations to look at! This means that if we know the exact composition of the deck, we can just loop through a small set of discrete situations and get the house advantage (or disadvantage) for each bet in just a few cpu ticks.

The Program
What can someone do with this information? Why write a program to figure out which bet to make, of course! I have done it already at the following link. Just input in the composition of the deck and click the "Calculate" button. It will tell you your EV for the banker, player, and tie bet. There are some parameters you can change, but it is best to stick with the defaults (they are the default rules at 99% of all casinos).

Calculating the percentages takes less than a second. Most situations are negative EV, meaning the banker, player and tie bets will lose money in the long run. I orginally developed this program to see if there were any possible card counting exploits that might be used against the game.

There are certain situations where the player has a pretty good advantage, but these situations only come up very rarely. This is much different than blackjack, where positive EV situations come up around quite often.

Once I had the analysis in place, I ran millions of hands through my simulator. My simulator would keep track of the results of several betting strategies (betting a certain amount when you had a disadvantage and betting another amount when you had an advantage), and the results were less than impressive. I read in several articles that baccarat could not be beaten (with reasonable betting limits) with any card counting system and with my analysis, I was able to prove it to myself.

Theoretically, the game can be beaten. In practice, this is not the case. To beat the game, you would most likely have to sit out EVERY hand unless you came across a positive EV situation (probably a few times every few hours), or bet the table minimum on every hand and then bet 100 times this amount (or more) when the deck "gets hot". Following either strategy would most likely get you kicked out of every casino, the same way that blackjack card counters are barred from play.

Wednesday, May 03, 2006

Searching for IM Phisher II: They're Biting!

Shit. This thing is really getting out of control.

I just got my third IM phishing attempt in the last month. It's really sad to see that people are so trusting that they will click a link and proceed to give away vital private info. Didn't you guys read my previous post?

IM Phishing Blog Post

On Monday, I got a call from Adelphia, my local cable company. They told me there was some problem with my auto-billing.

"If you'd like, I can take your credit card info over the phone and we can settle this right now."

I told her, "No, that's OK, I'll just log in to your web site and take care of it myself."

You should NEVER give away private information to a person who initiates communication. It is OK to call your bank and give them the last 4 digits of your SSN, but if some Jack Ass calls you and tells you he works for your bank, why the fuck would you believe him? Just tell him you'll call him back and then call the number published on their web site (make sure you type in the URL yourself!).

It turns out that the Adelphia billing issue was legit and that Adelphia's auto-billing system is a piece of crap. But you should still be skeptical of jerk-offs who call you, email you, IM you, or walk up to your front door and ask for your family jewels.