


'''simple docstring'''




from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
_a      :      Any       				=      [[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      _a		(lowercase__ :      int	) -> list[int]:






     """simple docstring"""
     return [int(lowercase__	) for c in f'{ruleset:08}'[:8]]





def      _a		(lowercase__ :      list[list[int]]       ,      lowercase__ :      list[int]       ,      lowercase__ :      int	) -> list[int]:






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





def      _a		(lowercase__ :      list[list[int]]	) -> Image.Image:






     """simple docstring"""
     __snake_case    			=	Image.new('RGB'       ,      (len(cells[0]	), len(lowercase__	))	)
     __snake_case    			=	img.load()
     # Generates image
     for w in range(img.width	):
          for h in range(img.height	):
               __snake_case    			=	2_5_5 - int(2_5_5 * cells[h][w]	)
               __snake_case    			=	(color, color, color)
     return img


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








'''simple docstring'''




def      _a		(lowercase__ :      int	) -> int:






     """simple docstring"""
     return 1 if input_a == 0 else 0





def      _a		() -> None:






     """simple docstring"""
     assert not_gate(0	) == 1
     assert not_gate(1	) == 0


if __name__ == "__main__":
       print(not_gate(0))
       print(not_gate(1))




