def get_round_robin_ranges(ladder, div_index, half_robin):
    """
    Returns a list of tuples. Each tuple has the start index and the end index (inclusive) of some ladder slots
    that should participate in a round robin. For example, it might return [(4, 2), (2, 0)], which means there
    should be a round robin including slots 4, 3, 2, and another round robin including slots 2, 1, 0.
    :param ladder: The ladder we're playing in.
    :param div_index: The index of the division that is currently being played.
    :param half_robin: True if we want to split this division into two round-robins so fewer matches need to be played.
    """

    if half_robin:
        num_bots = ladder.division_size + ladder.overlap_size

        # smaller indices = higher bots on the ladder
        upper_range = (div_index * ladder.division_size, div_index * ladder.division_size + num_bots // 2)
        lower_range = (div_index * ladder.division_size + num_bots // 2, (div_index + 1) * ladder.division_size)
        sub_ranges = [lower_range, upper_range]
    else:
        sub_ranges = [(div_index * ladder.division_size, (div_index + 1) * ladder.division_size)]
    return sub_ranges