跳一跳小程序人工智能玩法

下载地址

https://github.com/wangshub/wechat_jump_game


1,鼠标点击定距离计算按压时间,手工玩法

2,自动跳,找图形特征,计算起步和目标距离,计算按压时间。不过按压时间原来的不对,我调整了,乘以0.7,结果我的手机就很准了。

def jump(distance, delta_piece_y):
    """
    跳跃一定的距离
    """
    # 计算程序长度与截图测得的距离的比例
    scale = 0.945 * 2 / head_diameter
    actual_distance = distance * scale * (math.sqrt(6) / 2)
    press_time = (-945 + math.sqrt(945 ** 2 + 4 * 105 *
                                   36 * actual_distance)) / (2 * 105) * 1000*0.7#0.7是我加上去的
    press_time *= press_coefficient
    press_time = max(press_time, 200)  # 设置 200ms 是最小的按压时间
    press_time = int(press_time)


    cmd = 'shell input swipe {x1} {y1} {x2} {y2} {duration}'.format(
        x1=swipe_x1,
        y1=swipe_y1,
        x2=swipe_x2,
        y2=swipe_y2,
        duration=press_time + delta_piece_y
    )
    print(cmd)
    adb.run(cmd)
    return press_time

3.人工智能玩法

待续....

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值