Disabled road modification for time being
This commit is contained in:
parent
b567eec536
commit
0fdb9ce843
@ -38,22 +38,6 @@ def GenerateMap():
|
|||||||
y_roads_coordinates.append(coordinate)
|
y_roads_coordinates.append(coordinate)
|
||||||
print(y_roads_coordinates)
|
print(y_roads_coordinates)
|
||||||
|
|
||||||
"""combine coords into list of intersection coordinates with number of roads they are joining
|
|
||||||
(if less than 2, then removed as it is no longer an intersection)"""
|
|
||||||
|
|
||||||
intersections = []
|
|
||||||
roads = []
|
|
||||||
for x in x_roads_coordinates:
|
|
||||||
for y in y_roads_coordinates:
|
|
||||||
#check how many roads are joined
|
|
||||||
joining_roads_count = 4
|
|
||||||
if(x == 0 or x == width-1):
|
|
||||||
joining_roads_count -= 1
|
|
||||||
if(y == 0 or y == height-1):
|
|
||||||
joining_roads_count -= 1
|
|
||||||
if(joining_roads_count > 2):
|
|
||||||
intersections.append([[x,y],joining_roads_count])
|
|
||||||
|
|
||||||
#create list of road coordinates
|
#create list of road coordinates
|
||||||
roads = []
|
roads = []
|
||||||
for x in x_roads_coordinates:
|
for x in x_roads_coordinates:
|
||||||
@ -67,7 +51,24 @@ def GenerateMap():
|
|||||||
"""AND HERE WE ARE, MODIFYING ALL THE ROADS
|
"""AND HERE WE ARE, MODIFYING ALL THE ROADS
|
||||||
select half the intersections for modification
|
select half the intersections for modification
|
||||||
or at least remove half from the initial list
|
or at least remove half from the initial list
|
||||||
i mean we're operating on copy"""
|
i mean we're operating on copy
|
||||||
|
THIS MIGHT NOT WORK AS INTENDED"""
|
||||||
|
|
||||||
|
"""combine coords into list of intersection coordinates with number of roads they are joining
|
||||||
|
(if less than 2, then removed as it is no longer an intersection)"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
intersections = []
|
||||||
|
for x in x_roads_coordinates:
|
||||||
|
for y in y_roads_coordinates:
|
||||||
|
#check how many roads are joined
|
||||||
|
joining_roads_count = 4
|
||||||
|
if(x == 0 or x == width-1):
|
||||||
|
joining_roads_count -= 1
|
||||||
|
if(y == 0 or y == height-1):
|
||||||
|
joining_roads_count -= 1
|
||||||
|
if(joining_roads_count > 2):
|
||||||
|
intersections.append([[x,y],joining_roads_count])
|
||||||
|
|
||||||
intersections_to_modify = [j[0].copy() for j in [i for i in intersections]]
|
intersections_to_modify = [j[0].copy() for j in [i for i in intersections]]
|
||||||
intersections_to_leave_count = (len(intersections)//2) + 1
|
intersections_to_leave_count = (len(intersections)//2) + 1
|
||||||
@ -139,12 +140,12 @@ def GenerateMap():
|
|||||||
|
|
||||||
#EXPERIMENTAL
|
#EXPERIMENTAL
|
||||||
#decide if modified route should disappear or just have some field removed
|
#decide if modified route should disappear or just have some field removed
|
||||||
"""f = random.randint(0,100)
|
#f = random.randint(0,100)
|
||||||
if(not(f % 2 or f % 5)):
|
#if(not(f % 2 or f % 5)):
|
||||||
route.remove(random.choice(route))"""
|
# route.remove(random.choice(route))
|
||||||
|
|
||||||
#remove modified route from roads
|
#remove modified route from roads
|
||||||
roads = [c for c in roads if c not in route]
|
roads = [c for c in roads if c not in route]"""
|
||||||
|
|
||||||
#insert roads into the grid
|
#insert roads into the grid
|
||||||
for coord in roads:
|
for coord in roads:
|
||||||
|
Loading…
Reference in New Issue
Block a user