Beispiel #1
0
        # Params: (x, y, radio, direction)
        # radio:
        #   1 -> all 调动 (x, y)  所有兵力
        #   2 -> half 调动 (x, y)  1/2的兵力
        #   3 -> quarter 调动 (x, y)  1/4的兵力
        # direction:
        #   1 -> (x, y) => (x - 1, y)
        #   2 -> (x, y) => (x, y + 1)
        #   3 -> (x, y) => (x + 1, y)
        #   4 -> (x, y) => (x, y - 1)
        #
        # Return: (action_length, move_status)
        # action_length 操作队列长度
        # move_status: 0 => 失败  1 => 成功
        print('---[moveTo]', x, y, direction)
        action_length, move_status = my.move(x, y, 1, direction)
        # 操作序列过长
        if action_length > 3:
            time.sleep(3)

        time.sleep(0.5)
        # Params: (x, y)
        # 不传参数默认 x = base.x  y = base.y
        # Return: (query_res, query_status)
        # query_res: {
        #     m1: [5][5],
        #     m2: [5][5]
        # }
        # 视野为以(x, y)为中心的5*5矩阵
        # query_status: 0 => 失败  1 => 成功
        query_res, query_status = my.query(x, y)
Beispiel #2
0
        # 不传参数默认 x = base.x  y = base.y
        # Return: (query_res, query_status)
        # query_res: {
        #     m1: [][],
        #     m2: [][]
        # }
        # query_status: 0 => 失败  1 => 成功
        query_res, query_status = a.query(x, y)
        time.sleep(1)
        # Params: (x, y, radio, direction)
        # radio:
        #   1 -> all 调动 (x, y)  所有兵力
        #   2 -> half 调动 (x, y)  1/2的兵力
        #   3 -> quarter 调动 (x, y)  1/4的兵力
        # direction:
        #   1 -> (x, y) => (x - 1, y)
        #   2 -> (x, y) => (x, y + 1)
        #   3 -> (x, y) => (x + 1, y)
        #   4 -> (x, y) => (x, y - 1)
        #
        # Return: (action_length, move_status)
        # action_length 操作队列长度
        # move_status: 0 => 失败  1 => 成功
        print('---[moveTo]', x, y, a.id)
        direction = random.randint(1, 4)
        radio = random.randint(1, 3)
        action_length, move_status = a.move(x, y, radio, direction)
        time.sleep(1)
        ### 以上为策略猪蹄部分 ###

    a.logout()