微信跳一跳輔助

2021-10-03 03:47:32 字數 1973 閱讀 7897

background_pos =

distance_to_time_ratio =1.35

screenshot_path = tempfile.gettempdir()+"/screenshot.png"

def calculate_jump_distance():

im =image.open(screenshot_pate)

baxkround_rgb = im.getpixel(background_pos)

role_pos_list = none

vertex1_pos = none

block_background_rgb = none

vertex2_pos = none

role_line_flag = true

for y in range(background_pos[1], im.height):

if role_pos_list and role_line_flag:

break

role_line_flag = true

vertex2_line_flag = true

for x in range(background_pos[0], im.width):

current_rgb = im.getpixel((x, y))

next_rgb = im.getpixel((x + 1, y)) if x + 1 < im.width else (0, 0, 0)

# 識別頂點1

if x > background_pos[0] and y > background_pos[1] and not vertex1_pos

and not is_similar(background_rgb, current_rgb) and is_similar(current_rgb, next_rgb):

vertex1_pos = (x, y)

block_background_rgb = current_rgb

# 識別頂點2

if block_background_rgb and vertex2_line_flag and is_similar(current_rgb, block_background_rgb, 5):

vertex2_line_flag = false

if vertex2_pos:

if x < vertex2_pos[0] and vertex2_pos[0] - x < 20 and y - vertex2_pos[1] < 20:

vertex2_pos = (x, y)

else:

vertex2_pos = (x, y)

# 識別小人

if is_part_of_role(current_rgb):

if role_line_flag:

role_pos_list =

role_line_flag = false

if len(role_pos_list) == 0:

raise exception('無法識別小人位置!!!')

pos_sum = reduce((lambda o1, o2: (o1[0] + o2[0], o1[1] + o2[1])), role_pos_list)

role_pos = (int(pos_sum[0] / len(role_pos_list)), int(pos_sum[1] / len(role_pos_list)))

destination_pos = (vertex1_pos[0], vertex2_pos[1])

return int(linear_distance(role_pos, destination_pos))

祝關注我的人都:身體健康,財源廣進,福如東海,壽比南山,早生貴子,從不掉發!

微信跳一跳python 微信跳一跳Python

1 安裝python,我用的是python2.7 5.安裝pillow,放在scripts資料夾中,通過 pip install pillow安裝 6.安裝adb工具包,可以直接放在專案 的資料夾裡面,或者放在c盤目錄不過要配置一下環境變數,我這裡是直接放在專案 資料夾中。內建了cmd 命令 7.把...

python 微信跳一跳

因為是基於python的指令碼所以要先安裝python 這裡有教程 點選這裡 安裝好之後開始下面的操作 這裡是對adb的解釋 2.安裝好之後將安裝路徑配置到環境變數中 注意 路徑後加 英文格式的 號,例如d adb 3.快捷鍵win r開啟cmd win鍵即ctrl和alt中間那個鍵 輸入 adb出...

180301微信跳一跳

1代表跳到了下乙個盒子但不在中心,得分為1,總分加1 2代表跳到了下乙個盒子且在中心 根據上次的得分計算 如果上一次得分為1,那此次得分為2,總分加2分,如果上一次得分為2,那此次得分為4,總分加4 以此類推 如上一次得分為8分,這次又跳到了盒子中心,那此次得分為10分,總分加10 0代表沒有跳到盒...