Solved

Blackjack or Roulette Simulator

Posted on 2004-08-01
13
3,575 Views
Last Modified: 2009-06-22
Hello experts,

I am trying to find a freeware Blackjack or Roulette simulator that will double down losses (the "Martingale" theory).  I have been using the Sage Blackjack Simulator but the betting strategy is flat.  

My purpose is to simulate with different sized initial bankrolls and different sized inital bets to find the maximum bet ever made, the return, etc.

Any ideas?  I might just try to make my own in Excel, but I was hoping someone had already done this.

-Jess
0
Comment
Question by:jesselavaca
13 Comments
 
LVL 7

Expert Comment

by:wytcom
ID: 11689394
I wrote a blackjack simulator that is used within the casino to train surveillance staff so they can detect card counters.  It deals 2 cards at random and then accepts the users choice of action.  The users choice is evaluated against a standard strategy.  This allows the surveillance staff to practice their ability to recognize play that is based on this standard strategy or not.

It sounds like you are looking to simulate a playing strategy and measure its characteristics.  Perhaps I will see what I can learn about the Martingale theory...
0
 
LVL 1

Author Comment

by:jesselavaca
ID: 11690009
That's correct.  I want to test a Martingale theory (every time you lose, you double your bet)...but I want to test in on thousands of hands in different playing styles to see the maximum bet that would be made over that period.  For example, with a $1000 bankroll and a $1 bet, how many hands on average would it take before you bet $1, 2, 4, 8, 16, 32, 64, 128, 256, 512, and then were wiped out of the bankroll.  

Supposedly, the only things limiting this betting strategy are guts/bankroll/casino table maximums.  I don't want to have to count cards, it's difficult and I prefer to play at a faster pace online.

As background information, I am finding reputable online casinos (an oxymoron?) that have huge incentives for players to sign up or come back (i.e. 200% initial deposit bonus).  I then use Martingale theory to play and use their bonuses/comps to help pad any losses.  I did this playing roulette in Vegas and did quite well, even getting asked to leave one casino unless I would change games or vary my style.

Thanks...

-Jess
0
 
LVL 3

Expert Comment

by:Eduski
ID: 11695910
could you tell me where to find these simulators, i was writing a program in matlab to compute some stats on blackjack, but have since gotten really busy and havne't had a chance to complete it.  thanks
0
 
LVL 1

Author Comment

by:jesselavaca
ID: 11696570
http://www.s-a-g-e.com/
They have a freeware version that is somewhat limited...

-Jess
0
 
LVL 7

Expert Comment

by:wytcom
ID: 11698315
After thinking about this, it turns out that you don't have to simulate the blackjack play to get the answers you want.  It really all depends just on the "house edge".  Based on the particular blackjack rules and the strategy chosen, a house edge value can be determined.  There are lots of places to find this kind of information.  I see that typical house edge values are about 0.50% (depending on the specifics of the rules and the playing strategy adopted.)

So what is needed is a simulation that provides a random sequence of win/loss outcomes by hand based on the house edge value.  This is pretty easy to do.  The input to the program would be the house edge in percent (say 0.50), and the number of games to play.  Then the output would be the overall winnings (based on a base bet of 1) and the max bet placed.

It would make sense to have the simulation always end on a winning hand too.  It wouldn't make much sense to end a session using the Martingale theory on a losing hand.

It would be better to have the simulation repeat the set of games many times and then produce the outputs as a distribution of values.  That way you could see how likely it is to reach a certain level of winnings and maximum bet.

I find this interesting and I think I will go ahead and code this.  It looks like about 4 hours of work total for me so I should have some results to report later this week.

Please let me know if this makes sense to you.
0
 
LVL 1

Author Comment

by:jesselavaca
ID: 11699430
That does make sense...quite a bit of sense.

What do you think you will code in?  VBA/Excel or something more along the lines of SAS?  I've done some basic simulations in Excel, and I might even be able to contribute something of my own here.

-Jess
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 7

Accepted Solution

by:
wytcom earned 300 total points
ID: 11699732
We could do this in VBA/Excel.  (I usually use AWK to create a command line program.  AWK is a precursor to Perl.  But I have been doing some VBA in Excel lately. )  The first step is to write a function to produce a binary win/loss outcome based on the "house edge".  

