original_docstring: 
          Generates mutation chances and mutate the team if it is a valid mutation.
          
docstring: Generates mutation chances and mutate the team if it is a valid mutation.
docstring_tokens: Generates mutation chances and mutate the team if it is a valid mutation .
code: def mutate(self, programs_population):
          """
          Generates mutation chances and mutate the team if it is a valid mutation.
          """
          if Config.USER['advanced_training_parameters']['use_agressive_mutations']:
              mutation_chance = 1
              while (mutation_chance > random.random() 
                  and len(self.programs) > Config.USER['training_parameters']['team_size']['min']):
                  self._randomly_remove_program()
                  mutation_chance = mutation_chance * Config.USER['training_parameters']['mutation']['team']['remove_program']
  
              mutation_chance = 1
              while (mutation_chance > random.random() 
                  and len(self.programs) < Config.USER['training_parameters']['team_size']['max']):
                  self._randomly_add_program(programs_population)
                  mutation_chance = mutation_chance * Config.USER['training_parameters']['mutation']['team']['add_program']
          else:
              if len(self.programs) > Config.USER['training_parameters']['team_size']['min']:
                  mutation_chance = random.random()
                  if mutation_chance <= Config.USER['training_parameters']['mutation']['team']['remove_program']:
                      self._randomly_remove_program()
  
              if len(self.programs) < Config.USER['training_parameters']['team_size']['max']:
                  mutation_chance = random.random()
                  if mutation_chance <= Config.USER['training_parameters']['mutation']['team']['add_program']:
                      self._randomly_add_program(programs_population)
  
          to_mutate = []
          while len(to_mutate) == 0:
              for program in self.programs:
                  mutation_chance = random.random()
                  if mutation_chance <= Config.USER['training_parameters']['mutation']['team']['mutate_program']:
                      to_mutate.append(program)
          for program in to_mutate:
              clone = Program(self.generation, copy.deepcopy(program.instructions), program.action)
              clone.mutate()
              self._add_program(clone)
              programs_population.append(clone)
              if self._is_ok_to_remove(program):
                  self.remove_program(program)
          return programs_population
code_tokens: def mutate ( self , programs_population ) : if Config . USER [ 'advanced_training_parameters' ] [ 'use_agressive_mutations' ] : mutation_chance = 1 while ( mutation_chance > random . random ( ) and len ( self . programs ) > Config . USER [ 'training_parameters' ] [ 'team_size' ] [ 'min' ] ) : self . _randomly_remove_program ( ) mutation_chance = mutation_chance * Config . USER [ 'training_parameters' ] [ 'mutation' ] [ 'team' ] [ 'remove_program' ] mutation_chance = 1 while ( mutation_chance > random . random ( ) and len ( self . programs ) < Config . USER [ 'training_parameters' ] [ 'team_size' ] [ 'max' ] ) : self . _randomly_add_program ( programs_population ) mutation_chance = mutation_chance * Config . USER [ 'training_parameters' ] [ 'mutation' ] [ 'team' ] [ 'add_program' ] else : if len ( self . programs ) > Config . USER [ 'training_parameters' ] [ 'team_size' ] [ 'min' ] : mutation_chance = random . random ( ) if mutation_chance <= Config . USER [ 'training_parameters' ] [ 'mutation' ] [ 'team' ] [ 'remove_program' ] : self . _randomly_remove_program ( ) if len ( self . programs ) < Config . USER [ 'training_parameters' ] [ 'team_size' ] [ 'max' ] : mutation_chance = random . random ( ) if mutation_chance <= Config . USER [ 'training_parameters' ] [ 'mutation' ] [ 'team' ] [ 'add_program' ] : self . _randomly_add_program ( programs_population ) to_mutate = [ ] while len ( to_mutate ) == 0 : for program in self . programs : mutation_chance = random . random ( ) if mutation_chance <= Config . USER [ 'training_parameters' ] [ 'mutation' ] [ 'team' ] [ 'mutate_program' ] : to_mutate . append ( program ) for program in to_mutate : clone = Program ( self . generation , copy . deepcopy ( program . instructions ) , program . action ) clone . mutate ( ) self . _add_program ( clone ) programs_population . append ( clone ) if self . _is_ok_to_remove ( program ) : self . remove_program ( program ) return programs_population
short_docstring: Generates mutation chances and mutate the team if it is a valid mutation.
short_docstring_tokens: Generates mutation chances and mutate the team if it is a valid mutation .
comment: """
          Generates mutation chances and mutate the team if it is a valid mutation.
          """