谁能帮我写个“博奥红宝石-VB排序脚本”?
谁能帮我写个“博奥红宝石-VB排序脚本”?各位都是高手,能否帮我写一个“红宝石-VB排序脚本”?
我不会写脚本,我请求各位老师帮忙,给我写一个类似『跟随排序』的排序脚本好吗?
要求是将红宝石对奖栏中的组号结果按出号频率作降序排序,保留如A-B;C-D和N-M三段(允许自定义设定区域范围)之各任意段中奖号个数的统计。
显示图形同『跟随排序』一样。
谢谢,拜托啦。
『跟随排序』如下:
'==========================================================
' 跟随排序
'==========================================================
CpParam.Add "跟随期数",10,"{0}{10}{20}{30}{40}{50}{60}{70}{80}{90}{100}"
CpParam.Add "序几","1,10","{1,10}{5,15}"
Function Main
'===============申明或定义变量=============
CpRowCount = CpData.RowCount '开奖期数
CpColCount = CpData.ColCount '开奖号码个数
CpMaxCode = CpData.MaxCode '最大号码
CpMinCode = CpData.MinCode '最小号码
CpCodeCount = CpData.CodeCount '号码数量
Pub_QS = CInt(CpParam.Value("跟随期数"))
Strqs=CpParam.Value("序几")
a=InStr(Strqs,"-")+InStr(Strqs,",")+InStr(Strqs," ")
X_S =cint(Left(Strqs,a-1)) ' 序几小数
D_S =cint(Mid(Strqs,a+1)) ' 序几大数
Pub_Qq=3 ' 前几期
'=================建表=================
CpAna.AddField "期号",8
CpAna.AddField "开奖号码",CpColCount*3
CpAna.AddField X_S&"-"&D_S&"位中奖个数",8
For i =1 to CpCodeCount
CpAna.AddField i& "序",2
Next
For i = 1 to CpColCount
CpAna.AddField "基"&i&"序号",7
Next
For i = 1 to Pub_Qq
CpAna.AddField "前"&i&"期相同序号",3
Next
CpAna.RowCount =CpRowCount+1
CpAna.CreateTable()
'==============算法主体============================
ReDim GenSui(CpCodeCount-1,CpCodeCount-1)'跟随
ReDim sum(CpCodeCount-1)
ReDim SortCodes(CpCodeCount-1)
For row =1 to CpRowCount
if row<CpRowCount Then
CpAna.Cell(row, "期号") = CpData.Seq(row)
CpAna.Cell(row, "开奖号码") = CpData.CodeStr(row)
End If
sort sum ,sortcodes
gs=0
if row<CpRowCount then cc=CpData.CodeStr(row)
For i =1 to CpCodeCount
a=sortcodes(i-1)
tl=""
If a<10 then tl="0"
CpAna.Cell(row, i& "序") =tl&a
ll=""
If i<10 then ll="0"
For j = 0 to CpColCount-1
b=CpData.Code(row,j)
if a=b and row<CpRowCount then
CpAna.bkColor(row, i& "序")=CpColor.red
CpAna.Cell(row, "基"&(j+1)&"序号")=ll&i
CpAna.Color(row, "基"&(j+1)&"序号")=CpColor.blue
If i>=X_S and i<=D_S then gs=gs+1
End If
if a<>b and i>=X_S and i<=D_S then
CpAna.Color(row, i& "序")=CpColor.IndexOf(11)
End If
Next
Next
if row<CpRowCount then
CpAna.Cell(row,X_S&"-"&D_S&"位中奖个数")=gs
CpAna.Color(row,X_S&"-"&D_S&"位中奖个数")=CpColor.red
End If
if Pub_QS>0 and row >= Pub_QS Then
For i =0 to CpColCount-1
a=CpData.Code(row-Pub_QS,i)-CpMinCode
For j= 0 to CpColCount-1
b=CpData.Code(row-Pub_QS+1, j)-CpMinCode
GenSui(b,a) =GenSui(b,a)-1
Next
Next
End If
if row<CpRowCount then
For i =0 to CpColCount-1
a=CpData.Code(row-1,i)-CpMinCode
For j= 0 to CpColCount-1
b=CpData.Code(row, j)-CpMinCode
GenSui(b,a) =GenSui(b,a)+1
Next
Next
For i = 0 to CpCodeCount - 1
sum(i) = 0
For j = 0 to CpColCount - 1
c=CpData.Code(row,j)-CpMinCode
sum(i)=sum(i)+GenSui(i,c)
Next
Next
End If
'前期比较
For i = 1 to Pub_Qq
count =0
If row>i and row < CpRowCount Then
For col = 0 to CpColCount-1
For j = 0 to CpColCount-1
a=Cint(CpAna.Cell(row, "基"&(col+1)&"序号"))
b=Cint(CpAna.Cell(row-i, "基"&(j+1)&"序号"))
if a=b then
count =count+1
Exit For
End if
Next
Next
CpAna.Cell(row, "前"&i&"期相同序号") =count
CpAna.Color(row, "前"&i&"期相同序号") = CpColor.Red
End if
Next
Next
CpAna.Cell(CpRowCount, "开奖号码") ="下一期"
CpAna.Color(CpRowCount, "开奖号码")=CpColor.red
End Function
'==============辅助函数============================
'根据开奖次数排序号码,Num为排序好的号码序列
Function Sort(ByVal Sum(), ByRef Num())
CpMaxCode = CpData.MaxCode
CpMinCode = CpData.MinCode
CpCodeCount = CpData.CodeCount'号码个数
ReDim aa(CpCodeCount-1)
For i = 0 to CpCodeCount-1
n = -1
max = -1
For j = 0 to CpCodeCount-1
If aa(j) <> -1 And Sum(j) > max Then
max = Sum(j)
n = j
End If
Next
Num(i) = CpMinCode+n
aa(n) = -1
Next
End Function