My understanding is that the probability, p, of a win for the player can be expressed in terms of the house edge h.

h = house edge = (hands played - hands won by player)/(hands played) - 1/2

So if player wins half the hands dealt then house edge is 0.

p = (hands won by player)/(hands played)

So
h = 1/2 - p

Or
p = 1/2 - h

Given h, calculate p.  Then we need a function, getResultOfHand(p),  to return a win/loss or true/false based on probability p.  This can be built using the random number generator.  Say we generate a random number between 0 and 1.  If the value is less than or equal to p we return true, else false.

I can tinker with this some more tomorrow.  Perhaps you can see what you can come up with for the getResultOfHand(p) function in VBA.
0
 
LVL 7

Assisted Solution

by:wytcom
wytcom earned 300 total points
ID: 11700698
I did a quick program in awk tp produce some results.  I ran 100000 experiments with 100 hands dealt per experiment.  I used a house edge of 0.50 %

3 Columns.  
1st shows win amount and number of experiments with this result.
2nd shows max bet and number of experiments with this result.
3rd shows games played and number of experiments with this result.
(We play until have 1st win at 100 or more games.)

Win Loss            Max Bet         Games played
28 1         1048580 1          100 49787
29 1         2097150 1          101 24734
30 1               4 18         102 12606
31 5               8 2133       103 6396
32 14        8388610 1          104 3255
33 17             16 14242      105 1544
34 46             32 25257      106 848
35 67             64 23393      107 428
36 136           128 15575      108 191
37 292           256 9174       109 101
38 411           512 4921       110 48
39 709          1024 2529       111 28
40 1098         2048 1357       112 19
41 1567         4096 709        113 8
42 2193         8192 350        114 2
43 2919        16384 168        115 3
44 3832        32768 97         116 1
45 4867        65536 40         117 1
46 5812       131072 20
47 6697       262144 9
48 7458       524288 5
49 7696
50 8256
51 7852
52 7420
53 6533
54 5954
55 4774
56 3813
57 3003
58 2278
59 1579
60 1092
61 603
62 407
63 275
64 137
65 100
66 45
67 25
68 8
69 4
70 2
71 1
0
 
LVL 5

Assisted Solution

by:lidsky
lidsky earned 200 total points
ID: 11710559
There is no such thing as a Martingale theory. What there is, is a Martingale system for losing money. :-)

I suggest you read this before pluncking your money on the table.

http://krigman.casinocitytimes.com/articles/5315.html
0
 
LVL 1

Author Comment

by:jesselavaca
ID: 11711175
I've been slammed at work and haven't had time to mess around in Excel/VBA, but I did get a chance to read the article.  It was a good read, thanks.

-Jess
0
 
LVL 3

Expert Comment

by:leojl
ID: 11724459

that was indeed a good article ....  

Perhaps I will go to Lost Wages Nevada to test the double-the-bet technique.

It is worthwhile to note that a statistical analysis is not a simulation....

It would be possible to write a good blackjack simulation  in VB6 ....
I think different casinos have some variation of the rules so a simulation
would apply based on a specific set of rules.

leo
0
 
LVL 1

Author Comment

by:jesselavaca
ID: 11763050
Still busy at work...will look again at this later (this week?).  Thanks for the help...

-Jess
0
 
LVL 1

Expert Comment

by:careybarnett
ID: 12755449
Very interesting, Jess.  I'm considering the same thing.  I believe there are a couple of things you've missed in analyzing the problem.  What you have so far is correct, but...

You can't just quit after a win.  The max bet imposed by the casino stops this, and quitting after a win implies an unlimited

The house edge is closer to 5%, if you play straight.  If you use something, tables for instance, to 'improve' your play, you mess the Martingale system.  You can get the house edge down to .03%, apparently, but you have to use doubling down, insurance, and splitting to do it, and then you've messed the Martingale.

Perhaps you'd like to collaborate on this - I have the programming skills.  I am working on applying some futures trading methodologies to a similar theory.  You can reach me at cbarnett-AT-yahoo-DOT-com.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A Guide to the PMT, FV, IPMT and PPMT Functions In MS Excel we have the PMT, FV, IPMT and PPMT functions, which do a fantastic job for interest rate calculations.  But what if you don't have Excel ? This article is for programmers looking to re…
Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now