def coord_to_position(coordinate, curve_map):
    """ Gives a position on the curve which corresponds to given coordinate. Domain: [0, 1]
    :param coordinate: Coordinate within the space the curve is filling
    :type coordinate: (int, int)
    :param curve_map: Generated curve map
    :type curve_map: list of (int, int)
    :rtype: float
    :return:
    """
    i = 0
    max_len = len(curve_map) - 1
    while i <= max_len:
        if curve_map[i] == coordinate:
            break
        i += 1
    if i > max_len:
        raise Exception('Coordinate is not on the the curve!')
    return i / max_len
