import pygame
import sprites

def setup_streets_scene_1():
    street_1 = sprites.Streets(0, 450, 850, 4)     # Street 1 Top Line
    street_2 = sprites.Streets(0, 550, 850, 4)     # Street 1 Bottomm Line
    street_3 = sprites.Streets(950, 450, 850, 4)   # Street 2 Left Line
    street_4 = sprites.Streets(950, 550, 850, 4)   # Street 2 Right Line
    street_5 = sprites.Streets(850, 0, 4, 454)     # Street 3 Left Line
    street_6 = sprites.Streets(950, 0, 4, 454)     # Street 3 Right Line
    street_7 = sprites.Streets(850, 550, 4, 450)   # Street 5/6 Bottom Line
    street_8 = sprites.Streets(950, 550, 4, 450)   # Street 4 Left Line

    streets_list = [street_1, street_2, street_3, street_4, street_5, street_6, street_7, street_8]

    return streets_list

def setup_lanterns_detectors_scene_1():

    lantern_list = []
    detectors_list = []

    # intersection 1
    cross_lantern_1 = sprites.Lanterns(825, 425, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(975, 425, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(975, 575, 25, 25, id=1, street="street_3", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(825, 575, 25, 25, id=1, street="street_4", crossing_id=1)
    cross_detector_1 = sprites.Detectors(900, 500, 260, 260, crossing_id=1)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
    detectors_list.append(cross_detector_1)

    # Street 1
    for y_pos in range(425, 576, 150):
        print("street 1")
        x_pos = 725
        id = 2
        while x_pos >= 25:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
            detectors_list.append(detector)
            x_pos -= 100
            id += 1
    
    # Street 2
    for x_pos in range(825, 976, 150):
        y_pos = 325
        id = 2
        while y_pos >= 25:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_2")
            detectors_list.append(detector)
            print(y_pos)
            y_pos -= 100
            id += 1

    # Street 3
    for y_pos in range(425, 576, 150):
        print("street 1")
        x_pos = 1075
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_3")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_3")
            detectors_list.append(detector)
            x_pos += 100
            id += 1
    
    # Street 4
    for x_pos in range(825, 976, 150):
        y_pos = 675
        id = 2
        while y_pos <= 975:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_4")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_4")
            detectors_list.append(detector)
            print(y_pos)
            y_pos += 100
            id += 1

    return lantern_list, detectors_list

def setup_streets_scene_2():
    street_1 = sprites.Streets(0, 100, 850, 4)     # Street 1 Top Line
    street_2 = sprites.Streets(0, 200, 850, 4)     # Street 1 Bottomm Line
    street_3 = sprites.Streets(950, 100, 850, 4)   # Street 2 Top Line
    street_4 = sprites.Streets(950, 200, 850, 4)   # Street 2 Bottom Line
    street_5 = sprites.Streets(0, 750, 850, 4)     # Street 5 Top Line
    street_6 = sprites.Streets(950, 750, 850, 4)   # Street 6 Top Line
    street_7 = sprites.Streets(0, 850, 1800, 4)    # Street 5/6 Bottom Line
    street_8 = sprites.Streets(850, 200, 4, 554)   # Street 4 Left Line
    street_9 = sprites.Streets(950, 200, 4, 554)   # Street 4 Right Line
    street_10 = sprites.Streets(850, 0, 4, 104)    # Street 3 Left Line
    street_11 = sprites.Streets(950, 0, 4, 104)    # Street 3 Right Line

    streets_list = [street_1, street_2, street_3, street_4, street_5, street_6, street_7, street_8, street_9, street_10, street_11]

    return streets_list


def setup_lanterns_detectors_scene_2():
    lantern_list = []
    detectors_list = []

    # Street 1
    for y_pos in range(75, 226, 150):
        x_pos = 25
        id = 1
        while x_pos <= 725:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
            detectors_list.append(detector)
            x_pos += 100
            id += 1
    
    # Street 2
    for y_pos in range(75, 226, 150):
        x_pos = 1075
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_2")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    # Street 4
    for x_pos in range(825, 976, 150):
        y_pos = 325
        id = 2
        while y_pos <= 625:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_4")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_4")
            detectors_list.append(detector)
            print(y_pos)
            y_pos += 100
            id += 1
            
    # Street 5 
    for y_pos in range(725, 976, 150):
        x_pos = 25
        id = 1
        while x_pos <= 725:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_5")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_5")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    # Street 6 
    for y_pos in range(725, 976, 150):
        x_pos = 1075
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_6")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_6")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    # Crossing 1
    cross_lantern_1 = sprites.Lanterns(825, 225, 25, 25, id=1, street="street_4", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(825, 75, 25, 25, id=9, street="street_1", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(975, 225, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(975, 75, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_detector_1 = sprites.Detectors(900, 150, 260, 260, crossing_id=1)

    # Crossing 2
    cross_lantern_5 = sprites.Lanterns(825, 725, 25, 25, id=6, street="street_4", crossing_id=2)
    cross_lantern_6 = sprites.Lanterns(825, 875, 25, 25, id=9, street="street_5", crossing_id=2)
    cross_lantern_7 = sprites.Lanterns(975, 725, 25, 25, id=1, street="street_6", crossing_id=2)
    cross_lantern_8 = sprites.Lanterns(975, 875, 25, 25, id=1, street="street_6", crossing_id=2)
    cross_detector_2 = sprites.Detectors(900, 800, 260, 260, crossing_id=2)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4, cross_lantern_5, cross_lantern_6, cross_lantern_7, cross_lantern_8])
    detectors_list.extend([cross_detector_1, cross_detector_2])

    return lantern_list, detectors_list


def setup_streets_scene_3():
    street_1 = sprites.Streets(100, 0, 4, 1000)     # Street 1/2 Left Line
    street_2 = sprites.Streets(200, 0, 4, 454)     # Street 2 Right Line
    street_3 = sprites.Streets(200, 550, 4, 450)   # Street 1 Right Line
    street_4 = sprites.Streets(200, 450, 1600, 4)   # Street 3 Top Line
    street_5 = sprites.Streets(200, 550, 1600, 4)   # Street 3 Bottom Line

    streets_list = [street_1, street_2, street_3, street_4, street_5]

    return streets_list


def setup_lanterns_detectors_scene_3():

    lantern_list = []
    detectors_list = []

    # intersection 1
    cross_lantern_1 = sprites.Lanterns(225, 425, 25, 25, id=1, street="street_3", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(225, 575, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(75, 425, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(75, 575, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_detector_1 = sprites.Detectors(150, 500, 260, 260, crossing_id=1)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
    detectors_list.append(cross_detector_1)

    # Street 1
    for x_pos in range(75, 226, 150):
        y_pos = 675
        id = 2
        while y_pos <= 975:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_1")
            detectors_list.append(detector)
            print(y_pos)
            y_pos += 100
            id += 1
    
    # Street 2
    for x_pos in range(75, 226, 150):
        y_pos = 325
        id = 2
        while y_pos >= 25:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_2")
            detectors_list.append(detector)
            print(y_pos)
            y_pos -= 100
            id += 1

    # Street 3 
    for y_pos in range(425, 576, 150):
        x_pos = 325
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_3")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_3")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    return lantern_list, detectors_list

def setup_streets_scene_4():
    street_1 = sprites.Streets(200, 100, 1600, 4)   # Street 1 Top Line
    street_2 = sprites.Streets(200, 200, 1600, 4)   # Street 1 Bottom Line
    street_3 = sprites.Streets(200, 750, 1600, 4)   # Street 2 Top Line
    street_4 = sprites.Streets(100, 850, 1700, 4)   # Street 2 Bottom Linee
    street_5 = sprites.Streets(200, 200, 4, 550)    # Street 3 right middle  Line
    street_6 = sprites.Streets(100, 0, 4, 850)      # Street 3 Left  Line
    street_7 = sprites.Streets(200, 0, 4, 100)      # Street 3 right top  Line
    


    streets_list = [street_1, street_2, street_3, street_4, street_5, street_6, street_7]

    return streets_list

def setup_lanterns_detectors_scene_4():

    lantern_list = []
    detectors_list = []

    # Intersection 1
    cross_lantern_1 = sprites.Lanterns(225, 725, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(225, 875, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(75, 725, 25, 25, id=6, street="street_3", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(75, 875, 25, 25, id=6, street="street_3", crossing_id=1)
    cross_detector_1 = sprites.Detectors(150, 800, 260, 260, crossing_id=1)

    # Intersection 2
    cross_lantern_5 = sprites.Lanterns(225, 75, 25, 25, id=1, street="street_1", crossing_id=2)
    cross_lantern_6 = sprites.Lanterns(225, 225, 25, 25, id=1, street="street_1", crossing_id=2)
    cross_lantern_7 = sprites.Lanterns(75, 75, 25, 25, id=1, street="street_3", crossing_id=2)
    cross_lantern_8 = sprites.Lanterns(75, 225, 25, 25, id=1, street="street_3", crossing_id=2)
    cross_detector_2 = sprites.Detectors(150, 150, 260, 260, crossing_id=2)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4, cross_lantern_5, cross_lantern_6, cross_lantern_7, cross_lantern_8])
    detectors_list.extend([cross_detector_1, cross_detector_2])

    # Street 1 
    for y_pos in range(75, 226, 150):
        x_pos = 325
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    # Street 2 
    for y_pos in range(725, 876, 150):
        x_pos = 325
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_2")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    # Street 3
    for x_pos in range(75, 226, 150):
        y_pos = 325
        id = 2
        while y_pos <= 625:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_3")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_3")
            detectors_list.append(detector)
            y_pos += 100
            id += 1

    return lantern_list, detectors_list


def setup_streets_scene_5():
    street_1 = sprites.Streets(100, 100, 1700, 4)   # Street 2 Top Line
    street_2 = sprites.Streets(200, 200, 1600, 4)   # Street 2 Bottom Linee
    street_3 = sprites.Streets(100, 100, 4, 900)    # Street 1 Left Line
    street_4 = sprites.Streets(200, 200, 4, 800)    # Street 3 Right  Line

    streets_list = [street_1, street_2, street_3, street_4]

    return streets_list


def setup_lanterns_detectors_scene_5():

    lantern_list = []
    detectors_list = []

    cross_lantern_1 = sprites.Lanterns(225, 75, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(225, 225, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(75, 75, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(75, 225, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_detector_1 = sprites.Detectors(150, 150, 260, 260, crossing_id=1)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
    detectors_list.append(cross_detector_1)

    # Street 1
    for x_pos in range(75, 226, 150):
        y_pos = 325
        id = 2
        while y_pos <= 925:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_1")
            detectors_list.append(detector)
            y_pos += 100
            id += 1

    # Street 2 
    for y_pos in range(75, 226, 150):
        x_pos = 325
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_2")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    return lantern_list, detectors_list

def setup_streets_scene_6():
    street_1 = sprites.Streets(0, 100, 1800, 4)     # Street 1/2 Top Line
    street_2 = sprites.Streets(0, 200, 850, 4)      # Street 1 Bottom Line
    street_3 = sprites.Streets(950, 200, 850, 4)    # Street 2 Bottom Line
    street_4 = sprites.Streets(850, 200, 4, 800)    # Street 3 Left Line
    street_5 = sprites.Streets(950, 200, 4, 800)    # Street 3 Left Line


    streets_list = [street_1, street_2, street_3, street_4, street_5]

    return streets_list


def setup_lanterns_detectors_scene_6():

    lantern_list = []
    detectors_list = []

    cross_lantern_1 = sprites.Lanterns(825, 75, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(975, 75, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(825, 225, 25, 25, id=1, street="street_3", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(975, 225, 25, 25, id=1, street="street_3", crossing_id=1)
    cross_detector_1 = sprites.Detectors(900, 150, 260, 260, crossing_id=1)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
    detectors_list.append(cross_detector_1)

    # Street 1 
    for y_pos in range(75, 226, 150):
        x_pos = 725
        id = 2
        while x_pos >= 25:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
            detectors_list.append(detector)
            x_pos -= 100
            id += 1

    # Street 1 
    for y_pos in range(75, 226, 150):
        x_pos = 1075
        id = 2
        while x_pos <= 1775:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_2")
            detectors_list.append(detector)
            x_pos += 100
            id += 1

    # Street 1
    for x_pos in range(825, 976, 150):
        y_pos = 325
        id = 2
        while y_pos <= 925:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_3")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_3")
            detectors_list.append(detector)
            y_pos += 100
            id += 1

    return lantern_list, detectors_list


def setup_streets_scene_7():
    street_1 = sprites.Streets(0, 100, 1700, 4)   # Street 2 Top Line
    street_2 = sprites.Streets(0, 200, 1600, 4)   # Street 2 Bottom Linee
    street_3 = sprites.Streets(1700, 100, 4, 900)    # Street 1 Left Line
    street_4 = sprites.Streets(1600, 200, 4, 800)    # Street 3 Right  Line

    streets_list = [street_1, street_2, street_3, street_4]

    return streets_list

def setup_lanterns_detectors_scene_7():

    lantern_list = []
    detectors_list = []

    cross_lantern_1 = sprites.Lanterns(1575, 75, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_2 = sprites.Lanterns(1725, 75, 25, 25, id=1, street="street_1", crossing_id=1)
    cross_lantern_3 = sprites.Lanterns(1575, 225, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_lantern_4 = sprites.Lanterns(1725, 225, 25, 25, id=1, street="street_2", crossing_id=1)
    cross_detector_1 = sprites.Detectors(1650, 150, 260, 260, crossing_id=1)

    lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
    detectors_list.append(cross_detector_1)

    # Street 1 
    for y_pos in range(75, 226, 150):
        x_pos = 1475
        id = 2
        while x_pos >= 75:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
            detectors_list.append(detector)
            x_pos -= 100
            id += 1

    # Street 2
    for x_pos in range(1575, 1726, 150):
        y_pos = 325
        id = 2
        while y_pos <= 925:  
            lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
            lantern_list.append(lantern)
            detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_2")
            detectors_list.append(detector)
            y_pos += 100
            id += 1

    

    return lantern_list, detectors_list