资源简介
用Python来玩微信跳一跳,希望不要把分数刷太高,容易没朋友的。。。
代码片段和文件信息
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import math
import time
import os
import cv2
import datetime
scale = 0.25
template = cv2.imread(‘character.png‘)
template = cv2.resize(template (0 0) fx=scale fy=scale)
template_size = template.shape[:2]
def search(img):
result = cv2.matchTemplate(img template cv2.TM_SQDIFF)
min_val max_val min_loc max_loc = cv2.minMaxLoc(result)
cv2.rectangle(img (min_loc[0] min_loc[1]) (min_loc[0] + template_size[1] min_loc[1] + template_size[0]) (255 0 0) 4)
return img min_loc[0] + template_size[1] / 2 min_loc[1] + template_size[0]
def pull_screenshot():
filename = datetime.datetime.now().strftime(“%H%M%S“) + ‘.png‘
os.system(‘mv autojump.png {}‘.format(filename))
os.system(‘adb shell screencap -p /sdcard/autojump.png‘)
os.system(‘adb pull /sdcard/autojump.png .‘)
def jump(distance):
press_time = distance * 1.35
press_time = int(press_time)
cmd = ‘adb shell input swipe 320 410 320 410 ‘ + str(press_time)
print(cmd)
os.system(cmd)
def update_data():
global src_x src_y
img = cv2.imread(‘autojump.png‘)
img = cv2.resize(img (0 0) fx=scale fy=scale)
img src_x src_y = search(img)
return img
fig = plt.figure()
index = 0
# pull_screenshot()
img = update_data()
update = True
im = plt.imshow(img animated=True)
def updatefig(*args):
global update
if update:
time.sleep(1)
pull_screenshot()
im.set_array(update_data())
update = False
return im
def onclick(event):
global update
global src_x src_y
dst_x dst_y = event.xdata event.ydata
distance = (dst_x - src_x)**2 + (dst_y - src_y)**2
distance = (distance ** 0.5) / scale
print(‘distance = ‘ distance)
jump(distance)
update = True
fig.canvas.mpl_connect(‘button_press_event‘ onclick)
ani = animation.FuncAnimation(fig updatefig interval=5 blit=True)
plt.show()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-02 01:59 wechat_jump_game-master\
目录 0 2018-01-02 01:59 wechat_jump_game-master\.github\
文件 0 2018-01-02 01:59 wechat_jump_game-master\.github\CONTRIBUTING.md
文件 0 2018-01-02 01:59 wechat_jump_game-master\.github\ISSUE_TEMPLATE.md
文件 0 2018-01-02 01:59 wechat_jump_game-master\.github\PULL_REQUEST_TEMPLATE.md
文件 1288 2018-01-02 01:59 wechat_jump_game-master\.gitignore
文件 1065 2018-01-02 01:59 wechat_jump_game-master\LICENSE
文件 7362 2018-01-02 01:59 wechat_jump_game-master\README.md
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\
文件 55 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\.gitignore
文件 269734 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\1.png
文件 96256 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\AdbWinApi.dll
文件 60928 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\AdbWinUsbApi.dll
文件 1 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\CONTRIBUTING.md
文件 1065 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\LICENSE
文件 7217 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\README.md
文件 1009664 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\adb.exe
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\1280x720\
文件 219 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\1280x720\config.json
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\1920x1080\
文件 219 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\1920x1080\config.json
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\2160x1080\
文件 128 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\2160x1080\config.json
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\2560x1440\
文件 218 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\2560x1440\config.json
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\960x540\
文件 130 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\960x540\config.json
文件 130 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\default.json
目录 0 2018-01-02 01:59 wechat_jump_game-master\Tools\adb\config\huawei\
............此处省略276个文件信息
相关资源
- 蚁狮算法(Ant Lion AlgorithmPython实现和
- 基于Django的酒店管理系统设计与实现
- selenium中python包&对应版本的firefox
- 3D打印机控制软件Cura源码
- 《机器学习实战》源代码Python3
- pygame之《飞机大战》
- python暴力破解蓝奏网盘密码.zip
- python外星人入侵.rar
- 用tkinter写的python GUI注册界面
- PythonTank
- SVD实现代码
- python爬取维基百科程序语言消息盒(
- easygui-0.96
- python坦克大战分步骤源码及素材
- django+mysql家具购物网站,包含部署教
- python新浪微博爬虫
- Python3.5.2的IDLE汉化版计算机等级考试
- 12306爬虫实现
- Python求解数独并输出求解过程
- python程序设计基础课件
- 西电python网络处理上机题答案
- VMD变分模态分解算法
- Python网络编程 3版 高清扫描版 完整中
- 使用python编写的打飞机游戏源码
- 计算24点python
- 扑克小游戏python代码
- Python黑客攻防入门.pdf
- 《Python语言程序设计基础第二版PDF+课
- Python-PySimpleGUI一个建立在tkinter之上简
- python3.5 百度ai人脸识别
评论
共有 条评论