code: 
  
  from __future__ import annotations
  
  from PIL import Image
  
  # Define the first generation of cells
  # fmt: off
  __A   :     str      =			[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
  def 		SCREAMING_SNAKE_CASE__				(							_UpperCAmelCase				)					-> list[int]:
  
  
  
      '''simple docstring'''
  
  
  
  
  
  
      return [int(_UpperCAmelCase				) for c in f"{ruleset:08}"[:8]]
  def 		SCREAMING_SNAKE_CASE__				(							_UpperCAmelCase,      _UpperCAmelCase,      _UpperCAmelCase				)					-> list[int]:
  
  
  
      '''simple docstring'''
  
  
  
  
  
  
      lowerCAmelCase				:			Union[str, Any]    			=      len(cells[0]				)  # 31
      lowerCAmelCase				:			Optional[Any]    			=      []
      for i in range(_UpperCAmelCase				):
          # Get the neighbors of each cell
          # Handle neighbours outside bounds by using 0 as their value
          lowerCAmelCase				:			List[str]    			=      0 if i == 0 else cells[time][i - 1]
          lowerCAmelCase				:			int    			=      0 if i == population - 1 else cells[time][i + 1]
          # Define a new cell and add it to the new generation
          lowerCAmelCase				:			Any    			=      7 - int(f"{left_neighbor}{cells[time][i]}{right_neighbor}",      2				)
          next_generation.append(rule[situation]				)
      return next_generation
  def 		SCREAMING_SNAKE_CASE__				(							_UpperCAmelCase				)					-> Image.Image:
  
  
  
      '''simple docstring'''
  
  
  
  
  
  
      lowerCAmelCase				:			Dict    			=      Image.new('RGB',      (len(cells[0]				), len(_UpperCAmelCase				))				)
      lowerCAmelCase				:			Dict    			=      img.load()
      # Generates image
      for w in range(img.width				):
          for h in range(img.height				):
              lowerCAmelCase				:			Union[str, Any]    			=      255 - int(255 * cells[h][w]				)
              lowerCAmelCase				:			Optional[Any]    			=      (color, color, color)
      return img
  
  
  if __name__ == "__main__":
   __A   :     Any      =			bin(int(input('''Rule:\n''').strip()))[2:]
   __A   :     Dict      =			format_ruleset(int(rule_num))
   for time in range(16):
    CELLS.append(new_generation(CELLS, rule, time))
   __A   :     Optional[Any]      =			generate_image(CELLS)
   # Uncomment to save the image
   # img.save(f"rule_{rule_num}.png")
   img.show()
  
  
  
  
  
  
style_context: 
  
  __A   :     List[Any]      =			'''
  # Installation de Transformers
  ! pip install transformers datasets
  # Pour installer à partir du code source au lieu de la dernière version, commentez la commande ci-dessus et décommentez la suivante.
  # ! pip install git+https://github.com/huggingface/transformers.git
  '''
  
  __A   :     Dict      =			[{'''type''': '''code''', '''content''': INSTALL_CONTENT}]
  __A   :     Tuple      =			{
      '''{processor_class}''': '''FakeProcessorClass''',
      '''{model_class}''': '''FakeModelClass''',
      '''{object_class}''': '''FakeObjectClass''',
  }
  
  
  
  
  
  