[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 老刘1号 于 2017-7-20 20:59 编辑

回复 101# 523066680


    emmmm,我好像发现什么
如果是能整除10的数的话,我的脚本不如你的快
如果是不能整除10的数,如果接近10,2分确实不如你的快

TOP

回复 105# bbaa


    你把数据采样存数据库里。这样能浏览各个时间段的数据变化。这样对用户更好一些。
去学去写去用才有进步。安装python3代码存为xx.py 双击运行或右键用IDLE打开按F5运行

TOP

本帖最后由 老刘1号 于 2017-7-20 21:46 编辑

真·一个都抢不到……
5230兄的速度要逆天啊……

bbaa兄的随机法好评

TOP

回复 107# codegay


    在建表我就要挂了...
    不想在弄个表了...

TOP

回复 109# bbaa

    采样的数据量不大,又是线性的,放内存、文件也行啊。

新的赛跑进度显示:
  1. codegay    28121 + 5     0.3/min
  2. vic2       13098 + 192   12.9/min
  3. 老刘        4927 + 0     0.0/min
  4. bbaa         227 + 0     0.0/min
  5. vic3         127 + 0     0.0/min
复制代码
代码
  1. =info
  2.     Auth: 523066680
  3.     Date: 2017-07
  4. =cut
  5. use JSON;
  6. use Encode;
  7. use Try::Tiny;
  8. use Time::HiRes qw/time sleep/;
  9. use IO::Handle;
  10. STDOUT->autoflush(1);
  11. use LWP::Simple;
  12. use LWP::UserAgent;
  13. our $user    = "vic3";
  14. our $website = 'http://bbaass.tk/math/';
  15. our ($user, $website, $headers);
  16. our $ua = LWP::UserAgent->new( agent => 'Mozilla/5.0', timeout => 5 );
  17. my %ever;
  18. my %current;
  19. getData( \%ever );
  20. my $count = 0;
  21. my $delta;
  22. my $speed;
  23. my $time_a = time();
  24. while (1)
  25. {
  26.     getData(\%current);
  27.     $count = 0;
  28.     for my $k (reverse sort { $ever{$a} <=> $ever{$b} } keys %ever)
  29.     {
  30.         $delta = $current{$k} - $ever{$k};
  31.         $speed = $delta / (time() - $time_a) * 60.0;
  32.         printf "%-10s %5d + %-5d %.1f/min\n",
  33.             encode('gbk',  $k),
  34.             $ever{$k},
  35.             $delta,
  36.             $speed
  37.             ;
  38.         last if ($count++ > 3);
  39.     }
  40.     print "\n";
  41.     sleep 10.0;
  42. }
  43. sub getData
  44. {
  45.     my $href = shift;
  46.     my $res;
  47.     my $data;
  48.     while (1)
  49.     {
  50.         $res = $ua->post( $website, [ username => $user, send => 'reg' ] );
  51.         $res = $ua->post( $website, [ username => $user, send => 'user' ] );
  52.         try { $data = decode_json( $res->content ); last; }
  53.         catch { sleep 2.0; printf "repeat\n" }
  54.     }
  55.     for my $e ( @{$data->{'user'}} )
  56.     {
  57.         ( $times, $name, $state ) = @$e;
  58.         $href->{$name} = $times;
  59.     }
  60. }
复制代码

TOP

回复 110# 523066680


    后面的速度监测加出来了...
    要不要加个历史记录.................

TOP

本帖最后由 523066680 于 2017-7-21 12:09 编辑

回复 111# bbaa


    最好还是有图表,24小时 或 60分钟 的折线图,不同 ID 不同颜色

现在bbaa速度飙升,10秒3个

TOP

回复 112# 523066680


    60分钟的折线图对我来说是个挑战啊.....
    收集数据可能做不到整分
    还是做24小时的
    用下第三方库........

TOP

回复 110# 523066680


    username 除了reg 和Answer外是可选项
主要是在线监测..

TOP

本帖最后由 523066680 于 2017-7-21 12:25 编辑

回复 114# bbaa


    咦 重置了?
repeat
codegay    28209 + -28209 -871.6/min
vic2       14805 + -14802 -457.3/min
老刘        4983 + -4983 -154.0/min
bbaa         458 + -458  -14.2/min
vic3         127 + -127  -3.9/min

一大波负数,哈哈。

PHP JS HTML 不太懂,本地动态折线图我可以用 Perl+OpenGL 做。

TOP

回复 115# 523066680


    为了竞争的公平性 集体清0... 才不会告诉你Sql语句打错了.........
靠- -

TOP

回复 116# bbaa


    你的是用多线程以外的方案吗?好快。

TOP

本帖最后由 bbaa 于 2017-7-21 13:31 编辑

回复 117# 523066680


    是啊
  1. Const [宿主] = "CSCRIPT.EXE" 'WSCRIPT
  2. If Not UCase(Right(WScript.FullName,11)) = UCase([宿主]) Then
  3. Dim Args,Arg
  4. For Each Arg in Wscript.Arguments
  5. Args=Args&Chr(&H20)&Chr(&H22)&Arg&Chr(&H22)
  6. Next
  7. CreateObject("Wscript.Shell").Run _
  8. [宿主]&Chr(&H20)&Chr(&H22)&WScript.ScriptFullName&Chr(&H22)&Args
  9. WScript.Quit
  10. End If
  11. on error resume next
  12. If MsgBox("是否查看原贴?",1) = 1 Then CreateObject("Wscript.Shell").run "http://www.bathome.net/thread-44616-1-1.html"
  13. With CreateObject("MSXML2.XMLHTTP")
  14. .Open "POST", "http://bbaass.tk/math/", False
  15. .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
  16. .Send "send=reg&username=bbaa"
  17. End With
  18. dim tokens,[大鱼小鱼或等鱼?],[Arr返回的数据]
  19. High = 10001
  20. Low = -1
  21. Do
  22. Do
  23. 'Randomize()
  24. Mid_=Fix((High - Low + 1) * Rnd + Low)
  25. [Arr返回的数据] = Math(Mid_)
  26. [大鱼小鱼或等鱼?] = [Arr返回的数据](0)
  27. if tokens<>[Arr返回的数据](1) then
  28. If [大鱼小鱼或等鱼?] = "=" then
  29. wscript.echo "Win!The number is "&Mid_
  30. Else
  31. Wscript.echo "The token has changed"
  32. 'Wscript.echo [Arr返回的数据](1)
  33. End if
  34. tokens=[Arr返回的数据](1)
  35. High = 10001
  36. Low = -1
  37. Exit do
  38. Else
  39. Select Case [大鱼小鱼或等鱼?]
  40. Case ">"
  41. WScript.Echo ">,so try "&Low&","&Mid_
  42. High = Mid_
  43. Case "<"
  44. WScript.Echo "<,so try "&Mid_&","&High
  45. Low = Mid_
  46. End Select
  47. End if
  48. Loop
  49. Loop
  50. Function Math(num)
  51. dim [返回数据]
  52. With CreateObject("MSXML2.XMLHTTP")
  53. .Open "POST","http://bbaass.tk/math/", False
  54. .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
  55. .send "send=Answer&math=" & num & "&username=bbaa"
  56. [返回数据] = .responseText
  57. Math = Split(Split(Split([返回数据],",")(2),"""")(3) & " "&Split([返回数据],"""")(13)," ")
  58. End With
  59. End Function
复制代码
基于老刘修改的随机摸鱼
一个用老刘的二分同时开

TOP


TOP

本帖最后由 bbaa 于 2017-7-21 18:09 编辑


根据@老刘的代码基础上修改
添加了
1.Token改变后的赢家显示
修改了@老刘用Split取得数组改成Array
2.经测试双开速度能勉强达到与523066680的分段多线程方法不相上下
二分法:
  1. Const [宿主] = "CSCRIPT.EXE" 'WSCRIPT
  2. If Not UCase(Right(WScript.FullName,11)) = UCase([宿主]) Then
  3. Dim Args,Arg
  4. For Each Arg in Wscript.Arguments
  5. Args=Args&Chr(&H20)&Chr(&H22)&Arg&Chr(&H22)
  6. Next
  7. CreateObject("Wscript.Shell").Run _
  8. [宿主]&Chr(&H20)&Chr(&H22)&WScript.ScriptFullName&Chr(&H22)&Args
  9. WScript.Quit
  10. End If
  11. on error resume next
  12. If MsgBox("是否查看原贴?",1) = 1 Then CreateObject("Wscript.Shell").run "http://www.bathome.net/thread-44616-1-1.html"
  13. With CreateObject("MSXML2.XMLHTTP")
  14. .Open "POST", "http://bbaass.tk/math/", False
  15. .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
  16. .Send "send=reg&username=老刘"
  17. End With
  18. dim tokens,[大鱼小鱼或等鱼?],[Arr返回的数据]
  19. High = 10001
  20. Low = -1
  21. Do
  22. Do
  23. Mid_=(High+Low)\2
  24. [Arr返回的数据] = Math(Mid_)
  25. [大鱼小鱼或等鱼?] = [Arr返回的数据](0)
  26. if tokens<>[Arr返回的数据](1) then
  27. If [大鱼小鱼或等鱼?] = "=" then
  28. wscript.echo "Win!The number is "&Mid_
  29. Else
  30. Wscript.echo "The token has changed By:"&[Arr返回的数据](2)
  31. End if
  32. tokens=[Arr返回的数据](1)
  33. High = 10001
  34. Low = -1
  35. Exit do
  36. Else
  37. Select Case [大鱼小鱼或等鱼?]
  38. Case ">"
  39. WScript.Echo ">,so try "&Low&","&Mid_
  40. High = Mid_
  41. Case "<"
  42. WScript.Echo "<,so try "&Mid_&","&High
  43. Low = Mid_
  44. End Select
  45. End if
  46. Loop
  47. Loop
  48. Function Math(num)
  49. dim [返回数据]
  50. With CreateObject("MSXML2.XMLHTTP")
  51. .Open "POST","http://bbaass.tk/math/", False
  52. .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
  53. .send "send=Answer&math=" & num & "&username=老刘"
  54. [返回数据] = .responseText
  55. Math = Array(Split(Split([返回数据],",")(2),"""")(3),Split([返回数据],"""")(13),Split(Split([返回数据],",")(1),"""")(3))
  56. End With
  57. End Function
复制代码
随机摸鱼法:
  1. Const [宿主] = "CSCRIPT.EXE" 'WSCRIPT
  2. If Not UCase(Right(WScript.FullName,11)) = UCase([宿主]) Then
  3. Dim Args,Arg
  4. For Each Arg in Wscript.Arguments
  5. Args=Args&Chr(&H20)&Chr(&H22)&Arg&Chr(&H22)
  6. Next
  7. CreateObject("Wscript.Shell").Run _
  8. [宿主]&Chr(&H20)&Chr(&H22)&WScript.ScriptFullName&Chr(&H22)&Args
  9. WScript.Quit
  10. End If
  11. on error resume next
  12. If MsgBox("是否查看原贴?",1) = 1 Then CreateObject("Wscript.Shell").run "http://www.bathome.net/thread-44616-1-1.html"
  13. With CreateObject("MSXML2.XMLHTTP")
  14. .Open "POST", "http://bbaass.tk/math/", False
  15. .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
  16. .Send "send=reg&username=老刘"
  17. End With
  18. dim tokens,[大鱼小鱼或等鱼?],[Arr返回的数据]
  19. High = 10001
  20. Low = -1
  21. Do
  22. Do
  23. Randomize()
  24. Mid_=Fix((High - Low + 1) * Rnd + Low)
  25. [Arr返回的数据] = Math(Mid_)
  26. [大鱼小鱼或等鱼?] = [Arr返回的数据](0)
  27. if tokens<>[Arr返回的数据](1) then
  28. If [大鱼小鱼或等鱼?] = "=" then
  29. wscript.echo "Win!The number is "&Mid_
  30. Else
  31. Wscript.echo "The token has changed By:"&[Arr返回的数据](2)
  32. End if
  33. tokens=[Arr返回的数据](1)
  34. High = 10001
  35. Low = -1
  36. Exit do
  37. Else
  38. Select Case [大鱼小鱼或等鱼?]
  39. Case ">"
  40. WScript.Echo ">,so try "&Low&","&Mid_
  41. High = Mid_
  42. Case "<"
  43. WScript.Echo "<,so try "&Mid_&","&High
  44. Low = Mid_
  45. End Select
  46. End if
  47. Loop
  48. Loop
  49. Function Math(num)
  50. dim [返回数据]
  51. With CreateObject("MSXML2.XMLHTTP")
  52. .Open "POST","http://bbaass.tk/math/", False
  53. .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
  54. .send "send=Answer&math=" & num & "&username=老刘"
  55. [返回数据] = .responseText
  56. Math = Array(Split(Split([返回数据],",")(2),"""")(3),Split([返回数据],"""")(13),Split(Split([返回数据],",")(1),"""")(3))
  57. End With
  58. End Function
复制代码
1

评分人数

TOP

返回列表