code: def run(level_script, config, num_episodes):
      """Construct and start the environment."""
      env = deepmind_lab.Lab(level_script, ["RGB_INTERLEAVED"], config)
      env.reset()
  
      observation_spec = env.observation_spec()
      print("Observation spec:")
      pprint.pprint(observation_spec)
  
      action_spec = env.action_spec()
      print("Action spec:")
      pprint.pprint(action_spec)
  
      obs = env.observations()  # dict of Numpy arrays
      rgb_i = obs["RGB_INTERLEAVED"]
      print("Observation shape:", rgb_i.shape)
      sys.stdout.flush()
  
      # Create an action to move forwards.
      action = np.zeros([7], dtype=np.intc)
      action[3] = 1
  
      score = 0
      for _ in six.moves.range(num_episodes):
          while env.is_running():
              # Advance the environment 4 frames while executing the action.
              reward = env.step(action, num_steps=4)
  
              if reward != 0:
                  score += reward
                  print("Score =", score)
                  sys.stdout.flush()
  
file_path: lab/examples/game_main.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import pprint
  import sys
  import numpy
  import six
  import deepmind_lab
label_desc: Use image node_id 1 for calling a global function with example usage: run(level_script, config, num_episodes) without return types