def distance(a, b):
    """
    Calculates the distance between two cube coords.
    :param a: A cube coord x, z, y.
    :param b: A cube coord x, z, y.
    :return: A float representing the distance.
    """
    ax, az, ay = a
    bx, bz, by = b
    return (abs(ax - bx) + abs(az - bz) + abs(ay - by)) / 2