From 7212e11a047a64dc51f4a763ae045429c9f56660 Mon Sep 17 00:00:00 2001
From: Mattias Ljungstrom <mattias.ljungstrom@gmail.com>
Date: Sun, 28 Apr 2019 21:26:08 +0200
Subject: [PATCH] level gen: require empty start/goal positions

---
 flatland/envs/rail_env.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py
index edcd069e..dc209a67 100644
--- a/flatland/envs/rail_env.py
+++ b/flatland/envs/rail_env.py
@@ -338,8 +338,8 @@ def complex_rail_generator(nr_start_goal=1, min_dist=2, max_dist=99999, seed=0):
                 start = (np.random.randint(0, width), np.random.randint(0, height))
                 goal = (np.random.randint(0, height), np.random.randint(0, height))
                 # check to make sure start,goal pos is empty?
-                # if rail_array[goal] != 0: # or rail_array[start] != 0:
-                #     continue
+                if rail_array[goal] != 0 or rail_array[start] != 0:
+                    continue
                 # check min/max distance
                 dist_sg = distance_on_rail(start, goal)
                 if dist_sg < min_dist:
-- 
GitLab