

from __future__ import annotations

from PIL import Image

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



  """simple docstring"""






  return [int(_UpperCamelCase  ) for c in F"""{ruleset:08}"""[:8]]



def    snake_case_(_UpperCamelCase				, _UpperCamelCase				, _UpperCamelCase  )							->			list[int]:



  """simple docstring"""






  _snake_case		=							len(cells[0]  )  # 31
  _snake_case		=							[]
  for i in range(_UpperCamelCase  ):
    # 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    snake_case_(_UpperCamelCase  )							->			Image.Image:



  """simple docstring"""






  _snake_case		=							Image.new('''RGB'''				, (len(cells[0]  ), len(_UpperCamelCase  ))  )
  _snake_case		=							img.load()
  # Generates image
  for w in range(img.width  ):
    for h in range(img.height  ):
      _snake_case		=							255 - int(255 * cells[h][w]  )
      _snake_case		=							(color, color, color)
  return img


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




from collections import namedtuple

__A    	=			namedtuple('''from_to''', '''from_ to''')

__A    	=			{
    '''atm''': from_to(1, 1),
    '''pascal''': from_to(0.000_0098, 10_13_25),
    '''bar''': from_to(0.98_6923, 1.0_1325),
    '''kilopascal''': from_to(0.0098_6923, 101.325),
    '''megapascal''': from_to(9.8_6923, 0.10_1325),
    '''psi''': from_to(0.06_8046, 14.6959),
    '''inHg''': from_to(0.033_4211, 29.9213),
    '''torr''': from_to(0.0013_1579, 7_60),
}



def    snake_case_(_UpperCamelCase				, _UpperCamelCase				, _UpperCamelCase  )							->			float:



  """simple docstring"""






  if from_type not in PRESSURE_CONVERSION:
    raise ValueError(
        F"""Invalid 'from_type' value: {from_type!r}  Supported values are:\n"""
        + ''', '''.join(_UpperCamelCase  )  )
  if to_type not in PRESSURE_CONVERSION:
    raise ValueError(
        F"""Invalid 'to_type' value: {to_type!r}.  Supported values are:\n"""
        + ''', '''.join(_UpperCamelCase  )  )
  return (
      value * PRESSURE_CONVERSION[from_type].from_ * PRESSURE_CONVERSION[to_type].to
  )


if __name__ == "__main__":
 import doctest

 doctest.testmod()

