From 845de14c0f14503211a72748c3192982f8df9e32 Mon Sep 17 00:00:00 2001
From: u214892 <u214892@sbb.ch>
Date: Mon, 20 May 2019 15:03:53 +0200
Subject: [PATCH] a_star with sets instead of lists: cleanup

---
 flatland/envs/env_utils.py | 8 ++------
 tests/test_rendertools.py  | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/flatland/envs/env_utils.py b/flatland/envs/env_utils.py
index c3b50e14..a3860712 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 245f2f32..c7841df5 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):
-- 
GitLab