72d89cb22f5c5daade02f0fbf76de271b0f380c7,gym/envs/classic_control/cartpole.py,CartPoleEnv,_render,#CartPoleEnv#Any#Any#,91

Before Change


        if close:
            if self.viewer is not None:
                self.viewer.close()
                self.viewer = None
            return

        screen_width = 600
        screen_height = 400

        world_width = self.x_threshold*2
        scale = screen_width/world_width
        carty = 100 // TOP OF CART
        polewidth = 10.0
        polelen = scale * 1.0
        cartwidth = 50.0
        cartheight = 30.0

        if self.viewer is None:
            from gym.envs.classic_control import rendering
            self.viewer = rendering.Viewer(screen_width, screen_height)
            l,r,t,b = -cartwidth/2, cartwidth/2, cartheight/2, -cartheight/2
            axleoffset =cartheight/4.0
            cart = rendering.FilledPolygon([(l,b), (l,t), (r,t), (r,b)])
            self.carttrans = rendering.Transform()
            cart.add_attr(self.carttrans)
            self.viewer.add_geom(cart)
            l,r,t,b = -polewidth/2,polewidth/2,polelen-polewidth/2,-polewidth/2
            pole = rendering.FilledPolygon([(l,b), (l,t), (r,t), (r,b)])
            pole.set_color(.8,.6,.4)
            self.poletrans = rendering.Transform(translation=(0, axleoffset))
            pole.add_attr(self.poletrans)
            pole.add_attr(self.carttrans)
            self.viewer.add_geom(pole)
            self.axle = rendering.make_circle(polewidth/2)
            self.axle.add_attr(self.poletrans)
            self.axle.add_attr(self.carttrans)
            self.axle.set_color(.5,.5,.8)
            self.viewer.add_geom(self.axle)
            self.track = rendering.Line((0,carty), (screen_width,carty))
            self.track.set_color(0,0,0)
            self.viewer.add_geom(self.track)

        x = self.state
        cartx = x[0]*scale+screen_width/2.0 // MIDDLE OF CART
        self.carttrans.set_translation(cartx, carty)
        self.poletrans.set_rotation(-x[2])

        self.viewer.render()
        if mode == "rgb_array":
            return self.viewer.get_array()
        elif mode == "human":
            pass

After Change


        self.carttrans.set_translation(cartx, carty)
        self.poletrans.set_rotation(-x[2])

        return self.viewer.render(return_rgb_array = mode=="rgb_array")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 6

Non-data size: 15

Instances


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/classic_control/cartpole.py
Class Name: CartPoleEnv
Method Name: _render


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/classic_control/acrobot.py
Class Name: AcrobotEnv
Method Name: _render


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/classic_control/pendulum.py
Class Name: PendulumEnv
Method Name: _render


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/box2d/bipedal_walker.py
Class Name: BipedalWalker
Method Name: _render


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/box2d/lunar_lander.py
Class Name: LunarLander
Method Name: _render


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/classic_control/cartpole.py
Class Name: CartPoleEnv
Method Name: _render


Project Name: openai/gym
Commit Name: 72d89cb22f5c5daade02f0fbf76de271b0f380c7
Time: 2016-06-06
Author: omgtech@gmail.com
File Name: gym/envs/classic_control/mountain_car.py
Class Name: MountainCarEnv
Method Name: _render