



"""simple docstring"""







import numpy as np
class        __A       :







		'''simple docstring'''





		def __init__(	self						:  List[Any]						)					->		int:






				"""simple docstring"""



				lowercase__   :    Union[str, Any]				=			(0, 0)
				lowercase__   :    str				=			None
				lowercase__   :    str				=			0
				lowercase__   :    Dict				=			0
				lowercase__   :    Optional[int]				=			0







		def __eq__(	self						:  Any			,_snake_case						:  str						)					->		str:






				"""simple docstring"""



				return self.position == cell.position







		def 					UpperCAmelCase    (	self						:  int						)					->		str:






				"""simple docstring"""



				print(self.position						)





class        __A       :







		'''simple docstring'''





		def __init__(	self						:  int			,_snake_case						:  Any=(5, 5)						)					->		Union[str, Any]:






				"""simple docstring"""



				lowercase__   :    Any				=			np.zeros(SCREAMING_SNAKE_CASE_						)
				lowercase__   :    Optional[int]				=			world_size[0]
				lowercase__   :    Union[str, Any]				=			world_size[1]







		def 					UpperCAmelCase    (	self						:  int						)					->		Dict:






				"""simple docstring"""



				print(self.w						)







		def 					UpperCAmelCase    (	self						:  Any			,_snake_case						:  Optional[Any]						)					->		Dict:






				"""simple docstring"""



				lowercase__   :    Optional[Any]				=			[
				    (-1, -1),
				    (-1, 0),
				    (-1, 1),
				    (0, -1),
				    (0, 1),
				    (1, -1),
				    (1, 0),
				    (1, 1),
				]
				lowercase__   :    List[str]				=			cell.position[0]
				lowercase__   :    Tuple				=			cell.position[1]
				lowercase__   :    Optional[Any]				=			[]
				for n in neughbour_cord:
						lowercase__   :    Any				=			current_x + n[0]
						lowercase__   :    Optional[int]				=			current_y + n[1]
						if 0 <= x < self.world_x_limit and 0 <= y < self.world_y_limit:
								lowercase__   :    List[Any]				=			Cell()
								lowercase__   :    Optional[int]				=			(x, y)
								lowercase__   :    List[Any]				=			cell
								neighbours.append(SCREAMING_SNAKE_CASE_						)
				return neighbours





def      __UpperCAmelCase      (    __lowerCamelCase						,     __lowerCamelCase						,     __lowerCamelCase	)							->      Dict:
		lowercase__   :    Union[str, Any]				=			[]
		lowercase__   :    Optional[int]				=			[]
		_open.append(snake_case__	)

		while _open:
				lowercase__   :    List[str]				=			np.argmin([n.f for n in _open]	)
				lowercase__   :    Optional[int]				=			_open[min_f]
				_closed.append(_open.pop(snake_case__	)	)
				if current == goal:
						break
				for n in world.get_neigbours(snake_case__	):
						for c in _closed:
								if c == n:
										continue
						lowercase__   :    Tuple				=			current.g + 1
						lowercase__   :    Any				=			n.position
						lowercase__   :    str				=			goal.position
						lowercase__   :    Tuple				=			(ya - ya) ** 2 + (xa - xa) ** 2
						lowercase__   :    List[str]				=			n.h + n.g

						for c in _open:
								if c == n and c.f < n.f:
										continue
						_open.append(snake_case__	)
		lowercase__   :    Any				=			[]
		while current.parent is not None:
				path.append(current.position	)
				lowercase__   :    Optional[int]				=			current.parent
		path.append(current.position	)
		return path[::-1]


if __name__ == "__main__":
							lowerCAmelCase_   						=   Gridworld()
							# Start position and goal
							lowerCAmelCase_   						=   Cell()
							lowerCAmelCase_   						=   (0, 0)
							lowerCAmelCase_   						=   Cell()
							lowerCAmelCase_   						=   (4, 4)
							print(F'''path from {start.position} to {goal.position}''')
							lowerCAmelCase_   						=   astar(world, start, goal)
							#   Just for visual reasons.
							for i in s:
														lowerCAmelCase_   						=   1
							print(world.w)





def 		UpperCamelCase	(   snake_case__       :    int       ,     snake_case__       :    int	)	->     int:
   return int(input_a == input_a == 0	)
def 		UpperCamelCase	(   )	->     None:
   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()



