|
this is how i have the array set up it in a module
Public Card(1 To 52, 1 To 2) As Variant
Public intpc(8), intdc(8), intrnd(10), inthit(2) As Integer, hit(6) As Boolean
'intpc holds play card vaule intdc holds dealer card vaule intrnd are random numbers to pic cards
Public Sub cards()
Card(1, 1) = App.Path & "\images\2CLUBS.gif" ' This is image
Card(1, 2) = 2 'Value of card
Card(2, 1) = App.Path & "\images\2DIMND.gif" ' This is image
Card(2, 2) = 2 'Value of card
Card(3, 1) = App.Path & "\images\2HEARTS.gif" ' This is image
Card(3, 2) = 2 'Value of card
Card(4, 1) = App.Path & "\images\2SPADE.gif" ' This is image
Card(4, 2) = 2 'Value of card
Card(5, 1) = App.Path & "\images\3CLUBS.gif" ' This is image
Card(5, 2) = 3 'Value of card
Card(6, 1) = App.Path & "\images\3DIMND.gif" ' This is image
Card(6, 2) = 3 'Value of card
Card(7, 1) = App.Path & "\images\3HEARTS.gif" ' This is image
Card(7, 2) = 3 'Value of card
Card(8, 1) = App.Path & "\images\3SPADE.gif" ' This is image
Card(8, 2) = 3 'Value of card
Card(9, 1) = App.Path & "\images\4CLUBS.gif" ' This is image
Card(9, 2) = 4 'Value of card
Card(10, 1) = App.Path & "\images\4DIMND.gif" ' This is image
Card(10, 2) = 4 'Value of card
Card(11, 1) = App.Path & "\images\4HEARTS.gif" ' This is image
Card(11, 2) = 4 'Value of card
Card(12, 1) = App.Path & "\images\4SPADE.gif" ' This is image
Card(12, 2) = 4 'Value of card
Card(13, 1) = App.Path & "\images\5CLUBS.gif" ' This is image
Card(13, 2) = 5 'Value of card
Card(14, 1) = App.Path & "\images\5DIMND.gif" ' This is image
Card(14, 2) = 5 'Value of card
Card(15, 1) = App.Path & "\images\5HEARTS.gif" ' This is image
Card(15, 2) = 5 'Value of card
Card(16, 1) = App.Path & "\images\5SPADE.gif" ' This is image
Card(16, 2) = 5 'Value of card
Card(17, 1) = App.Path & "\images\6CLUBS.gif" ' This is image
Card(17, 2) = 6 'Value of card
Card(18, 1) = App.Path & "\images\6DIMND.gif" ' This is image
Card(18, 2) = 6 'Value of card
Card(19, 1) = App.Path & "\images\6HEARTS.gif" ' This is image
Card(19, 2) = 6 'Value of card
Card(20, 1) = App.Path & "\images\6SPADE.gif" ' This is image
Card(20, 2) = 6 'Value of card
Card(21, 1) = App.Path & "\images\7CLUBS.gif" ' This is image
Card(21, 2) = 7 'Value of card
Card(22, 1) = App.Path & "\images\7DIMND.gif" ' This is image
Card(22, 2) = 7 'Value of card
Card(23, 1) = App.Path & "\images\7HEARTS.gif" ' This is image
Card(23, 2) = 7 'Value of card
Card(24, 1) = App.Path & "\images\7SPADE.gif" ' This is image
Card(24, 2) = 7 'Value of card
Card(25, 1) = App.Path & "\images\8DIMND.gif" ' This is image
Card(25, 2) = 8 'Value of card
Card(26, 1) = App.Path & "\images\8HEARTS.gif" ' This is image
Card(26, 2) = 8 'Value of card
Card(27, 1) = App.Path & "\images\8SPADE.gif" ' This is image
Card(27, 2) = 8 'Value of card
Card(28, 1) = App.Path & "\images\8CLUBS.gif" ' This is image
Card(28, 2) = 8 'Value of card
Card(29, 1) = App.Path & "\images\9DIMND.gif" ' This is image
Card(29, 2) = 9 'Value of card
Card(30, 1) = App.Path & "\images\9HEARTS.gif" ' This is image
Card(30, 2) = 9 'Value of card
Card(31, 1) = App.Path & "\images\9SPADE.gif" ' This is image
Card(31, 2) = 9 'Value of card
Card(32, 1) = App.Path & "\images\9CLUBS.gif" ' This is image
Card(32, 2) = 9 'Value of card
Card(33, 1) = App.Path & "\images\10DIMND.gif" ' This is image
Card(33, 2) = 10 'Value of card
Card(34, 1) = App.Path & "\images\10HEARTS.gif" ' This is image
Card(34, 2) = 10 'Value of card
Card(35, 1) = App.Path & "\images\10SPADe.gif" ' This is image
Card(35, 2) = 10 'Value of card
Card(36, 1) = App.Path & "\images\10CLUBS.gif" ' This is image
Card(36, 2) = 10 'Value of card
Card(37, 1) = App.Path & "\images\jackDMND.gif" ' This is image
Card(37, 2) = 10 'Value of card
Card(38, 1) = App.Path & "\images\JACKHRTS.gif" ' This is image
Card(38, 2) = 10 'Value of card
Card(39, 1) = App.Path & "\images\jackSPAD.gif" ' This is image
Card(39, 2) = 10 'Value of card
Card(40, 1) = App.Path & "\images\jackclub.gif" ' This is image
Card(40, 2) = 10 'Value of card
Card(41, 1) = App.Path & "\images\KINGHRTS.gif" ' This is image
Card(41, 2) = 10 'Value of card
Card(42, 1) = App.Path & "\images\KINGSPAD.gif" ' This is image
Card(42, 2) = 10 'Value of card
Card(43, 1) = App.Path & "\images\KINGCLUB.gif" ' This is image
Card(43, 2) = 10 'Value of card
Card(44, 1) = App.Path & "\images\KINGDMND.gif" ' This is image
Card(44, 2) = 10 'Value of card
Card(45, 1) = App.Path & "\images\QUENHRTS.gif" ' This is image
Card(45, 2) = 10 'Value of card
Card(46, 1) = App.Path & "\images\QUENSPAD.gif" ' This is image
Card(46, 2) = 10 'Value of card
Card(47, 1) = App.Path & "\images\QUENCLUB.gif" ' This is image
Card(47, 2) = 10 'Value of card
Card(48, 1) = App.Path & "\images\QUENDMND.gif" ' This is image
Card(48, 2) = 10 'Value of card
Card(49, 1) = App.Path & "\images\aceHEART.gif" ' This is image
Card(49, 2) = 11 'Value of card
Card(50, 1) = App.Path & "\images\aceSPADe.gif" ' This is image
Card(50, 2) = 11 'Value of card
Card(51, 1) = App.Path & "\images\aceCLUBs.gif" ' This is image
Card(51, 2) = 11 'Value of card
Card(52, 1) = App.Path & "\images\aceDiMND.gif" ' This is image
Card(52, 2) = 11 'Value of card
End Sub
this is the deal button code
Private Sub cmdDeal_Click()
Dim intace, intp, intd As Integer, player, dealer As Boolean
'intace is a new vaule you for int ace intp and intd are counters to fill card slot 1 and 2
player = True
For intp = 1 To 2 Step 1
Do While player = True
modcard.intrnd(0) = Int(Rnd * 52 + 1)
If modcard.Card(modcard.intrnd(0), 2) <> 100 Then
picpc(intp).Picture = LoadPicture(modcard.Card(modcard.intrnd(0), 1))
modcard.intpc(intp) = modcard.Card(modcard.intrnd(0), 2)
modcard.Card(modcard.intrnd(0), 2) = 100
player = False
Else
player = True
End If
Loop
Next intp
If modcard.intpc(1) = modcard.intpc(2) Then
cmdsplit.Enabled = True
End If
For intd = 1 To 2
Do While dealer = True
modcard.intrnd(1) = Int(Rnd * 52 + 1)
If modcard.Card(modcard.intrnd(1), 2) <> 100 Then
picdc(intd).Picture = LoadPicture(modcard.Card(modcard.intrnd(1), 1))
intdc(intd) = modcard.Card(modcard.intrnd(1), 2)
modcard.Card(modcard.intrnd(1), 2) = 100
dealer = False
If intd = 2 Then
picdc(intd).Picture = LoadPicture(cardback)
End If
Else
dealer = True
End If
Loop
Next
modcard.intpc(0) = modcard.intpc(1) + modcard.intpc(2)
If modcard.intdc(1) = 11 Then
If modcard.intpc(0) <> 21 Then
intace = InputBox("pic 1 or 11", , "Ace")
If intace + modcard.intpc(2) > 22 Then
intace = 1
End If
modcard.intpc(0) = 0
modcard.intpc(0) = intace + modcard.intpc(2)
End If
End If
lblpc.Caption = modcard.intpc(0)
modcard.intdc(0) = modcard.intdc(1) + modcard.intdc(2)
now when i hit the deal button it dose nothing and it so post to load oic and vaules as u can see can someone plase help me i wouls appreacit it alot thank you
|