From 312930204e805b2a128fd81b9de8354b4eebd082 Mon Sep 17 00:00:00 2001
From: MLErik <baerenjesus@gmail.com>
Date: Fri, 25 Oct 2019 17:25:11 -0400
Subject: [PATCH] working on detection of initial fixed step of each agent

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

diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py
index d5f41491..32135f11 100644
--- a/flatland/envs/rail_env.py
+++ b/flatland/envs/rail_env.py
@@ -407,13 +407,16 @@ class RailEnv(Environment):
             return True
 
         # Restart fixed agents
+
+
         if agent.malfunction_data['malfunction'] < 1 and agent.malfunction_data['next_malfunction'] > 0:
+            agent.malfunction_data['next_malfunction'] -= 1
             if 'moving_before_malfunction' in agent.malfunction_data:
                 self.agents[i_agent].moving = agent.malfunction_data['moving_before_malfunction']
             return False
 
         # Break agents that have next_malfunction
-        if 1 > agent.malfunction_data['malfunction'] and agent.malfunction_data['next_malfunction'] < 1:
+        if agent.malfunction_data['malfunction'] < 1 and agent.malfunction_data['next_malfunction'] < 1:
             # Increase number of malfunctions
             agent.malfunction_data['nr_malfunctions'] += 1
 
-- 
GitLab