def test_gym_environment(self): for name in ['AirRaid-v0', 'Amidar-v0', 'Asteroids-v0']: env = GymEnvironment(name) assert env.name == name env.reset(); env.step(0); env.close()
if layer in voltages: network.add_monitor(voltages[layer], name='%s_voltages' % layer) # Load SpaceInvaders environment. environment = GymEnvironment('Asteroids-v0') environment.reset() pipeline = Pipeline(network, environment, encoding=bernoulli, time=1, history=5, delta=10, plot_interval=plot_interval, print_interval=print_interval, render_interval=render_interval, action_function=select_multinomial, output='R') total = 0 rewards = [] avg_rewards = [] lengths = [] avg_lengths = [] i = 0 try: while i < n: pipeline.step() if pipeline.done: pipeline.reset_() i += 1 except KeyboardInterrupt: environment.close()