# whats wrong with this program to study blackjack?

• ### Question

• HGJ552

this program simulates a chance game in which the house has an edge of 2%

but the player has the advanatge that knowing the first cards he can chose to go on or surrender

if he surrenders he loses half of the money he bet

but according the first cards he knows the probability of winning varies from 25% to 75%

i suppose theres got to be something wrong at this program but im not sure what

• Changed type Sunday, February 27, 2011 11:18 AM This is a question
Sunday, February 27, 2011 1:19 AM

• Any ideas?

Got a program code so we can check it out?

Thanks!

Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Twitter, Wiki)

The code was at the top (pretty easy to miss, though): HGJ552

I think your problem is the variable "bob". It is never declared and never has any real value, as far as I can tell. Can you please explain what it is for?

Sunday, October 28, 2012 4:54 PM
• This question from Feb 2011 was one of a series by Antonio about probability and the answers to this were broadly covered in related posts before and after this one.

If an uninitialized variable gets through the compiler validation (usually if it is in a Sub) but is used before initialized, it is assumed to be "" or 0 so in this case it is OK, although it is always best to initialize all variables of course.

If by any chance Antonio is still working on this, then I think more details on this particular variant of probability calculation needs more details about exactly what it is supposed to do and what isn't working.

Sunday, October 28, 2012 5:04 PM

### All replies

• Any ideas?

Got a program code so we can check it out?

Thanks!

Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Twitter, Wiki)

Sunday, October 28, 2012 5:28 AM
• Any ideas?

Got a program code so we can check it out?

Thanks!

Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Twitter, Wiki)

The code was at the top (pretty easy to miss, though): HGJ552

I think your problem is the variable "bob". It is never declared and never has any real value, as far as I can tell. Can you please explain what it is for?

Sunday, October 28, 2012 4:54 PM
• You guys realise that this was posted in February 2011? The OP has probably forgotten about it.
Sunday, October 28, 2012 4:57 PM
• This question from Feb 2011 was one of a series by Antonio about probability and the answers to this were broadly covered in related posts before and after this one.

If an uninitialized variable gets through the compiler validation (usually if it is in a Sub) but is used before initialized, it is assumed to be "" or 0 so in this case it is OK, although it is always best to initialize all variables of course.

If by any chance Antonio is still working on this, then I think more details on this particular variant of probability calculation needs more details about exactly what it is supposed to do and what isn't working.

Sunday, October 28, 2012 5:04 PM
• You guys realise that this was posted in February 2011? The OP has probably forgotten about it.

We know. We are going through and cleaning up the forums. I am know an answerer and helping Mr. Price go through and answer all the old answers. If the OP does not return in 7 days, we mark the answer.

Actually, the chances of the OP coming back are not bad if he/she had notifications turned on for the thread: they would get an email and they would probably come back. Of course, we don't subscribe to every thread though. Still, it is a chance.