strings = ['<routes>\n']

vtypes_str = '''
    <vType id="slowCar" vClass="passenger"/>
    <vType id="p" vClass="passenger"/>
    <vType id="B" vClass="bus"/>
    <vType id="t" vClass="taxi"/>
    <vType id="M" vClass="motorcycle"/>
    <vType id="T" vClass="truck"/>
'''
strings.append(vtypes_str)


routes_str = '''
    <!-- route -->
    <!-- left to right, below -->
    <route id="LR_below" edges="571500535_02 571500535_02.18 571542115_01 571542115_01.68 571542116_02 571542116_02.96 571542116_02.164 571540302_01 571540303_02 571540303_02.21 571500475_01 571500475_01.26"/>
    <!-- right to left, below -->
    <route id="RL_below" edges="571500475_02 -571500475_01 571540303_01 -571540303_02 571540302_02 571542116_01 -571542116_02.96 -571542116_02 571542115_02 -571542115_01 571500535_01 -571500535_02"/>
    <!-- left to right, upper -->
    <route id="LR_upper" edges="571500618_02 571500617_01 571510152_01 571510152_01.65 571510153_02 571545870_01"/>
    <!-- right to left, upper -->
    <route id="RL_upper" edges="571545870_02 571510153_01 571510152_02 -571510152_01 571500617_02 571500618_01"/>

    <!-- left to right, upper, left-turn -->
    <route id="LR_upper_lt" edges="571500618_02 571500617_01 571510152_01 571510152_01.65 571510153_02 571500487_01 571500487_01.32"/>

    '''

strings.append(routes_str)

departs = [f'{d:03}' for d in range(0, 600, 20)]
routes = ["LR_below", "RL_below", "LR_upper", "LR_below", "LR_below", "LR_upper_lt"]
vehicles_str = ''


print(departs)

