






def 					lowercase__				(					__snake_case   :							int					,	__snake_case   :							int  ):


					'''simple docstring'''


					return int(input_a == input_a == 0  )




def 					lowercase__				(					):


					'''simple docstring'''


					print('Truth Table of NOR Gate:'  )
					print('|   Input 1   |  Input 2  | Output |'  )
					print(F"|      0      |    0      |  {nor_gate(0					,	0  )}     |"  )
					print(F"|      0      |    1      |  {nor_gate(0					,	1  )}     |"  )
					print(F"|      1      |    0      |  {nor_gate(1					,	0  )}     |"  )
					print(F"|      1      |    1      |  {nor_gate(1					,	1  )}     |"  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		main()














import random
import sys

import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap

__UpperCAmelCase     							=						'Usage of script: script_name <size_of_canvas:int>'

__UpperCAmelCase     							=						[0] * 100 + [1] * 10
random.shuffle(choice)




def 					lowercase__				(					__snake_case   :							int  ):


					'''simple docstring'''


					UpperCAmelCase_   :				Any						=						[[False for i in range(__snake_case  )] for j in range(__snake_case  )]
					return canvas




def 					lowercase__				(					__snake_case   :							list[list[bool]]  ):


					'''simple docstring'''


					for i, row in enumerate(__snake_case  ):
										for j, _ in enumerate(__snake_case  ):
															UpperCAmelCase_   :				Tuple						=						bool(random.getrandbits(1  )  )




def 					lowercase__				(					__snake_case   :							list[list[bool]]  ):


					'''simple docstring'''


					UpperCAmelCase_   :				List[Any]						=						np.array(__snake_case  )
					UpperCAmelCase_   :				Any						=						np.array(create_canvas(current_canvas.shape[0]  )  )
					for r, row in enumerate(__snake_case  ):
										for c, pt in enumerate(__snake_case  ):
															UpperCAmelCase_   :				Optional[int]						=						__judge_point(
															    __snake_case					,	current_canvas[r - 1 : r + 2, c - 1 : c + 2]  )

					UpperCAmelCase_   :				List[Any]						=						next_gen_canvas
					del next_gen_canvas  # cleaning memory as we move on.
					UpperCAmelCase_   :				list[list[bool]]						=						current_canvas.tolist()
					return return_canvas




def 					lowercase__				(					__snake_case   :							bool					,	__snake_case   :							list[list[bool]]  ):


					'''simple docstring'''


					UpperCAmelCase_   :				Optional[int]						=						0
					UpperCAmelCase_   :				List[Any]						=						0
					# finding dead or alive neighbours count.
					for i in neighbours:
										for status in i:
															if status:
																				alive += 1
															else:
																				dead += 1

    # handling duplicate entry for focus pt.
					if pt:
										alive -= 1
					else:
										dead -= 1

					# running the rules of game here.
					UpperCAmelCase_   :				List[Any]						=						pt
					if pt:
										if alive < 2:
															UpperCAmelCase_   :				str						=						False
										elif alive == 2 or alive == 3:
															UpperCAmelCase_   :				int						=						True
										elif alive > 3:
															UpperCAmelCase_   :				List[Any]						=						False
					else:
										if alive == 3:
															UpperCAmelCase_   :				int						=						True

					return state


if __name__ == "__main__":
		if len(sys.argv) != 2:
				raise Exception(usage_doc)

		__UpperCAmelCase     							=						int(sys.argv[1])
		# main working structure of this module.
		__UpperCAmelCase     							=						create_canvas(canvas_size)
		seed(c)
		__UpperCAmelCase							,       __UpperCAmelCase     							=						plt.subplots()
		fig.show()
		__UpperCAmelCase     							=						ListedColormap(['w', 'k'])
		try:
				while True:
						__UpperCAmelCase     							=						run(c)
						ax.matshow(c, cmap=cmap)
						fig.canvas.draw()
						ax.cla()
		except KeyboardInterrupt:
				# do nothing.
				pass






