网络编程 
首页 > 网络编程 > 浏览文章

微信跳一跳php代码实现

(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )

本文实例为大家分享了php微信跳一跳的具体代码,供大家参考,具体内容如下

<"#%05d: ", $id); 
 // 截图 
 screencap(); 
 // 获取坐标 
 $image = imagecreatefrompng('screen.png'); 
 list($sx, $sy) = getStart(); 
 list($tx, $ty) = getEnd(); 
 if ($sx == 0) break; 
 echo sprintf("(%d, %d) -> (%d, %d) ", $sx, $sy, $tx, $ty); 
 // 图像描点 
 imagefilledellipse($image, $sy, $sx, 10, 10, 0xFF0000); 
 imagefilledellipse($image, $ty, $tx, 10, 10, 0xFF0000); 
 imagepng($image, sprintf("screen/%05d.png", $id)); 
 // 计算按压时间 
 $time = pow(pow($tx - $sx, 2) + pow($ty - $sy, 2), 0.425) * PRESS_TIME; 
 $time = round($time); 
 echo sprintf("time: %f\n", $time); 
 press($time); 
 // 等待下一次截图 
 sleep(SLEEP_TIME); 
} 

<"htmlcode">
function jump() { 
sleep(2.5);//延迟 2.5 秒,音乐盒、便利店、井盖等站 2 秒加分 
$screenShell = "cd D:\&adb shell /system/bin/screencap -p /sdcard/screenshot.png&adb pull /sdcard/screenshot.png d:jumper/screenshot.png"; 
exec($screenShell);//截图 
 
$i=imagecreatefrompng("d:jumper/screenshot.png");//读取图片 
$point=array(); 
for ($y=400;$y<imagesy($i);$y++) {//从第 400 行开始,避开上部内容 
for ($x=0;$x<imagesx($i);$x++) {//横向扫描 
$rgb = imagecolorat($i,$x,$y);//取得颜色 
$point["now"]["r"] = ($rgb16) & 0xFF; 
$point["now"]["g"] = ($rgb8) & 0xFF; 
$point["now"]["b"] = $rgb & 0xFF; 
if(isset($point["last"]["r"])){ 
if(!isset($point["x"]["a"])){ 
if( abs($point["now"]["r"]-$point["last"]["r"])>1 
or abs($point["now"]["g"]-$point["last"]["g"])>1 
or abs($point["now"]["b"]-$point["last"]["b"])>1 
){ 
$point["x"]["a"]=$x; 
if(imagesx($i)/2>$x){ 
$point["direction"]="left"; 
}else{ 
$point["direction"]="right"; 
} 
$point["a"]=$point["last"]; 
} 
}else{ 
if($point["now"]==$point["a"]){ 
$point["x"]["b"]=$x-1; 
break; 
} 
} 
} 
$point["last"]=$point["now"]; 
} 
if(isset($point["x"])){ 
break; 
} 
} 
 
$param["left"] = 3750; 
$param["right"] = 3100; 
$time = pow((abs(imagesx($i)/2-($point["x"]["a"]+$point["x"]["a"])/2)/imagesx($i)),1)*$param[$point["direction"]]; 
 
if($time<400){ 
$time+=($param[$point["direction"]]/300); 
} 
$time = round($time,0); 
echo "direction:".$point["direction"]; 
echo "\nx.a:".$point["x"]["a"]; 
echo "\nx.b:".$point["x"]["b"]; 
echo "\ntime:".$time."\n"; 
$touchShell = "cd D:\&adb shell input swipe 50 250 250 250 ".$time; 
exec($touchShell); 
imagedestroy($i); 
jump(); 
} 
 
jump(); 

更多内容大家可以参考专题《微信跳一跳》进行学习。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

上一篇:php实现的微信分享到朋友圈并记录分享次数功能
下一篇:PHP简单选择排序(Simple Selection Sort)算法学习
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网