
from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
__lowerCamelCase							= [[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     UpperCamelCase (					__lowerCamelCase  :				List[str]					):
       return [int(__A					) for c in f"""{ruleset:08}"""[:8]]


def     UpperCamelCase (					__lowerCamelCase  :				Optional[int]       ,      __lowerCamelCase  :				List[Any]       ,      __lowerCamelCase  :				Union[str, Any]					):
       snake_case :     Union[str, Any]           =   len(cells[0]					)  # 31
       snake_case :     List[Any]           =   []
       for i in range(__A					):
              # Get the neighbors of each cell
              # Handle neighbours outside bounds by using 0 as their value
              snake_case :     Optional[int]           =   0 if i == 0 else cells[time][i - 1]
              snake_case :     str           =   0 if i == population - 1 else cells[time][i + 1]
              # Define a new cell and add it to the new generation
              snake_case :     List[str]           =   7 - int(f"""{left_neighbor}{cells[time][i]}{right_neighbor}"""       ,      2					)
              next_generation.append(rule[situation]					)
       return next_generation


def     UpperCamelCase (					__lowerCamelCase  :				Optional[Any]					):
       snake_case :     Any           =   Image.new("RGB"       ,      (len(cells[0]					), len(__A					))					)
       snake_case :     List[Any]           =   img.load()
       # Generates image
       for w in range(img.width					):
              for h in range(img.height					):
                     snake_case :     Union[str, Any]           =   255 - int(255 * cells[h][w]					)
                     snake_case :     str           =   (color, color, color)
       return img


if __name__ == "__main__":
   __lowerCamelCase							= bin(int(input("""Rule:\n""").strip()))[2:]
   __lowerCamelCase							= format_ruleset(int(rule_num))
   for time in range(16):
      CELLS.append(new_generation(CELLS, rule, time))
   __lowerCamelCase							= generate_image(CELLS)
   # Uncomment to save the image
   # img.save(f"rule_{rule_num}.png")
   img.show()







import platform
from argparse import ArgumentParser

import huggingface_hub
import pandas
import pyarrow

from datasets import __version__ as version
from datasets.commands import BaseDatasetsCLICommand


def     UpperCamelCase      (					__lowerCamelCase  :				int					):
       return EnvironmentCommand()






class 						UpperCAmelCase	(		A_				):



   @staticmethod
   def        _SCREAMING_SNAKE_CASE     (snake_case__	:      ArgumentParser				)	->			Any:


          '''simple docstring'''


          snake_case :     Optional[Any]           =   parser.add_parser("env"					,		help="Print relevant system environment info."				)
          download_parser.set_defaults(func=snake_case__				)



   def        _SCREAMING_SNAKE_CASE     (self	:      Dict				)	->			Optional[Any]:


          '''simple docstring'''


          snake_case :     List[str]           =   {
              "`datasets` version": version,
              "Platform": platform.platform(),
              "Python version": platform.python_version(),
              "Huggingface_hub version": huggingface_hub.__version__,
              "PyArrow version": pyarrow.__version__,
              "Pandas version": pandas.__version__,
          }

          print("\nCopy-and-paste the text below in your GitHub issue.\n"				)
          print(self.format_dict(snake_case__				)				)

          return info



   @staticmethod
   def        _SCREAMING_SNAKE_CASE     (snake_case__	:      Tuple				)	->			Any:


          '''simple docstring'''


          return "\n".join([f"""- {prop}: {val}""" for prop, val in d.items()]				) + "\n"





