|
-
May 17th, 2008, 03:39 PM
#1
Thread Starter
New Member
Inexperienced programmer needs help.
Well after watching the movie 21 I thought it would be cool to make a little program to help practice card counting rather than rolling out the cards by hand.
Basically what the program is supposed to do is randomly choose cards and flash them on the screen for a second then disappear while keeping the count. 2-5 = +1, 6-9 = 0 10-A = -1
First I have a for loop to go through the deck
then I make sure that all images are .visible = false, this will cause the card that was shown to disappear before the next is chosen.
The issue that I'm having is that the image changes from false to true to false to fast to even see the card so basically what I'm asking for is some help to make a function to delay the visibility from changing so fast.
Thanks
Macdog
-
May 17th, 2008, 04:50 PM
#2
Re: Inexperienced programmer needs help.
Rather than a loop you should use a timer control. You can then choose the rate at which the cards change.
If your struggling post your code.
-
May 17th, 2008, 10:46 PM
#3
Hyperactive Member
Re: Inexperienced programmer needs help.
Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
put this at the very top of the form
put this anywhere you want to make the code pause for half a second, you can change the time of course
so if your loop is showing you a different card everytime through, put in your loop to make it pause 1 second after every card change
Last edited by Philly0494; May 17th, 2008 at 10:50 PM.
-
May 18th, 2008, 11:30 AM
#4
Member
Re: Inexperienced programmer needs help.
Damn.. I wrote a very long reply, and my internet goes away.. When it came back on, my message is gone..
Firstly, its:
2-6 = +1
7-9 = 0
T-A = -1
In the meantime I tried to make a program that could do the exact thing
I think that a good cardcounter should be able to count through a deck of cards in a little under 30 seconds.
To test if a player had counted correctly, you need only to count through 45 or so cards. The reason for this is that when you count through an entire deck, the total value will always be 0.
I would take a deck of .bmp pictures, and use a timer to scan through them..
As practise you can start with using a button.
In this program I have given the opportunity to use more decks than one, because no casinos only use one deck.
VB Code:
Option Explicit Dim varNumberOfDecks As Integer Dim varManuallyDealCards As Boolean Dim varDeck(52 * 6) As Boolean Dim varCardsDealtCount As Integer Dim varCardsSeen As Integer Private Sub cmdDealCard_Click() If Not varCardsSeen = 48 Then Dim Path As String Dim Index As Integer varDeck(0) = True ''''''Load Card''''''' Do Until varDeck(Index) = False Index = Int(Rnd * varNumberOfDecks * 52) + 1 Loop varDeck(Index) = True Path = App.Path & "/Deck/" & Index & ".bmp" picCard.Picture = LoadPicture(Path) ''''''Find Card Value (1, 0 or -1)'''''' Dim varCardValue As Integer Dim varCard As Integer varCard = Index Mod 13 Select Case varCard Case 2 To 6 varCardValue = 1 Case 7 To 9 varCardValue = 0 Case 10 To 12 varCardValue = -1 Case 0 To 1 varCardValue = -1 End Select lblTotalCount.Caption = Val(lblTotalCount.Caption) + varCardValue varCardsSeen = varCardsSeen + 1 lblCardsseen = Val(lblCardsseen) + 1 Picture1.Print varCard & "," & varCardValue End If End Sub
Last edited by Thediabloman; May 18th, 2008 at 11:48 AM.
-
May 19th, 2008, 03:46 AM
#5
Member
Re: Inexperienced programmer needs help.
In the end, I would like to make a entire program that you can both play and train blackjack in.. But here is a training tool for counting cards in Blackjack with one card at a time. You can change the card yourself or let a timer change it for you, with variable speed.
Card Counting Training Tool.rar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|