Skip to content

Commit

Permalink
fixing openai#12
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAnyMike committed Apr 2, 2019
1 parent 785f019 commit cda6329
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gym/envs/box2d/car_racing.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ def _set_config(self,
allow_reverse=0,
min_episode_reward=-np.inf,
max_episode_reward=+np.inf,
animate_zoom=False
):


# Animate zoom
self.animate_zoom = animate_zoom

# Number of lanes, 1 or 2
self.num_lanes = num_lanes if num_lanes in [1,2] else 1
Expand Down Expand Up @@ -1137,7 +1140,10 @@ def render(self, mode='human'):

if "t" not in self.__dict__: return # reset() not called yet

zoom = 0.1*SCALE*max(1-self.t, 0) + ZOOM*SCALE*min(self.t, 1) # Animate zoom first second
if self.animate_zoom:
zoom = 0.1*SCALE*max(1-self.t, 0) + ZOOM*SCALE*min(self.t, 1) # Animate zoom first second
else:
zoom = ZOOM*SCALE
zoom_state = ZOOM*SCALE*STATE_W/WINDOW_W
zoom_video = ZOOM*SCALE*VIDEO_W/WINDOW_W
scroll_x = self.car.hull.position[0]
Expand Down

0 comments on commit cda6329

Please sign in to comment.