diff --git a/flatland/envs/env_utils.py b/flatland/envs/env_utils.py index c3b50e14f2106ecf969cad9c4429cbdc8de6322f..a3860712f69fc05b3f9af4e4d6cd3be46af259b8 100644 --- a/flatland/envs/env_utils.py +++ b/flatland/envs/env_utils.py @@ -144,10 +144,7 @@ def a_star(rail_trans, rail_array, start, end): prev_pos = None for new_pos in [(0, -1), (0, 1), (-1, 0), (1, 0)]: node_pos = (current_node.pos[0] + new_pos[0], current_node.pos[1] + new_pos[1]) - if node_pos[0] >= rail_shape[0] or \ - node_pos[0] < 0 or \ - node_pos[1] >= rail_shape[1] or \ - node_pos[1] < 0: + if node_pos[0] >= rail_shape[0] or node_pos[0] < 0 or node_pos[1] >= rail_shape[1] or node_pos[1] < 0: continue # validate positions @@ -315,8 +312,7 @@ def get_rnd_agents_pos_tgt_dir_on_rail(rail, num_agents): valid_starting_directions = [] for m in valid_movements: new_position = get_new_position(agents_position[i], m[1]) - if m[0] not in valid_starting_directions and \ - _path_exists(rail, new_position, m[0], agents_target[i]): + if m[0] not in valid_starting_directions and _path_exists(rail, new_position, m[0], agents_target[i]): valid_starting_directions.append(m[0]) if len(valid_starting_directions) == 0: diff --git a/tests/test_rendertools.py b/tests/test_rendertools.py index 245f2f327524653b3cf03bf921f6db6b0d4b51fb..c7841df54022d0c6ea24e209f6442342514153bc 100644 --- a/tests/test_rendertools.py +++ b/tests/test_rendertools.py @@ -4,18 +4,14 @@ Tests for `flatland` package. """ -from flatland.envs.rail_env import RailEnv, random_rail_generator -import numpy as np -#<<<<<<< HEAD -#======= -# import os -#>>>>>>> dc2fa1ee0244b15c76d89ab768c5e1bbd2716147 import sys import matplotlib.pyplot as plt +import numpy as np import flatland.utils.rendertools as rt from flatland.envs.observations import TreeObsForRailEnv +from flatland.envs.rail_env import RailEnv, random_rail_generator def checkFrozenImage(oRT, sFileImage, resave=False):