From 472349a68e791450852fae213ac0e0889dd1717c Mon Sep 17 00:00:00 2001
From: Erik Nygren <erik.nygren@sbb.ch>
Date: Mon, 10 Jun 2019 15:30:34 +0200
Subject: [PATCH] Reintroduced start of stopped agent on switch

---
 flatland/envs/rail_env.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py
index 7694bb20..c3ed6e02 100644
--- a/flatland/envs/rail_env.py
+++ b/flatland/envs/rail_env.py
@@ -221,7 +221,7 @@ class RailEnv(Environment):
                 agent.moving = False
                 self.rewards_dict[iAgent] += stop_penalty
 
-            if not agent.moving and action == RailEnvActions.MOVE_FORWARD:
+            if not agent.moving and not (action == RailEnvActions.DO_NOTHING or action == RailEnvActions.STOP_MOVING):
                 # Only allow agent to start moving by pressing forward.
                 agent.moving = True
                 self.rewards_dict[iAgent] += start_penalty
-- 
GitLab