Skip to content
Snippets Groups Projects
Commit 257b3fc4 authored by Christian Eichenberger's avatar Christian Eichenberger :badminton:
Browse files

Merge branch 'code-cleanup' into 'master'

code cleanup

See merge request flatland/flatland!55
parents d4a48e1f cfe7d245
No related branches found
No related tags found
No related merge requests found
...@@ -266,7 +266,6 @@ class TreeObsForRailEnv(ObservationBuilder): ...@@ -266,7 +266,6 @@ class TreeObsForRailEnv(ObservationBuilder):
other_agent_same_direction = 0 other_agent_same_direction = 0
other_agent_opposite_direction = 0 other_agent_opposite_direction = 0
num_steps = 1 num_steps = 1
while exploring: while exploring:
# ############################# # #############################
...@@ -378,7 +377,6 @@ class TreeObsForRailEnv(ObservationBuilder): ...@@ -378,7 +377,6 @@ class TreeObsForRailEnv(ObservationBuilder):
] ]
""" """
if last_isTarget: if last_isTarget:
observation = [0, observation = [0,
other_target_encountered, other_target_encountered,
......
...@@ -215,22 +215,14 @@ class RailEnv(Environment): ...@@ -215,22 +215,14 @@ class RailEnv(Environment):
if action == RailEnvActions.DO_NOTHING and agent.moving: if action == RailEnvActions.DO_NOTHING and agent.moving:
# Keep moving # Keep moving
# Changed MOVE_FORWARD to DO_NOTHING
#action_dict[iAgent] = RailEnvActions.DO_NOTHING
action = RailEnvActions.MOVE_FORWARD action = RailEnvActions.MOVE_FORWARD
if action == RailEnvActions.STOP_MOVING and agent.moving: if action == RailEnvActions.STOP_MOVING and agent.moving:
#action_dict[iAgent] = RailEnvActions.DO_NOTHING
# CHanged DO_NOTHING to STOP_MOVING
# action = RailEnvActions.STOP_MOVING
agent.moving = False agent.moving = False
self.rewards_dict[iAgent] += stop_penalty self.rewards_dict[iAgent] += stop_penalty
if not agent.moving and action == RailEnvActions.MOVE_FORWARD: if not agent.moving and action == RailEnvActions.MOVE_FORWARD:
# Only allow agent to start moving by pressing forward. # Only allow agent to start moving by pressing forward.
#(action == RailEnvActions.MOVE_LEFT or
# action == RailEnvActions.MOVE_FORWARD or
# action == RailEnvActions.MOVE_RIGHT):
agent.moving = True agent.moving = True
self.rewards_dict[iAgent] += start_penalty self.rewards_dict[iAgent] += start_penalty
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment