def _update_terrain_curriculum(self, env_ids, cfg):
        """ Implements the game-inspired curriculum.

        Args:
            env_ids (List[int]): ids of environments being reset
        """

        if cfg.terrain.curriculum:
            if not self.init_done:
                # don't change on initial reset
                return
            distance = torch.norm(self.root_states[env_ids, :2] - self.env_origins[env_ids, :2], dim=1)
            # robots that walked far enough progress to harder terains
            move_up = distance > cfg.terrain.env_length / 2
            # robots that walked less than half of their required distance go to simpler terrains
            move_down = (distance < torch.norm(self.commands[env_ids, :2],
                                               dim=1) * cfg.env.episode_length_s * 0.5) * ~move_up
            self.terrain_levels[env_ids] += 1 * move_up - 1 * move_down
            # Robots that solve the last level are sent to a random one
            self.terrain_levels[env_ids] = torch.where(self.terrain_levels[env_ids] >= cfg.terrain.max_terrain_level,
                                                       torch.randint_like(self.terrain_levels[env_ids],
                                                                          cfg.terrain.max_terrain_level),
                                                       torch.clip(self.terrain_levels[env_ids],
                                                                  0))  # (the minumum level is zero)
            self.env_origins[env_ids] = cfg.terrain.terrain_origins[
                self.terrain_levels[env_ids], self.terrain_types[env_ids]]
 Implements the game-inspired curriculum.

        Args:
            env_ids (List[int]): ids of environments being reset
        
forward_locomotion/go1_gym/envs/base/legged_robot.py