Blackjack and Card Counting Forums - BlackjackInfo.com

  #1  
Old September 17th, 2009, 06:39 AM
fabietto fabietto is offline
Member
 
Join Date: Sep 2009
Location: Plymouth, UK
Posts: 12
Default Software simulator and unexpected results

Dear all,

let me briefly introduce myself. My name is Fabio, I'm 27 years old, PhD student in Artificial Intelligence and I recently started to study a few books about blackjack.

What I'm trying to do now is to write a simple blackjack software simulator, in order to test the effects coming from using different counting systems, different way of calculating the true count, etc.

The first "beta" version of my simulator is ready. But I'm getting an unexpected result. It looks like that just applying the basic strategy, without any card counting (betting always the same amount), after 10,000 runs of 1,000 hands each (averaged together) the software is able to score a (very small) profit. According to the literature I didn't expect this result at all. I spent a couple of days debugging my code, but I can't really find any issues. Therefore what I'd like to ask you is if, under the following conditions, is it normal for the player to have a positive edge.

These conditions are:
- 6 decks used;
- dealer stands on S17;
- penetration rate (I guess this is not that important if counting is not used): 75%;
- unlimited splits;
- split aces are considered like every other split hand (you can double, split again or hit as many cards you want);
- double allowed on any two starting cards and after any split;
- no surrender;
- no insurance;
- natural pays 3-to-2 (before paying, the dealer checks for blackjack if he has a T-valued or an A card exposed).

Thanks in advance to anybody who would like to spend few minutes helping me...

Last edited by fabietto; September 17th, 2009 at 06:44 AM.
Reply With Quote
  #2  
Old September 17th, 2009, 07:20 AM
johndoe johndoe is online now
Executive Member
 
Join Date: Aug 2008
Posts: 1,137
Default

Well, there's clearly a bug somewhere, but I'm not sure what we can do to help without seeing your code. With the rules you state you should be in the 0.16% ballpark house edge. (Not sure off-hand what unlimited splits give you.)

The number of rounds you're simulating is on the small size; go to 1 billion at least. 10M is ok for testing but not accurate enough to draw real conclusions.
Reply With Quote
  #3  
Old September 17th, 2009, 07:29 AM
fabietto fabietto is offline
Member
 
Join Date: Sep 2009
Location: Plymouth, UK
Posts: 12
Default

Quote:
Originally Posted by johndoe View Post
Well, there's clearly a bug somewhere, but I'm not sure what we can do to help without seeing your code. With the rules you state you should be in the 0.16% ballpark house edge. (Not sure off-hand what unlimited splits give you.)

The number of rounds you're simulating is on the small size; go to 1 billion at least. 10M is ok for testing but not accurate enough to draw real conclusions.
Thank you very much for your prompt reply, John.

What was important for me was to have a confirmation that the result I'm getting are clearly wrong. I didn't want to flood with C++ code a blackjack forum (particularly with my first post ), but if you really insist I can quickly prepare a pseudo-code scheme of the main() of my application and post it here...

PS: do you really think that 10,000 runs are not enough? Of course it's not the best possible approximation ever, but my feeling, up to date, is that the graphs of the average results gathered from these simulation are quite smooth even with "just" 10,000 runs. Is it typical for blackjack simulators to work on such a higher magnitude?
Reply With Quote
  #4  
Old September 17th, 2009, 07:51 AM
QFIT QFIT is offline
Executive Member
 
Join Date: Jul 2005
Posts: 1,911
Default

I ran a quick 5 billion rounds and came out with a house edge of .18%.
Reply With Quote
  #5  
Old September 17th, 2009, 08:21 AM
fabietto fabietto is offline
Member
 
Join Date: Sep 2009
Location: Plymouth, UK
Posts: 12
Default

Hi guys,

as I announced before, I post here the pseudo-code of the main function of my simulator.

Code:
place the bet
deal the first cards
if the dealer has an ace exposed offer insurance
check if player has been dealt a natural
	yes:
		check if the dealer has been dealt a natural:
			yes:
				check if the insurance has been bought:
					yes:
						pay insurance
				push
			no:
				pay blackjack 3-to-2
	no:
		check if the dealer has been dealt a natural:
			yes:
				check if the insurance has been bought:
					yes:
						pay insurance		
				hand ends
			no:
				play the hand regularly
