Verify card game hand

Spike
09-23-2001, 01:15 PM
ok, i dont know if i will be able to get help on this, because the card game i am making isnt well known. The game is called Tic, and it is very similar to rummy. The point of the game is to get runs of 3 or more of card of the same suit, or get 3 or more of the same card number(like 3 7's, 3 aces) The game uses 2 decks of cards. I am useing the VBCards.ocx for the cards. In this game, you must go out with all the cards in your hand, so i need to check if the user has a run, 3 of kinds, or more, liek a run of 7, and a 3 of a kind. I have started on some code, but i still cant get it to work very well...I'll show you my code now...
<pre><font color=blue>Sub</font color=blue> Points(strData$, Index%)
<font color=blue>Dim</font color=blue> Temp() <font color=blue>As</font color=blue> String
Temp() = Split(strData$, ".")
<font color=blue>Dim</font color=blue> v%
v% = UBound(Temp)
<font color=blue>Dim</font color=blue> Cards(15) <font color=blue>As</font color=blue> String
<font color=blue>Dim</font color=blue> x%, c%
x% = Temp(0)
Cards(0) = x%
c% = 1
<font color=blue>Dim</font color=blue> a%
<font color=blue>For</font color=blue> a% = 1 <font color=blue>To</font color=blue> UBound(Temp)
<font color=blue>If</font color=blue> x% + 1 = Temp(a%) Then
c% = c% + 1
Cards(a%) = Temp(a%)
x% = Temp(a%)
Temp(a%) = 0
a% = 0
<font color=blue>ElseIf</font color=blue> x% - 1 = Temp(a%) Then
c% = c% + 1
Cards(a%) = Temp(a%)
x% = Temp(a%)
Temp(a%) = 0
a% = 0
<font color=blue>End</font color=blue> If
<font color=blue>If</font color=blue> c% = 3 Then

<font color=blue>End</font color=blue> If
Next
Label1.Caption = c%

<font color=blue>For</font color=blue> a% = 1 <font color=blue>To</font color=blue> UBound(Temp)
<font color=blue>If</font color=blue> Temp(a%) &lt;&gt; 0 Then
<font color=blue>While</font color=blue> Temp(a%) &gt; 13
Temp(a%) = Temp(a%) - 13
Wend
<font color=blue>End</font color=blue> If
Next
<font color=blue>For</font color=blue> a% = 1 <font color=blue>To</font color=blue> UBound(Temp)
<font color=blue>If</font color=blue> Temp(a%) &lt;&gt; 0 Then
x% = Temp(a%)
<font color=blue>Exit</font color=blue> For
<font color=blue>End</font color=blue> If
Next
c% = 1
<font color=blue>For</font color=blue> a% = 1 <font color=blue>To</font color=blue> UBound(Temp)
<font color=blue>If</font color=blue> Temp(a%) = x% Then
c% = c% + 1
<font color=blue>End</font color=blue> If
Next
c% = c% - 1
<font color=blue>Dim</font color=blue> t$
<font color=blue>For</font color=blue> a% = 0 <font color=blue>To</font color=blue> UBound(Cards)
t$ = t$ & "." & Cards(a%)
Next
Label3.Caption = c%
Label2.Caption = t$
<font color=blue>End</font color=blue> Sub

<font color=blue>Private</font color=blue> <font color=blue>Sub</font color=blue> Command1_Click()
Points "2.3.3.3.6.4.3.8.10.11.12.5", 1
<font color=blue>End</font color=blue> Sub

</pre>

OK, hopefully you will beable to read that easily, what the code should do with that random string i gave it, is come up with: a run of 2,3,4,5,6 and a three of a kind of 3,3,3 . It should then somehow tell me that there were cards left over. Can anyone help in the slightest?
Thanks to anyone who can help!

Spike

Spike
09-29-2001, 01:51 PM
I finally have gotten it to work...so you can ignore this post now. :D

Spike

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum