(self, random_state)
Regenerates this corridor.

    New values are drawn from the `corridor_width` and `corridor_height`
    distributions specified in `_build`. The corridor resized accordingly, and
    new sets of platforms are created according to values drawn from the
    `platform_length`, `gap_length`, and `ground_rgba` distributions specified
    in `_build`.

    Args:
      random_state: A `numpy.random.RandomState` object that is passed to the
        `Variation` objects.
Regenerates this corridor.
Regenerates this corridor .
def regenerate(self, random_state):
    """Regenerates this corridor.

    New values are drawn from the `corridor_width` and `corridor_height`
    distributions specified in `_build`. The corridor resized accordingly, and
    new sets of platforms are created according to values drawn from the
    `platform_length`, `gap_length`, and `ground_rgba` distributions specified
    in `_build`.

    Args:
      random_state: A `numpy.random.RandomState` object that is passed to the
        `Variation` objects.
    """
    # Resize the entire corridor first.
    super().regenerate(random_state)

    # Move the ground plane down and make it invisible.
    self._ground_plane.pos = [self._current_corridor_length / 2, 0, -10]
    self._ground_plane.rgba = [0, 0, 0, 0]

    # Clear the existing platform pieces.
    self._ground_body.geom.clear()

    # Make the first platform larger.
    platform_length = 3. * _CORRIDOR_X_PADDING
    platform_pos = [
        platform_length / 2,
        0,
        -_WALL_THICKNESS,
    ]
    platform_size = [
        platform_length / 2,
        self._current_corridor_width / 2,
        _WALL_THICKNESS,
    ]
    if self._aesthetic != 'default':
      self._ground_body.add(
          'geom',
          type='box',
          name='start_floor',
          pos=platform_pos,
          size=platform_size,
          material=self._ground_material)
    else:
      self._ground_body.add(
          'geom',
          type='box',
          rgba=variation.evaluate(self._ground_rgba, random_state),
          name='start_floor',
          pos=platform_pos,
          size=platform_size)

    current_x = platform_length
    platform_id = 0
    while current_x < self._current_corridor_length:
      platform_length = variation.evaluate(
          self._platform_length, random_state=random_state)
      platform_pos = [
          current_x + platform_length / 2.,
          0,
          -_WALL_THICKNESS,
      ]
      platform_size = [
          platform_length / 2,
          self._current_corridor_width / 2,
          _WALL_THICKNESS,
      ]
      if self._aesthetic != 'default':
        self._ground_body.add(
            'geom',
            type='box',
            name='floor_{}'.format(platform_id),
            pos=platform_pos,
            size=platform_size,
            material=self._ground_material)
      else:
        self._ground_body.add(
            'geom',
            type='box',
            rgba=variation.evaluate(self._ground_rgba, random_state),
            name='floor_{}'.format(platform_id),
            pos=platform_pos,
            size=platform_size)

      platform_id += 1

      # Move x to start of the next platform.
      current_x += platform_length + variation.evaluate(
          self._gap_length, random_state=random_state)
def regenerate ( self , random_state ) : # Resize the entire corridor first. super ( ) . regenerate ( random_state ) # Move the ground plane down and make it invisible. self . _ground_plane . pos = [ self . _current_corridor_length / 2 , 0 , - 10 ] self . _ground_plane . rgba = [ 0 , 0 , 0 , 0 ] # Clear the existing platform pieces. self . _ground_body . geom . clear ( ) # Make the first platform larger. platform_length = 3. * _CORRIDOR_X_PADDING platform_pos = [ platform_length / 2 , 0 , - _WALL_THICKNESS , ] platform_size = [ platform_length / 2 , self . _current_corridor_width / 2 , _WALL_THICKNESS , ] if self . _aesthetic != 'default' : self . _ground_body . add ( 'geom' , type = 'box' , name = 'start_floor' , pos = platform_pos , size = platform_size , material = self . _ground_material ) else : self . _ground_body . add ( 'geom' , type = 'box' , rgba = variation . evaluate ( self . _ground_rgba , random_state ) , name = 'start_floor' , pos = platform_pos , size = platform_size ) current_x = platform_length platform_id = 0 while current_x < self . _current_corridor_length : platform_length = variation . evaluate ( self . _platform_length , random_state = random_state ) platform_pos = [ current_x + platform_length / 2. , 0 , - _WALL_THICKNESS , ] platform_size = [ platform_length / 2 , self . _current_corridor_width / 2 , _WALL_THICKNESS , ] if self . _aesthetic != 'default' : self . _ground_body . add ( 'geom' , type = 'box' , name = 'floor_{}' . format ( platform_id ) , pos = platform_pos , size = platform_size , material = self . _ground_material ) else : self . _ground_body . add ( 'geom' , type = 'box' , rgba = variation . evaluate ( self . _ground_rgba , random_state ) , name = 'floor_{}' . format ( platform_id ) , pos = platform_pos , size = platform_size ) platform_id += 1 # Move x to start of the next platform. current_x += platform_length + variation . evaluate ( self . _gap_length , random_state = random_state )