I'm not an expert of the game, so my guess is that I'm doing something wrong implementing the game order itself. Debugging the code, in fact, I can see that the basic strategy works perfectly, both for soft and hard hands, as well as the splits and the doubles look alright.

I'm not really sure about how I manage the blackjacks. Is it ok to check for the dealer's blackjack before the hand starts even if the player doesn't have a natural? Or this is typically done only when an ace is exposed and therefore the insurance has been previously offered (i didn't mention the insurance before because at the moment I've set the simulator for buying it with probability 0.0)? I'm pointing out the management of naturals because modifying my simulator for paying them 2-to-1 instead than 3-to-2 the results become much more similar to what I was expecting.

It's really weird when you're looking for a bug that you can't find... :-/

Last edited by fabietto; September 17th, 2009 at 08:25 AM.
Reply With Quote
  #6  
Old September 17th, 2009, 09:25 AM
johndoe johndoe is online now
Executive Member
 
Join Date: Aug 2008
Posts: 1,137
Default

The logic looks right to me. Though usually it's the dealer that checks for BJ first. But if you have one player it doesn't matter.

In the most common games, the dealer checks for BJ before anything is played (if an A or 10 is showing), and if he has a natural, the hand ends right there.

But why would making the payout 2-1 give you better results? Doing that would make even more profit for the player, which is even more wrong. You should see a loss, not a profit.
Reply With Quote
  #7  
Old September 17th, 2009, 09:42 AM
Sonny's Avatar
Sonny Sonny is offline
Moderator
 
Join Date: Mar 2006
Location: Los Angeles, CA
Posts: 4,268
Default

Make sure that when you split aces and get a ten that the program does not pay 3:2 for that hand. That mistake would decrease the house edge by a little over 0.22%, which would give your player a slight advantage.

-Sonny-
__________________
It's not the size of your bankroll, it's how you leverage it!
Reply With Quote
  #8  
Old September 17th, 2009, 09:44 AM
fabietto fabietto is offline
Member
 
Join Date: Sep 2009
Location: Plymouth, UK
Posts: 12
Default

Quote:
Originally Posted by johndoe View Post
The logic looks right to me. Though usually it's the dealer that checks for BJ first. But if you have one player it doesn't matter.

In the most common games, the dealer checks for BJ before anything is played (if an A or 10 is showing), and if he has a natural, the hand ends right there.

But why would making the payout 2-1 give you better results? Doing that would make even more profit for the player, which is even more wrong. You should see a loss, not a profit.
Thanks for the explanation. It looks like you don't believe that modifying my code in that way (checking for dealer's BJ before the player can act) would be enough to make my code working, but I'll give it a try anyway...

You're right on the last point. I was wrong in my previous post, since on that test I modified the pay-out from 3-to-2 to 1-to-1 and not to 2-to-1 as mentioned before.
Reply With Quote
  #9  
Old September 17th, 2009, 09:48 AM
fabietto fabietto is offline
Member
 
Join Date: Sep 2009
Location: Plymouth, UK
Posts: 12
Default

Quote:
Originally Posted by Sonny View Post
Make sure that when you split aces and get a ten that the program does not pay 3:2 for that hand. That mistake would decrease the house edge by a little over 0.22%, which would give your player a slight advantage.

-Sonny-
Thanks for your input, Sonny. Unfortunately I think that this is not the case, since I do all the checks for the naturals before actually "playing" the hand (i.e. hit/stand/double/split/etc). But I'll give it a look.
Reply With Quote
  #10  
Old September 17th, 2009, 10:14 AM
fabietto fabietto is offline
Member
 
Join Date: Sep 2009
Location: Plymouth, UK
Posts: 12
Default

In case someone could find a mistake that I can't really see, I'm attaching to this post one of the history files generated by my software. I've to say that I'm really getting crazy trying to figure out what is going on!

PS: of course I don't pretend anybody to help me, but every bit of help would be greatly appreciated!

PPS: I'll publish on line the source code for the simulator (as I've always done for all my softwares) whenever it will be working. So, maybe the efforts we're spending on it will be helpful for somebody in the future...
Attached Files
File Type: zip gameHistoryRun_0.txt.zip (14.9 KB, 77 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:39 AM.


Forum Software vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 2005-2010 Bayview Strategies LLC