Long, long ago, I visited Vegas for the first time and my friend, Patrick, introduced me to Blackjack. I really didn't know what I was doing, but somehow I got a basic blackjack strategy card... probably from the casino. I used the strategy and had a good time. I didn't lose too much money either, so all in all, it was a good trip. It got me thinking though... what is the ideal blackjack strategy. Not that the casino would ever lead its customers astray, but I wanted to calculate it myself.
With some simplifying assumptions (namely that the probability of getting a card does not change), it's actually not that many possibilities to consider. The problem gets much harder if you consider each card drawn changes the ratio of cards in the deck. But if you're playing with a large number of decks, and especially if the house is running a continuous shuffler, this assumption is probably not too bad.
So, this is the program I wrote to solve the blackjack strategy question. It's not my best example of clean code, but it gave me the answer I was looking for. Also included are the results and a card you can print out and take with you on your next Vegas trip!
I have played this strategy myself on several trips, and though I haven't been keeping careful score, I think I'm slightly ahead... which is much better than the expected half cent loss for every dollar played. I hope you have even better luck at the tables! And if you do make it rich, I wouldn't refuse a generous tip. :)