Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 11.4 ('Blackjack')
Instant purchase and download via GumRoad!


Simulating Blackjack

How to lose your (virtual) shirt in Vegas

Issue: 11.4 (July/August 2013)
Author: Jens Bendig
Author Bio: When he was young, Jens Bendig was fascinated by three things
Article Description: No description available.
Article Length (in bytes): 34,532
Starting Page Number: 22
Article Number: 11405
Resource File(s):

Download Icon 11405 project.zip Updated: 2013-07-05 00:22:39

Related Web Link(s):


Excerpt of article text...

I could tell you how to lose money in Las Vegas—this article might be more amusing. But I'll leave out the gory details of my two-week Vegas trip that left me $1,000 poorer and instead focus on the blackjack simulator I've written that will help me test out techniques before my next trip to Vegas.

First, I don't recommend anyone play blackjack in a casino, nor do I warn against it. It's the same as with alcohol, motorcycle-riding, or eating sweets. These things can become dangerous, depending on who you are, but they can be fun if you stay in control.

However, if you are not interested at all in this game, you may not want to read further (though we will also discuss the programming technique of using Listeners/Observers).

If you do play blackjack, it might be a good idea to find out about all the little myths or rumors floating about. Techniques like increasing the third bet when losing, always bet flat, leave the table after losing three times in a row, and so on. Curious if these are really true?

To make it easier to do your own research on these questions—without an expensive trip to Vegas—I have prepared a blackjack simulator (see Figure 1). It simulates the game as it is played in Las Vegas. You can implement your own betting strategy, card-counting strategy, or just let it run for fun. The simulator includes the model of the shoe, the dealer, and the gambler. The gambler makes decisions via a decision table, following a basic strategy. I will explain this in more detail in a moment.

...End of Excerpt. Please purchase the magazine to read the full article.