本帖最后由 bbaa 于 2017-7-21 18:09 编辑
根据@老刘的代码基础上修改
添加了
1.Token改变后的赢家显示
修改了@老刘用Split取得数组改成Array
2.经测试双开速度能勉强达到与523066680的分段多线程方法不相上下
二分法:- Const [宿主] = "CSCRIPT.EXE" 'WSCRIPT
- If Not UCase(Right(WScript.FullName,11)) = UCase([宿主]) Then
- Dim Args,Arg
- For Each Arg in Wscript.Arguments
- Args=Args&Chr(&H20)&Chr(&H22)&Arg&Chr(&H22)
- Next
- CreateObject("Wscript.Shell").Run _
- [宿主]&Chr(&H20)&Chr(&H22)&WScript.ScriptFullName&Chr(&H22)&Args
- WScript.Quit
- End If
- on error resume next
-
- If MsgBox("是否查看原贴?",1) = 1 Then CreateObject("Wscript.Shell").run "http://www.bathome.net/thread-44616-1-1.html"
-
- With CreateObject("MSXML2.XMLHTTP")
- .Open "POST", "http://bbaass.tk/math/", False
- .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
- .Send "send=reg&username=老刘"
- End With
- dim tokens,[大鱼小鱼或等鱼?],[Arr返回的数据]
-
- High = 10001
- Low = -1
- Do
- Do
- Mid_=(High+Low)\2
- [Arr返回的数据] = Math(Mid_)
- [大鱼小鱼或等鱼?] = [Arr返回的数据](0)
- if tokens<>[Arr返回的数据](1) then
- If [大鱼小鱼或等鱼?] = "=" then
- wscript.echo "Win!The number is "&Mid_
- Else
- Wscript.echo "The token has changed By:"&[Arr返回的数据](2)
- End if
- tokens=[Arr返回的数据](1)
- High = 10001
- Low = -1
- Exit do
- Else
- Select Case [大鱼小鱼或等鱼?]
- Case ">"
- WScript.Echo ">,so try "&Low&","&Mid_
- High = Mid_
- Case "<"
- WScript.Echo "<,so try "&Mid_&","&High
- Low = Mid_
- End Select
- End if
- Loop
- Loop
-
- Function Math(num)
- dim [返回数据]
- With CreateObject("MSXML2.XMLHTTP")
- .Open "POST","http://bbaass.tk/math/", False
- .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
- .send "send=Answer&math=" & num & "&username=老刘"
- [返回数据] = .responseText
- Math = Array(Split(Split([返回数据],",")(2),"""")(3),Split([返回数据],"""")(13),Split(Split([返回数据],",")(1),"""")(3))
- End With
- End Function
复制代码 随机摸鱼法:- Const [宿主] = "CSCRIPT.EXE" 'WSCRIPT
- If Not UCase(Right(WScript.FullName,11)) = UCase([宿主]) Then
- Dim Args,Arg
- For Each Arg in Wscript.Arguments
- Args=Args&Chr(&H20)&Chr(&H22)&Arg&Chr(&H22)
- Next
- CreateObject("Wscript.Shell").Run _
- [宿主]&Chr(&H20)&Chr(&H22)&WScript.ScriptFullName&Chr(&H22)&Args
- WScript.Quit
- End If
- on error resume next
-
- If MsgBox("是否查看原贴?",1) = 1 Then CreateObject("Wscript.Shell").run "http://www.bathome.net/thread-44616-1-1.html"
-
- With CreateObject("MSXML2.XMLHTTP")
- .Open "POST", "http://bbaass.tk/math/", False
- .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
- .Send "send=reg&username=老刘"
- End With
- dim tokens,[大鱼小鱼或等鱼?],[Arr返回的数据]
-
- High = 10001
- Low = -1
- Do
- Do
- Randomize()
- Mid_=Fix((High - Low + 1) * Rnd + Low)
- [Arr返回的数据] = Math(Mid_)
- [大鱼小鱼或等鱼?] = [Arr返回的数据](0)
- if tokens<>[Arr返回的数据](1) then
- If [大鱼小鱼或等鱼?] = "=" then
- wscript.echo "Win!The number is "&Mid_
- Else
- Wscript.echo "The token has changed By:"&[Arr返回的数据](2)
- End if
- tokens=[Arr返回的数据](1)
- High = 10001
- Low = -1
- Exit do
- Else
- Select Case [大鱼小鱼或等鱼?]
- Case ">"
- WScript.Echo ">,so try "&Low&","&Mid_
- High = Mid_
- Case "<"
- WScript.Echo "<,so try "&Mid_&","&High
- Low = Mid_
- End Select
- End if
- Loop
- Loop
-
- Function Math(num)
- dim [返回数据]
- With CreateObject("MSXML2.XMLHTTP")
- .Open "POST","http://bbaass.tk/math/", False
- .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
- .send "send=Answer&math=" & num & "&username=老刘"
- [返回数据] = .responseText
- Math = Array(Split(Split([返回数据],",")(2),"""")(3),Split([返回数据],"""")(13),Split(Split([返回数据],",")(1),"""")(3))
- End With
- End Function
复制代码
|