Skip to content
Snippets Groups Projects
Commit d6a45659 authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

fixed bug in connection

parent 318f5bb7
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ speed_ration_map = {1.: 0.25, # Fast passenger train ...@@ -30,7 +30,7 @@ speed_ration_map = {1.: 0.25, # Fast passenger train
env = RailEnv(width=50, env = RailEnv(width=50,
height=50, height=50,
rail_generator=sparse_rail_generator(num_cities=10, # Number of cities in map (where train stations are) rail_generator=sparse_rail_generator(num_cities=2, # Number of cities in map (where train stations are)
seed=1, # Random seed seed=1, # Random seed
grid_mode=False, grid_mode=False,
max_inter_city_rails=2, max_inter_city_rails=2,
......
...@@ -753,7 +753,7 @@ def sparse_rail_generator(num_cities=5, grid_mode=False, max_inter_city_rails=4, ...@@ -753,7 +753,7 @@ def sparse_rail_generator(num_cities=5, grid_mode=False, max_inter_city_rails=4,
tmp_direction = (out_direction - 1) % 4 tmp_direction = (out_direction - 1) % 4
while neighb_idx is None: while neighb_idx is None:
neighb_idx = neighbours[tmp_direction] neighb_idx = neighbours[tmp_direction]
tmp_direction = (out_direction + 1) % 4 tmp_direction = (tmp_direction + 1) % 4
min_connection_dist = np.inf min_connection_dist = np.inf
for dir in range(4): for dir in range(4):
current_points = connection_points[neighb_idx][dir] current_points = connection_points[neighb_idx][dir]
...@@ -946,7 +946,7 @@ def sparse_rail_generator(num_cities=5, grid_mode=False, max_inter_city_rails=4, ...@@ -946,7 +946,7 @@ def sparse_rail_generator(num_cities=5, grid_mode=False, max_inter_city_rails=4,
if direction_set == 4: if direction_set == 4:
return closest_neighb return closest_neighb
print(closest_neighb)
return closest_neighb return closest_neighb
def argsort(seq): def argsort(seq):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment