示例#1
0
  def test_map_frame_count(self, length=100):
    env = deepmind_lab.Lab(
        'tests/empty_room_test', ['MAP_FRAME_NUMBER'],
        config={'fps': '60',
                'width': '80',
                'height': '80'})

    env.reset()
    agent = random_agent.DiscretizedRandomAgent()

    reward = 0
    for frame in six.moves.range(length):
      if not env.is_running():
        print('Environment stopped early')
        env.reset()
      obs = env.observations()
      action = agent.step(reward, None)
      env.step(action, 1)
      frame_number = int(obs['MAP_FRAME_NUMBER'])
      self.assertEquals(frame, frame_number)
示例#2
0
    def test_discretized_random_agent_run(self, length=100):
        env = deepmind_lab.Lab('tests/empty_room_test', ['RGB_INTERLEAVED'],
                               config={
                                   'fps': '60',
                                   'width': '80',
                                   'height': '80'
                               })

        env.reset()
        agent = random_agent.DiscretizedRandomAgent()

        reward = 0

        for _ in xrange(length):
            if not env.is_running():
                print('Environment stopped early')
                env.reset()
            obs = env.observations()
            action = agent.step(reward, obs['RGB_INTERLEAVED'])
            reward = env.step(action, 1)
            self.assertIsInstance(reward, float)