def action_to_json(action_internal):
    """
    Lua indexes starts from 1!

    local ACTION_MOVE = 0
    local ACTION_ATTACK_HERO = 1
    local ACTION_ATTACK_CREEP = 2
    local ACTION_USE_ABILITY = 3
    local ACTION_ATTACK_TOWER = 4
    local ACTION_MOVE_DISCRETE = 5
    local ACTION_DO_NOTHING = 6

    :param action_internal: action numeric code
    :return: bot-compatible JSON action message
    """

    bot_action = 6
    params = []
    if 0 <= action_internal < 16:
        # move
        bot_action = 5
        params.append(int(action_internal))
    elif 16 == action_internal:
        # attack the nearest creep
        bot_action = 2
        params.append(1)
    elif 17 == action_internal:
        # attach the nearest hero
        bot_action = 1

    action_response = {
        'action': bot_action,
        'params': params
    }
    return action_response