Results 1 to 5 of 5

Thread: Inexperienced programmer needs help.

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    1

    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

  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    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.

  3. #3
    Hyperactive Member Philly0494's Avatar
    Join Date
    Apr 2008
    Posts
    485

    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

    Code:
    Sleep (500)
    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
    Code:
    Sleep (1000)
    in your loop to make it pause 1 second after every card change
    Last edited by Philly0494; May 17th, 2008 at 10:50 PM.

  4. #4
    Member
    Join Date
    Mar 2008
    Posts
    42

    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:
    1. Option Explicit
    2. Dim varNumberOfDecks As Integer
    3. Dim varManuallyDealCards As Boolean
    4. Dim varDeck(52 * 6) As Boolean
    5. Dim varCardsDealtCount As Integer
    6. Dim varCardsSeen As Integer
    7.  
    8. Private Sub cmdDealCard_Click()
    9. If Not varCardsSeen = 48 Then
    10.     Dim Path As String
    11.     Dim Index As Integer
    12.     varDeck(0) = True
    13.    
    14.     ''''''Load Card'''''''
    15.     Do Until varDeck(Index) = False
    16.         Index = Int(Rnd * varNumberOfDecks * 52) + 1
    17.     Loop
    18.     varDeck(Index) = True
    19.     Path = App.Path & "/Deck/" & Index & ".bmp"
    20.     picCard.Picture = LoadPicture(Path)
    21.    
    22.     ''''''Find Card Value (1, 0 or -1)''''''
    23.     Dim varCardValue As Integer
    24.     Dim varCard As Integer
    25.     varCard = Index Mod 13
    26.    
    27.  
    28.     Select Case varCard
    29.     Case 2 To 6
    30.         varCardValue = 1
    31.     Case 7 To 9
    32.         varCardValue = 0
    33.     Case 10 To 12
    34.         varCardValue = -1
    35.     Case 0 To 1
    36.         varCardValue = -1
    37.     End Select
    38.  
    39.     lblTotalCount.Caption = Val(lblTotalCount.Caption) + varCardValue
    40.    
    41.     varCardsSeen = varCardsSeen + 1
    42.     lblCardsseen = Val(lblCardsseen) + 1
    43.  
    44.     Picture1.Print varCard & "," & varCardValue
    45. End If
    46. End Sub
    Last edited by Thediabloman; May 18th, 2008 at 11:48 AM.

  5. #5
    Member
    Join Date
    Mar 2008
    Posts
    42

    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
  •  



Click Here to Expand Forum to Full Width