vehicles_str = ''' 
    <!-- vehicle -->
    <vehicle id="LR_below00" type="slowCar" route="LR_below" color="red" depart="000"/>
    <vehicle id="RL_below00" type="slowCar" route="RL_below" color="red" depart="000"/>
    <vehicle id="LR_upper00" type="slowCar" route="LR_upper" color="red" depart="000"/>
    <vehicle id="RL_upper00" type="slowCar" route="RL_upper" color="red" depart="000"/>
    <vehicle id="LR_below02" type="slowCar" route="LR_below" color="red" depart="020"/>
    <vehicle id="RL_below02" type="slowCar" route="RL_below" color="red" depart="020"/>
    <vehicle id="LR_upper02" type="slowCar" route="LR_upper" color="red" depart="020"/>
    <vehicle id="RL_upper02" type="slowCar" route="RL_upper" color="red" depart="020"/>
    <vehicle id="LR_below04" type="slowCar" route="LR_below" color="red" depart="040"/>
    <vehicle id="RL_below04" type="slowCar" route="RL_below" color="red" depart="040"/>
    <vehicle id="LR_upper04" type="slowCar" route="LR_upper" color="red" depart="040"/>
    <vehicle id="RL_upper04" type="slowCar" route="RL_upper" color="red" depart="040"/>
    <vehicle id="LR_below06" type="slowCar" route="LR_below" color="red" depart="060"/>
    <vehicle id="RL_below06" type="slowCar" route="RL_below" color="red" depart="060"/>
    <vehicle id="LR_upper06" type="slowCar" route="LR_upper" color="red" depart="060"/>
    <vehicle id="RL_upper06" type="slowCar" route="RL_upper" color="red" depart="060"/>
    <vehicle id="LR_below08" type="slowCar" route="LR_below" color="red" depart="080"/>
    <vehicle id="RL_below08" type="slowCar" route="RL_below" color="red" depart="080"/>
    <vehicle id="LR_upper08" type="slowCar" route="LR_upper" color="red" depart="080"/>
    <vehicle id="RL_upper08" type="slowCar" route="RL_upper" color="red" depart="080"/>
    <vehicle id="LR_below10" type="slowCar" route="LR_below" color="red" depart="100"/>
    <vehicle id="RL_below10" type="slowCar" route="RL_below" color="red" depart="100"/>
    <vehicle id="LR_upper10" type="slowCar" route="LR_upper" color="red" depart="100"/>
    <vehicle id="RL_upper10" type="slowCar" route="RL_upper" color="red" depart="100"/>
    <vehicle id="LR_below12" type="slowCar" route="LR_below" color="red" depart="120"/>
    <vehicle id="RL_below12" type="slowCar" route="RL_below" color="red" depart="120"/>
    <vehicle id="LR_upper12" type="slowCar" route="LR_upper" color="red" depart="120"/>
    <vehicle id="RL_upper12" type="slowCar" route="RL_upper" color="red" depart="120"/>
    <vehicle id="LR_below14" type="slowCar" route="LR_below" color="red" depart="140"/>
    <vehicle id="RL_below14" type="slowCar" route="RL_below" color="red" depart="140"/>
    <vehicle id="LR_upper14" type="slowCar" route="LR_upper" color="red" depart="140"/>
    <vehicle id="RL_upper14" type="slowCar" route="RL_upper" color="red" depart="140"/>
    <vehicle id="LR_below16" type="slowCar" route="LR_below" color="red" depart="160"/>
    <vehicle id="RL_below16" type="slowCar" route="RL_below" color="red" depart="160"/>
    <vehicle id="LR_upper16" type="slowCar" route="LR_upper" color="red" depart="160"/>
    <vehicle id="RL_upper16" type="slowCar" route="RL_upper" color="red" depart="160"/>
    <vehicle id="LR_below18" type="slowCar" route="LR_below" color="red" depart="180"/>
    <vehicle id="RL_below18" type="slowCar" route="RL_below" color="red" depart="180"/>
    <vehicle id="LR_upper18" type="slowCar" route="LR_upper" color="red" depart="180"/>
    <vehicle id="RL_upper18" type="slowCar" route="RL_upper" color="red" depart="180"/>
    <vehicle id="LR_below20" type="slowCar" route="LR_below" color="red" depart="200"/>
    <vehicle id="RL_below20" type="slowCar" route="RL_below" color="red" depart="200"/>
    <vehicle id="LR_upper20" type="slowCar" route="LR_upper" color="red" depart="200"/>
    <vehicle id="RL_upper20" type="slowCar" route="RL_upper" color="red" depart="200"/>
    <vehicle id="LR_below22" type="slowCar" route="LR_below" color="red" depart="220"/>
    <vehicle id="RL_below22" type="slowCar" route="RL_below" color="red" depart="220"/>
    <vehicle id="LR_upper22" type="slowCar" route="LR_upper" color="red" depart="220"/>
    <vehicle id="RL_upper22" type="slowCar" route="RL_upper" color="red" depart="220"/>
    <vehicle id="LR_below24" type="slowCar" route="LR_below" color="red" depart="240"/>
    <vehicle id="RL_below24" type="slowCar" route="RL_below" color="red" depart="240"/>
    <vehicle id="LR_upper24" type="slowCar" route="LR_upper" color="red" depart="240"/>
    <vehicle id="RL_upper24" type="slowCar" route="RL_upper" color="red" depart="240"/>
    <vehicle id="LR_below26" type="slowCar" route="LR_below" color="red" depart="260"/>
    <vehicle id="RL_below26" type="slowCar" route="RL_below" color="red" depart="260"/>
    <vehicle id="LR_upper26" type="slowCar" route="LR_upper" color="red" depart="260"/>
    <vehicle id="RL_upper26" type="slowCar" route="RL_upper" color="red" depart="260"/>
    <vehicle id="LR_below28" type="slowCar" route="LR_below" color="red" depart="280"/>
    <vehicle id="RL_below28" type="slowCar" route="RL_below" color="red" depart="280"/>
    <vehicle id="LR_upper28" type="slowCar" route="LR_upper" color="red" depart="280"/>
    <vehicle id="RL_upper28" type="slowCar" route="RL_upper" color="red" depart="280"/>

    <vehicle id="LR_below30" type="slowCar" route="LR_below" color="red" depart="300"/>
    <vehicle id="RL_below30" type="slowCar" route="RL_below" color="red" depart="300"/>
    <vehicle id="LR_upper30" type="slowCar" route="LR_upper" color="red" depart="300"/>
    <vehicle id="RL_upper30" type="slowCar" route="RL_upper" color="red" depart="300"/>
    <vehicle id="LR_below32" type="slowCar" route="LR_below" color="red" depart="320"/>
    <vehicle id="RL_below32" type="slowCar" route="RL_below" color="red" depart="320"/>
    <vehicle id="LR_upper32" type="slowCar" route="LR_upper" color="red" depart="320"/>
    <vehicle id="RL_upper32" type="slowCar" route="RL_upper" color="red" depart="320"/>
    <vehicle id="LR_below34" type="slowCar" route="LR_below" color="red" depart="340"/>
    <vehicle id="RL_below34" type="slowCar" route="RL_below" color="red" depart="340"/>
    <vehicle id="LR_upper34" type="slowCar" route="LR_upper" color="red" depart="340"/>
    <vehicle id="RL_upper34" type="slowCar" route="RL_upper" color="red" depart="340"/>
    <vehicle id="LR_below36" type="slowCar" route="LR_below" color="red" depart="360"/>
    <vehicle id="RL_below36" type="slowCar" route="RL_below" color="red" depart="360"/>
    <vehicle id="LR_upper36" type="slowCar" route="LR_upper" color="red" depart="360"/>
    <vehicle id="RL_upper36" type="slowCar" route="RL_upper" color="red" depart="360"/>
    <vehicle id="LR_below38" type="slowCar" route="LR_below" color="red" depart="380"/>
    <vehicle id="RL_below38" type="slowCar" route="RL_below" color="red" depart="380"/>
    <vehicle id="LR_upper38" type="slowCar" route="LR_upper" color="red" depart="380"/>
    <vehicle id="RL_upper38" type="slowCar" route="RL_upper" color="red" depart="380"/>
    <vehicle id="LR_below40" type="slowCar" route="LR_below" color="red" depart="400"/>
    <vehicle id="RL_below40" type="slowCar" route="RL_below" color="red" depart="400"/>
    <vehicle id="LR_upper40" type="slowCar" route="LR_upper" color="red" depart="400"/>
    <vehicle id="RL_upper40" type="slowCar" route="RL_upper" color="red" depart="400"/>
    <vehicle id="LR_below42" type="slowCar" route="LR_below" color="red" depart="420"/>
    <vehicle id="RL_below42" type="slowCar" route="RL_below" color="red" depart="420"/>
    <vehicle id="LR_upper42" type="slowCar" route="LR_upper" color="red" depart="420"/>
    <vehicle id="RL_upper42" type="slowCar" route="RL_upper" color="red" depart="420"/>
    <vehicle id="LR_below44" type="slowCar" route="LR_below" color="red" depart="440"/>
    <vehicle id="RL_below44" type="slowCar" route="RL_below" color="red" depart="440"/>
    <vehicle id="LR_upper44" type="slowCar" route="LR_upper" color="red" depart="440"/>
    <vehicle id="RL_upper44" type="slowCar" route="RL_upper" color="red" depart="440"/>
    <vehicle id="LR_below46" type="slowCar" route="LR_below" color="red" depart="460"/>
    <vehicle id="RL_below46" type="slowCar" route="RL_below" color="red" depart="460"/>
    <vehicle id="LR_upper46" type="slowCar" route="LR_upper" color="red" depart="460"/>
    <vehicle id="RL_upper46" type="slowCar" route="RL_upper" color="red" depart="460"/>
    <vehicle id="LR_below48" type="slowCar" route="LR_below" color="red" depart="480"/>
    <vehicle id="RL_below48" type="slowCar" route="RL_below" color="red" depart="480"/>
    <vehicle id="LR_upper48" type="slowCar" route="LR_upper" color="red" depart="480"/>
    <vehicle id="RL_upper48" type="slowCar" route="RL_upper" color="red" depart="480"/>
    <vehicle id="LR_below50" type="slowCar" route="LR_below" color="red" depart="500"/>
    <vehicle id="RL_below50" type="slowCar" route="RL_below" color="red" depart="500"/>
    <vehicle id="LR_upper50" type="slowCar" route="LR_upper" color="red" depart="500"/>
    <vehicle id="RL_upper50" type="slowCar" route="RL_upper" color="red" depart="500"/>
    <vehicle id="LR_below52" type="slowCar" route="LR_below" color="red" depart="520"/>
    <vehicle id="RL_below52" type="slowCar" route="RL_below" color="red" depart="520"/>
    <vehicle id="LR_upper52" type="slowCar" route="LR_upper" color="red" depart="520"/>
    <vehicle id="RL_upper52" type="slowCar" route="RL_upper" color="red" depart="520"/>
    <vehicle id="LR_below54" type="slowCar" route="LR_below" color="red" depart="540"/>
    <vehicle id="RL_below54" type="slowCar" route="RL_below" color="red" depart="540"/>
    <vehicle id="LR_upper54" type="slowCar" route="LR_upper" color="red" depart="540"/>
    <vehicle id="RL_upper54" type="slowCar" route="RL_upper" color="red" depart="540"/>
    <vehicle id="LR_below56" type="slowCar" route="LR_below" color="red" depart="560"/>
    <vehicle id="RL_below56" type="slowCar" route="RL_below" color="red" depart="560"/>
    <vehicle id="LR_upper56" type="slowCar" route="LR_upper" color="red" depart="560"/>
    <vehicle id="RL_upper56" type="slowCar" route="RL_upper" color="red" depart="560"/>
    <vehicle id="LR_below58" type="slowCar" route="LR_below" color="red" depart="580"/>
    <vehicle id="RL_below58" type="slowCar" route="RL_below" color="red" depart="580"/>
    <vehicle id="LR_upper58" type="slowCar" route="LR_upper" color="red" depart="580"/>
    <vehicle id="RL_upper58" type="slowCar" route="RL_upper" color="red" depart="580"/>

    '''

strings.append(vehicles_str)
strings.append('</routes>')
strings = ''.join(strings)

# route.rou.xml 파일 저장
with open('sn_routes.rou.xml', 'w') as f:
    f.write(strings)
