def calc_squashable_walkers_single_method(walker_weights, max_weight):
    """Calculate the maximum number of squashable walkers in collection of
    walkers, that still satisfies the max weight constraint.

    We don't guarantee or know if this is a completely optimal solver
    for this problem but it is assumed to be good enough in practice
    and no harm comes from underestimating it only a reduced potential
    performance.

    Parameters
    ----------
    walker_weights : list of float
        The weights of the walkers

    max_weight : float
        The maximum weight a walker can have.

    Returns
    -------

    n_squashable : int
        The maximum number of squashable walkers.

    """


    # to get an estimate of the number of squashable walkers we start
    # summing the weights starting from the smallest walker. When the
    # addition of the next highest weight walker would make the total
    # greater than max_weight then we quit and say that the number of
    # squashable walkers is the number of them summed up, minus one
    # for the fact that one of them won't be squashed if a merge of
    # all of them was to occur
    n_squashable = 0

    # there must be at least 2 walkers in order to be able to do a
    # merge, so if there are not enough the number of squashable
    # walkers is 0
    if len(walker_weights) < 2:
        return n_squashable


    # sort the weights smallest to biggest
    walker_weights.sort()

    idx = 0
    sum_weights = walker_weights[idx]
    merge_size = 1
    while sum_weights <= max_weight:

        # if the next index would be out of bounds break out of the
        # loop
        if idx + 1 >= len(walker_weights):
            break
        else:
            idx += 1

        # add this walker to the sum weights
        sum_weights += walker_weights[idx]

        # add one to the merge size (since we only will make our
        # estimate based on the single largest possible merge)
        merge_size += 1


    else:
        # the loop condition failed so we remove the last count of
        # merge size from the merge group. This won't run if we break
        # out of the loop because of we are out of walkers to include
        merge_size -= 1


    # then we also take one less than that as the number of
    # squashable walkers
    n_squashable = merge_size - 1


    return n_squashable