BTW, I would be remiss if I did not mention that while it has been drastically changed by me, the original code for this game came from a Blackjack-like game called Pontoon that I helped it's creator, member GregorBerry, write.
In my first post I mentioned that file so don't worry about it. Also as someone mentioned in the thread you pointed me to, I have a Shuffle sub in the blackjack game's code. Take a look at it and if you have questions then please let me know.
I just noticed that you include VBCARDS! Thanks alot for this. I've been looking for it for a while!
Yeah, I saw you're shuffling routine and I don't understand it. But thanks for looking
Okay, and now that I've played you're BLACKJACK... it's nice but can you add in a "Bet the Bank" option cause after each win I have to click the ^ button a lot to get to the total. I have nearly 3,000 bucks right now. Or, you could set the bet amount back to $5.00 so all I have to do is click the down arrow button once. I would like that change. Otherwise, it's a great game.
I just noticed that the computer reads $1,000.00 as $1.00.
You can see this quickly if you start with a bankroll at $1,000.00 and bet 1,000.00 and then lose. Instead of losing everything the bankroll goes to $999.00 and the betting bar thingy goes all wonky.
Last edited by Google; Mar 21st, 2006 at 02:25 PM.
Martin, don't you think that it's bad programming practice to include a loop that could (in theory at least) never end?
I'm not trying to pick a fight, just curious as to your opinion as you've been doing this a lot longer than me
I assume you are talking about the Do Until mbOKIsChecked loop. I agree that you should not have loops that will never end but I don't believe that is one of them. It runs only as long as the player hasn't hit the OK button or ended the program. However if you have a better solution I'm open to suggestion.
That loop can not go on forever. I don't know how many numbers it generates per second but I'm sure it's a large number and so the chance of not getting an unused number in a few seconds (or less) is vanishingly small.
I think I'll keep my routine the way it is but of course you are welcome to do what ever you want with your copy.
That loop can not go on forever. I don't know how many numbers it generates per second but I'm sure it's a large number and so the chance of not getting an unused number in a few seconds (or less) is vanishingly small.
Vanishingly small...but possible? But seriously, I know very well that that would never happen, but relying on chance is bound to make the process slower than it could be.
I did a speed test with the three shuffle subs mentioned in post #22. I called them Shuffle, ShuffleA and ShuffleB respectively. (3 lots of 3000 repetitions)
Code:
Shuffle
-------
1.83535142036209
1.8560085150487
1.84219167519894
Shuffle A
---------
0.405486451490343
0.406130108714934
0.404578794232228
Shuffle B
---------
0.353086216264916
0.350343130202302
0.355339295916101
I've attached the project I used to do the speed test.
Last edited by bushmobile; Apr 9th, 2006 at 03:36 PM.
I got a subscript out of range error and it points to the line Deck1.ChangeCard = mcolDeck(NextCard).
The values at the time of the error are
Deck1.ChangeCard = 25
NextCard = 52
That line appears in three different places: cmdHit_Click, mnuNewHand_Click and PlayCPUHand. Do you happen to know where it was when you got the error?
To expand on what Marty said, the project is for Classic VB (VB6 to be precise), and you are using VB.Net (VB2008).
Despite both having VB in the name, they are not directly compatible - to use a project from one in the other requires some level of re-writing (often taking more effort than re-creating the project from scratch).
Can I use the Vbcards.ocx control in a VB Express 2008 project? I downloaded it, copied it into my c:\windows\system32 folder, and tried to register it using regsvr32, but I keep getting an error message saying the module could not be loaded. I've double-checked that I'm using the correct folder path in regsvr32, but the other part of the error message says there may be a problem with the ocx.
If this VB6-created control is incompatible with VB2008, does anyone know of a similar control that would be compatible? Thanks.