kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 4th, 2014 at 3:00:46 PM permalink
I wrote a fairly simple blackjack strategy simulator (~500 lines of C#) for my own personal use and I'm looking for another software developer to review it and make sure there's nothing I'm missing. My simulated house edge calculations don't match up with what I see for the rule and strategies I'm using and I can't figure out why.

So, if you're a software developer who can understand C# and knows blackjack and very basic card counting concepts, please let me know!

Thanks.
AcesAndEights
AcesAndEights
  • Threads: 67
  • Posts: 4300
Joined: Jan 5, 2012
March 4th, 2014 at 3:08:34 PM permalink
Quote: kw2107

I wrote a fairly simple blackjack strategy simulator (~500 lines of C#) for my own personal use and I'm looking for another software developer to review it and make sure there's nothing I'm missing. My simulated house edge calculations don't match up with what I see for the rule and strategies I'm using and I can't figure out why.

So, if you're a software developer who can understand C# and knows blackjack and very basic card counting concepts, please let me know!

Thanks.


Can you offer anything in return?
"So drink gamble eat f***, because one day you will be dust." -ontariodealer
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 4th, 2014 at 3:12:46 PM permalink
Mmm... Not really. I can review some of your code I guess? Haha...
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
March 4th, 2014 at 3:34:17 PM permalink
Quote: kw2107

I wrote a fairly simple blackjack strategy simulator (~500 lines of C#) for my own personal use and I'm looking for another software developer to review it and make sure there's nothing I'm missing. My simulated house edge calculations don't match up with what I see for the rule and strategies I'm using and I can't figure out why.

So, if you're a software developer who can understand C# and knows blackjack and very basic card counting concepts, please let me know!

Thanks.



I don't mind taking a look. I've done the same thing for several games and these errors can be a pain to track down.

However, before I look at it:

Do you have the dealer "checking for blackjack" correct? In other words, the dealer checks for blackjack before you play out your hand, and you don't play out your hand if he has blackjack.

Do you have the dealer not playing out the hand when you have busted or have BJ on all your hands?

Are you using a cut card? If you are, are you looking at the house edge numbers for that game including the cut card effect? The cut card effect is SIGNIFICANT for single deck.

Are you sure you are looking at the house edge for the right strategy that you are using (total-dependent vs composition dependent?) Again, this is significant for single-deck.

The first time that I did this for single deck, I had a strange bug with the way that split aces were handled (it was really stupid). It changed my simulated edge by 0.2%. Not insignificant!
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 4th, 2014 at 3:59:21 PM permalink
Thanks for your reply.

Yes I think have the dealer blackjack coded correctly. Yep I have a check for the dealer needing to play out the hand. Although, does the down-card get revealed if the dealer doesn't need to play? That would affect counting I would image...

No I'm not using a cut card, but I'm using 6-8 decks typically. Does it matter as much then?

Just a while ago I discovered a stupid bug where I was allowing hitting after splitting aces... That was a pretty significant change as well.

One odd thing I'm doing though is working out all of the "Split" decisions before playing out any of the hands for that player. Not sure if that matters though. The other odd/lazy thing I'm doing is using the average of 2.71 cards per player to burn through the other players at the table.

For my rules (Dealer hits soft 17, 8 decks, split 4 times, late surrender, double after split) and my counting strategy (Hi-Lo, but only to increase wager, not using it to change decision table) I'm getting about a 0.19% advantage for the player. If I disable the counting (by always betting 1 unit) the house edge is about -0.559% which is pretty accurate I think.
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
March 4th, 2014 at 4:35:49 PM permalink
Quote: kw2107

Thanks for your reply.

Yes I think have the dealer blackjack coded correctly. Yep I have a check for the dealer needing to play out the hand. Although, does the down-card get revealed if the dealer doesn't need to play? That would affect counting I would image...

No I'm not using a cut card, but I'm using 6-8 decks typically. Does it matter as much then?



If you are not using a cut card, how do you decide when to end the shoe?

Quote:

Just a while ago I discovered a stupid bug where I was allowing hitting after splitting aces... That was a pretty significant change as well.

One odd thing I'm doing though is working out all of the "Split" decisions before playing out any of the hands for that player. Not sure if that matters though. The other odd/lazy thing I'm doing is using the average of 2.71 cards per player to burn through the other players at the table.

For my rules (Dealer hits soft 17, 8 decks, split 4 times, late surrender, double after split) and my counting strategy (Hi-Lo, but only to increase wager, not using it to change decision table) I'm getting about a 0.19% advantage for the player. If I disable the counting (by always betting 1 unit) the house edge is about -0.559% which is pretty accurate I think.



That is pretty close to the "realistic results" here: https://wizardofodds.com/games/blackjack/calculator/

Why do you think you have a mistake?
MathExtremist
MathExtremist
  • Threads: 88
  • Posts: 6526
Joined: Aug 31, 2010
March 4th, 2014 at 5:22:48 PM permalink
Most analytical calculations are based on the first hand out of a full shoe, however many decks that is. If you're simulating down to a cut card, your numbers will be different. Try putting in a reshuffle after every hand and see if your results match up with your references. Once you get your basic algorithm working, then you start adding features like playing to 75% penetration or count analysis.
"In my own case, when it seemed to me after a long illness that death was close at hand, I found no little solace in playing constantly at dice." -- Girolamo Cardano, 1563
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
March 4th, 2014 at 7:39:58 PM permalink
Quote: MathExtremist

Most analytical calculations are based on the first hand out of a full shoe, however many decks that is. If you're simulating down to a cut card, your numbers will be different. Try putting in a reshuffle after every hand and see if your results match up with your references. Once you get your basic algorithm working, then you start adding features like playing to 75% penetration or count analysis.



Note that the Wizard's "realistic results" on his HE calculator include the cut card effect.
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 5th, 2014 at 7:17:40 AM permalink
Ah yeah I am using a cut card I guess. Not sure what I thought that meant. I'm going through 75% of the shoe. The reason why I thought something was wrong is that I thought you didn't turn the odds in your favor by counting cards unless you started altering your decision tables based on the count.

I'll just post my code anyways:
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 5th, 2014 at 7:25:37 AM permalink
Quick note, in the PlaceBet method, comment out the "return 1" in order to enable the counting effect.
AcesAndEights
AcesAndEights
  • Threads: 67
  • Posts: 4300
Joined: Jan 5, 2012
March 5th, 2014 at 10:38:29 AM permalink
Quote: kw2107

Ah yeah I am using a cut card I guess. Not sure what I thought that meant. I'm going through 75% of the shoe. The reason why I thought something was wrong is that I thought you didn't turn the odds in your favor by counting cards unless you started altering your decision tables based on the count.


Particularly in shoe games (4+ decks), most of the advantage gained from counting is from bet variation, NOT play deviations. You cannot beat a standard shoe game without increasing your bets in positive counts, no matter how many indexes you use.

Even a good 2 deck game (good meaning good rules and good pen) requires a bet spread, but indexes are more important here.
"So drink gamble eat f***, because one day you will be dust." -ontariodealer
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 5th, 2014 at 12:38:18 PM permalink
Cool. Thanks for the info.
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 5th, 2014 at 1:24:20 PM permalink
According the Blackjack Survey, there are a couple of 2 Deck, DAS, No surrender tables Downtown. Using my code, I'm getting a 1.922% player advantage. I guess I know where I'm headed to on my next trip.
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
March 5th, 2014 at 1:28:29 PM permalink
Quote: kw2107

According the Blackjack Survey, there are a couple of 2 Deck, DAS, No surrender tables Downtown. Using my code, I'm getting a 1.922% player advantage. I guess I know where I'm headed to on my next trip.



You mean, off the top, or with counting?

If you mean off the top, your code is wrong.

If you mean with counting, how wide of a bet spread are you using, and what strategy deviations are you using?

2D S17 DOA DAS noRSA noSurr is a good game. They have it on the strip too (it's my usual game)
kw2107
kw2107
  • Threads: 2
  • Posts: 13
Joined: Mar 4, 2014
March 5th, 2014 at 1:39:44 PM permalink
With counting. The spread is:

(Count = Bet)
< 2 = 1
2 = 2
3 = 4
4 = 8
5 = 10
6 = 12

My original simulation was off because I was dinking around with not betting if the true count is less than -1. I also forgot to modify the tables based on 2 deck though. I ran it again and got a player advantage of about .47%

Any idea what the average penetration in a 2 deck game is?
acw
acw
  • Threads: 6
  • Posts: 54
Joined: Oct 10, 2011
March 7th, 2014 at 3:47:36 PM permalink
Quote: kw2107

One odd thing I'm doing though is working out all of the "Split" decisions before playing out any of the hands for that player. Not sure if that matters though.


Recently I wrote some software that should simulate playing blackjack against the One2Six shuffler and did the exact same lazy thing. Pffff.
I will have to correct this and see how much of a difference it makes.
SnapBack
SnapBack
  • Threads: 13
  • Posts: 35
Joined: Jan 23, 2014
April 9th, 2014 at 8:25:30 PM permalink
Hi Kw. Do you still need help with this? I know C# very well and can help you out.
SnapBack
SnapBack
  • Threads: 13
  • Posts: 35
Joined: Jan 23, 2014
April 9th, 2014 at 8:26:18 PM permalink
I can help you with C#. If you wish I can post some C# code on here for you.
  • Jump to: