old_contents: """
  Script to evaluate all available demos.
  
  Assumes all demos (human and agent, except the "valid" ones)
  are generated with seed 1
  """
  
  import os
  from subprocess import call
  import sys
  
  import babyai.utils as utils
  
  folder = os.path.join(utils.storage_dir(), "demos")
  for filename in sorted(os.listdir(folder)):
      if filename.endswith(".pkl"):
          env = filename.split("_")[0]
          demos = filename[:-4]  # Remove the .pkl part of the name
          if not env.startswith('BabyAI-') and not env.endswith('-v0'):
              print("> File: {} has to start with the level name (BabyAI-xxx-v0)".format(demos))
              continue
          print("> Env: {} - {}".format(env, demos))
          seed = 0 if demos.endswith('valid') else 1
          command = ["python evaluate.py --env {} --demos {} --seed {}".format(env, demos, seed)] + sys.argv[1:]
          call(" ".join(command), shell=True)
  
new_contents: """
  Script to evaluate all available demos.
  
  Assumes all demos (human and agent, except the "valid" ones)
  are generated with seed 1
  """
  
  import os
  from subprocess import call
  import sys
  
  import babyai.utils as utils
  
  folder = os.path.join(utils.storage_dir(), "demos")
  for filename in sorted(os.listdir(folder)):
      if filename.endswith(".pkl") and 'valid' in filename:
          env = 'BabyAI-BossLevel-v0'  # It doesn't really matter. The evaluation only considers the lengths of demos.
          demo = filename[:-4]  # Remove the .pkl part of the name
  
          print("> Demos: {}".format(demo))
  
          command = ["python evaluate.py --env {} --demos {} --worst-episodes-to-show 0".format(env, demo)] + sys.argv[1:]
          call(" ".join(command), shell=True)
  
subject: fix script for evaluation all demos - only consider validation demos