|
楼主 |
发表于 2009-9-17 22:49
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
'文本框2
Private Sub Text2_Change(Index As Integer)
Dim i%, j%, k%, t%, b As Boolean, m%, m1$, m2$, n%, g%, TTEEXXTT As String, MM$, tt%
Dim A() As Integer, A34() As String, JA(13) As Integer, c() As Integer, BM1() As String, BM2() As String, BCF() As String, GDS() As Integer, SULIANG() As Integer
ReDim A(13)
If Text2(Index).Text <> "" Then
Image4(Index).Picture = ImageList1.ListImages(Val(Text2(Index).Text)).Picture
If Index = 13 Then
DoEvents
Sleep (266)
For i = 0 To Text2.Count - 1
A(i) = Val(Text2(i).Text)
If A(i) < 28 Then
A(i) = Int(A(i) / 9.001) * 100 + A(i)
Else
A(i) = Int(A(i) / 9.001) * 100 + A(i) * 6
End If
Next i
HUPAI A, b
If b Then
Label4.Caption = "开"
bArr = LoadResData(137, "CUSTOM")
sndPlaySoundFromMemory bArr(0), SND_ASYNC Or SND_MEMORY
DoEvents
Sleep (1200)
Exit Sub
End If
If Text6.Text = "听牌" Then
CHUANGJIAN Val(Text2(13).Text)
Text2(13).Text = ""
End If
If Len(Text3.Text) < 3 Then Exit Sub
If Text6.Text <> "听牌" Then
A34 = Split(Text3.Text, ",") '调用胡牌函数,找出所有能胡的牌,再在已经打掉的牌中查找剩余最多的,然后听牌
For i = 0 To 13
If A(i) <> t Then
t = A(i)
For j = 1 To UBound(A34)
m = Val(A34(j))
If m < 28 Then
m = Int(m / 9.001) * 100 + m
Else
m = Int(m / 9.001) * 100 + m * 6
End If
For g = 0 To 13
JA(g) = A(g)
Next
JA(i) = m
HUPAI JA, b
If b Then
m1 = m1 & "," & i
m2 = m2 & "," & j
b = False
End If
Next j
End If
Next i
If m1 <> "" Then
BM1 = Split(0 & m1, ",")
BM2 = Split(0 & m2, ",")
For i = 1 To UBound(BM1) '提取不重复
If BM1(i) <> MM Then
tt = tt + 1
ReDim Preserve BCF(tt)
BCF(tt) = BM1(i)
MM = BM1(i)
End If
Next i
ReDim GDS(UBound(BM2))
For i = 1 To UBound(BM2) '获得剩余牌的数量
GDS(i) = 4 - GeSu(A34(BM2(1)))
Next i
ReDim SULIANG(UBound(BCF))
For i = 1 To UBound(BCF) '相同的合计
For j = 1 To UBound(BM1)
If BCF(i) = BM1(j) Then SULIANG(i) = GDS(j)
Next j
Next i
For i = 2 To UBound(BCF)
If SULIANG(i - 1) > SULIANG(i) Then
SULIANG(i) = SULIANG(i - 1)
BCF(i) = BCF(i - 1)
End If
Next i
'MsgBox A(BCF(UBound(BCF)))
If SULIANG(UBound(SULIANG)) > 1 Then
For i = 0 To 13
m = Text2(i).Text
If m < 28 Then
m = Int(m / 9.001) * 100 + m
Else
m = Int(m / 9.001) * 100 + m * 6
End If
If m = A(BCF(UBound(BCF))) Then
CHUANGJIAN Val(Text2(i).Text)
Text2(i).Text = Text2(13).Text
Text2(13).Text = ""
Text6.Text = "听牌"
PAIXU "Text2"
bArr = LoadResData(136, "CUSTOM")
sndPlaySoundFromMemory bArr(0), SND_ASYNC Or SND_MEMORY
DoEvents
Sleep (1200)
Exit For
End If
Next i
'Exit Sub代''''''码待补充
End If
Else
'调用筛选函数,得到一个数组,打出最不好的一张
ReDim c(0)
SAIXUAN A, c, 3, 3
ZAOZUIBUHAODEPAI c, n
For i = 0 To Text2.Count - 1
m = Val(Text2(i).Text)
If m < 28 Then
m = Int(m / 9.001) * 100 + m
Else
m = Int(m / 9.001) * 100 + m * 6
End If
If m = n Then
CHUANGJIAN Val(Val(Text2(i).Text)) '创建
Text2(i).Text = Text2(13).Text
Text2(13).Text = ""
PAIXU "Text2"
Exit For
End If
Next i
End If
End If
End If
Else
Image4(Index).Picture = LoadPicture("")
End If
Timer1.Interval = 1
End Sub
'文本框4
Private Sub Text4_Change()
If Text4.Text = "5623" Then
Text5.Text = Val(Text5.Text) + 500
Text4.Text = 1111
End If
End Sub
'时钟
Private Sub Timer1_Timer()
Static t As Boolean
If Timer1.Interval = 10 Then Timer1.Interval = 1: t = False
DoEvents
If Command3.Visible = False Then Command3.Visible = True
Command3.Top = Command3.Top + 1000 * (IIf(t, -1, 1))
If Command3.Top > 7270 Or Command3.Top < 530 Then
bArr = LoadResData(135, "CUSTOM")
sndPlaySoundFromMemory bArr(0), SND_ASYNC Or SND_MEMORY
Timer1.Interval = 0
Command3.Visible = False
Command3.Top = 3720
If t Then
t = False
If Len(Text3.Text) > 2 Then Text2(13).Text = SUIJISHU Else MsgBox "没牌了": Label4.Caption = "开": Exit Sub
'Timer2.Interval = 1
Else
t = True
If Len(Text3.Text) > 2 Then Text1(13).Text = SUIJISHU Else MsgBox "没牌了": Label4.Caption = "开": Exit Sub
End If
End If
End Sub
''''''随机数
Public Function SUIJISHU() As Integer
Dim A() As String, i As Integer, d As Integer, m$, n$
A = Split(Text3.Text, ",")
Randomize
i = Int(Rnd() * UBound(A)) + 1
d = Val(A(i))
GeSu(d) = GeSu(d) + 1
If GeSu(d) = 4 Then
m = d & ","
n = Text3.Text & ","
n = Replace(n, m, "", 1, 1, vbBinaryCompare)
Text3.Text = Mid(n, 1, Len(n) - 1)
End If
SUIJISHU = d
End Function |
|