




'''simple docstring'''

import bza
import gzip
import lzma
import os
import shutil
import struct
import tarfile
import warnings
import zipfile
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Dict, List, Optional, Type, Union

from .. import config
from .filelock import FileLock
from .logging import get_logger


a    :							Union[str, Any]										=    get_logger(__name__)






class 		a							:


				def __init__(						self       :   int			,							lowercase_       :   Optional[str] = None   ):
									snake_case_		     =							(
									    os.path.join(lowercase_			,							config.EXTRACTED_DATASETS_DIR   ) if cache_dir else config.EXTRACTED_DATASETS_PATH
									)
									snake_case_		     =							Extractor


				def     A_					(						self       :   Dict			,							lowercase_       :   str   ):
									from .file_utils import hash_url_to_filename

									# Path where we extract compressed archives
									# We extract in the cache dir, and get the extracted path name by hashing the original path"
									snake_case_		     =							os.path.abspath(lowercase_   )
									return os.path.join(self.extract_dir			,							hash_url_to_filename(lowercase_   )   )


				def     A_					(						self       :   List[Any]			,							lowercase_       :   str			,							lowercase_       :   bool   ):
									return force_extract or (
									    not os.path.isfile(lowercase_   ) and not (os.path.isdir(lowercase_   ) and os.listdir(lowercase_   ))
									)


				def     A_					(						self       :   Optional[int]			,							lowercase_       :   str			,							lowercase_       :   bool = False   ):
									snake_case_		     =							self.extractor.infer_extractor_format(lowercase_   )
									if not extractor_format:
														return input_path
									snake_case_		     =							self._get_output_path(lowercase_   )
									if self._do_extract(lowercase_			,							lowercase_   ):
														self.extractor.extract(lowercase_			,							lowercase_			,							lowercase_   )
									return output_path







class 		a							(  _lowerCamelCase	):


				@classmethod
				@abstractmethod
				def     A_					(						cls       :   str			,							lowercase_       :   Union[Path, str]			,							**lowercase_       :   List[str]   ):
									...


				@staticmethod
				@abstractmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									...







class 		a							(  _lowerCamelCase  ,	_lowerCamelCase	):
				snake_case_           =						[]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   int   ):
									with open(lowercase_			,							'''rb'''   ) as f:
														return f.read(lowercase_   )


				@classmethod
				def     A_					(						cls       :   str			,							lowercase_       :   Union[Path, str]			,							lowercase_       :   bytes = b""   ):
									if not magic_number:
														snake_case_		     =							max(len(lowercase_   ) for cls_magic_number in cls.magic_numbers   )
														try:
																			snake_case_		     =							cls.read_magic_number(lowercase_			,							lowercase_   )
														except OSError:
																			return False
									return any(magic_number.startswith(lowercase_   ) for cls_magic_number in cls.magic_numbers   )







class 		a							(  _lowerCamelCase	):


				@classmethod
				def     A_					(						cls       :   Union[str, Any]			,							lowercase_       :   Union[Path, str]			,							**lowercase_       :   Optional[int]   ):
									return tarfile.is_tarfile(lowercase_   )


				@staticmethod
				def     A_					(						lowercase_       :   Any			,							lowercase_       :   Any   ):

									def resolved(lowercase_       :   str   ) -> str:
														return os.path.realpath(os.path.abspath(lowercase_   )   )

									def badpath(lowercase_       :   str			,							lowercase_       :   str   ) -> bool:
														# joinpath will ignore base if path is absolute
														return not resolved(os.path.join(lowercase_			,							lowercase_   )   ).startswith(lowercase_   )

									def badlink(lowercase_       :   List[Any]			,							lowercase_       :   str   ) -> bool:
														# Links are interpreted relative to the directory containing the link
														snake_case_		     =							resolved(os.path.join(lowercase_			,							os.path.dirname(info.name   )   )   )
														return badpath(info.linkname			,							base=lowercase_   )

									snake_case_		     =							resolved(lowercase_   )

									for finfo in members:
														if badpath(finfo.name			,							lowercase_   ):
																			logger.error(F"Extraction of {finfo.name} is blocked (illegal path)"   )
														elif finfo.issym() and badlink(lowercase_			,							lowercase_   ):
																			logger.error(F"Extraction of {finfo.name} is blocked: Symlink to {finfo.linkname}"   )
														elif finfo.islnk() and badlink(lowercase_			,							lowercase_   ):
																			logger.error(F"Extraction of {finfo.name} is blocked: Hard link to {finfo.linkname}"   )
														else:
																			yield finfo


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									os.makedirs(lowercase_			,							exist_ok=lowercase_   )
									snake_case_		     =							tarfile.open(lowercase_   )
									tar_file.extractall(lowercase_			,							members=TarExtractor.safemembers(lowercase_			,							lowercase_   )   )
									tar_file.close()







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"\x1F\x8B"]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									with gzip.open(lowercase_			,							'''rb'''   ) as gzip_file:
														with open(lowercase_			,							'''wb'''   ) as extracted_file:
																			shutil.copyfileobj(lowercase_			,							lowercase_   )







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[
				    b"PK\x03\x04",
				    b"PK\x05\x06",  # empty archive
				    b"PK\x07\x08",  # spanned archive
				]


				@classmethod
				def     A_					(						cls       :   int			,							lowercase_       :   Union[Path, str]			,							lowercase_       :   bytes = b""   ):
									if super().is_extractable(lowercase_			,							magic_number=lowercase_   ):
														return True
									try:
														# Alternative version of zipfile.is_zipfile that has less false positives, but misses executable zip archives.
														# From: https://github.com/python/cpython/pull/5053
														from zipfile import (
														    _CD_SIGNATURE,
														    _ECD_DISK_NUMBER,
														    _ECD_DISK_START,
														    _ECD_ENTRIES_TOTAL,
														    _ECD_OFFSET,
														    _ECD_SIZE,
														    _EndRecData,
														    sizeCentralDir,
														    stringCentralDir,
														    structCentralDir,
														)

														with open(lowercase_			,							'''rb'''   ) as fp:
																			snake_case_		     =							_EndRecData(lowercase_   )
																			if endrec:
																								if endrec[_ECD_ENTRIES_TOTAL] == 0 and endrec[_ECD_SIZE] == 0 and endrec[_ECD_OFFSET] == 0:
																													return True  # Empty zipfiles are still zipfiles
																								elif endrec[_ECD_DISK_NUMBER] == endrec[_ECD_DISK_START]:
																													fp.seek(endrec[_ECD_OFFSET]   )  # Central directory is on the same disk
																													if fp.tell() == endrec[_ECD_OFFSET] and endrec[_ECD_SIZE] >= sizeCentralDir:
																																		snake_case_		     =							fp.read(lowercase_   )  # CD is where we expect it to be
																																		if len(lowercase_   ) == sizeCentralDir:
																																							snake_case_		     =							struct.unpack(lowercase_			,							lowercase_   )  # CD is the right size
																																							if centdir[_CD_SIGNATURE] == stringCentralDir:
																																												return True  # First central directory entry  has correct magic number
														return False
									except Exception:  # catch all errors in case future python versions change the zipfile internals
														return False


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									os.makedirs(lowercase_			,							exist_ok=lowercase_   )
									with zipfile.ZipFile(lowercase_			,							'''r'''   ) as zip_file:
														zip_file.extractall(lowercase_   )
														zip_file.close()







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"\xFD\x37\x7A\x58\x5A\x00"]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									with lzma.open(lowercase_   ) as compressed_file:
														with open(lowercase_			,							'''wb'''   ) as extracted_file:
																			shutil.copyfileobj(lowercase_			,							lowercase_   )







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"Rar!\x1a\x07\x00", b"Rar!\x1a\x07\x01\x00"]  # RAR_ID  # RAR5_ID


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									if not config.RARFILE_AVAILABLE:
														raise ImportError('''Please pip install rarfile'''   )
									import rarfile

									os.makedirs(lowercase_			,							exist_ok=lowercase_   )
									snake_case_		     =							rarfile.RarFile(lowercase_   )
									rf.extractall(lowercase_   )
									rf.close()







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"\x28\xb5\x2F\xFD"]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									if not config.ZSTANDARD_AVAILABLE:
														raise ImportError('''Please pip install zstandard'''   )
									import zstandard as zstd

									snake_case_		     =							zstd.ZstdDecompressor()
									with open(lowercase_			,							'''rb'''   ) as ifh, open(lowercase_			,							'''wb'''   ) as ofh:
														dctx.copy_stream(lowercase_			,							lowercase_   )







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"\x42\x5A\x68"]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									with bza.open(lowercase_			,							'''rb'''   ) as compressed_file:
														with open(lowercase_			,							'''wb'''   ) as extracted_file:
																			shutil.copyfileobj(lowercase_			,							lowercase_   )







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"\x37\x7A\xBC\xAF\x27\x1C"]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									if not config.PY7ZR_AVAILABLE:
														raise ImportError('''Please pip install py7zr'''   )
									import pyazr

									os.makedirs(lowercase_			,							exist_ok=lowercase_   )
									with pyazr.SevenZipFile(lowercase_			,							'''r'''   ) as archive:
														archive.extractall(lowercase_   )







class 		a							(  _lowerCamelCase	):
				snake_case_           =						[b"\x04\x22\x4D\x18"]


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]   ):
									if not config.LZ4_AVAILABLE:
														raise ImportError('''Please pip install lz4'''   )
									import lza.frame

									with lza.frame.open(lowercase_			,							'''rb'''   ) as compressed_file:
														with open(lowercase_			,							'''wb'''   ) as extracted_file:
																			shutil.copyfileobj(lowercase_			,							lowercase_   )







class 		a							:
				#  Put zip file to the last, b/c it is possible wrongly detected as zip (I guess it means: as tar or gzip)
				snake_case_           =						{
				    "tar": TarExtractor,
				    "gzip": GzipExtractor,
				    "zip": ZipExtractor,
				    "xz": XzExtractor,
				    "rar": RarExtractor,
				    "zstd": ZstdExtractor,
				    "bz2": BzipaExtractor,
				    "7z": SevenZipExtractor,  # <Added version="2.4.0"/>
				    "lz4": LzaExtractor,  # <Added version="2.4.0"/>
				}


				@classmethod
				def     A_					(						cls       :   Optional[int]   ):
									return max(
									    len(lowercase_   )
									    for extractor in cls.extractors.values()
									    if issubclass(lowercase_			,							lowercase_   )
									    for extractor_magic_number in extractor.magic_numbers   )


				@staticmethod
				def     A_					(						lowercase_       :   Union[Path, str]			,							lowercase_       :   int   ):
									try:
														return MagicNumberBaseExtractor.read_magic_number(lowercase_			,							magic_number_length=lowercase_   )
									except OSError:
														return b""


				@classmethod
				def     A_					(						cls       :   Dict			,							lowercase_       :   Union[Path, str]			,							lowercase_       :   bool = False   ):
									warnings.warn(
									    '''Method \'is_extractable\' was deprecated in version 2.4.0 and will be removed in 3.0.0. '''
									    '''Use \'infer_extractor_format\' instead.'''			,							category=lowercase_			,							)
									snake_case_		     =							cls.infer_extractor_format(lowercase_   )
									if extractor_format:
														return True if not return_extractor else (True, cls.extractors[extractor_format])
									return False if not return_extractor else (False, None)


				@classmethod
				def     A_					(						cls       :   Tuple			,							lowercase_       :   Union[Path, str]   ):  # <Added version="2.4.0"/>
									snake_case_		     =							cls._get_magic_number_max_length()
									snake_case_		     =							cls._read_magic_number(lowercase_			,							lowercase_   )
									for extractor_format, extractor in cls.extractors.items():
														if extractor.is_extractable(lowercase_			,							magic_number=lowercase_   ):
																			return extractor_format


				@classmethod
				def     A_					(						cls       :   int			,							lowercase_       :   Union[Path, str]			,							lowercase_       :   Union[Path, str]			,							lowercase_       :   Optional[str] = None			,							lowercase_       :   Optional[BaseExtractor] = "deprecated"			,							):
									os.makedirs(os.path.dirname(lowercase_   )			,							exist_ok=lowercase_   )
									# Prevent parallel extractions
									snake_case_		     =							str(Path(lowercase_   ).with_suffix('''.lock'''   )   )
									with FileLock(lowercase_   ):
														shutil.rmtree(lowercase_			,							ignore_errors=lowercase_   )
														if extractor_format or extractor != "deprecated":
																			if extractor != "deprecated" or not isinstance(lowercase_			,							lowercase_   ):  # passed as positional arg
																								warnings.warn(
																								    '''Parameter \'extractor\' was deprecated in version 2.4.0 and will be removed in 3.0.0. '''
																								    '''Use \'extractor_format\' instead.'''			,							category=lowercase_			,							)
																								snake_case_		     =							extractor if extractor != '''deprecated''' else extractor_format
																			else:
																								snake_case_		     =							cls.extractors[extractor_format]
																			return extractor.extract(lowercase_			,							lowercase_   )
														else:
																			warnings.warn(
																			    '''Parameter \'extractor_format\' was made required in version 2.4.0 and not passing it will raise an '''
																			    '''exception in 3.0.0.'''			,							category=lowercase_			,							)
																			for extractor in cls.extractors.values():
																								if extractor.is_extractable(lowercase_   ):
																													return extractor.extract(lowercase_			,							lowercase_   )







'''simple docstring'''

import heapq
import sys

import numpy as np

a    :							Dict										=    tuple[int, int]






class 		a							:


				def __init__(						self       :   Dict   ):
									snake_case_		     =							[]
									snake_case_		     =							set()


				def     A_					(						self       :   int   ):
									if not self.empty():
														return self.elements[0][0]
									else:
														return float('''inf'''   )


				def     A_					(						self       :   List[str]   ):
									return len(self.elements   ) == 0


				def     A_					(						self       :   Union[str, Any]			,							lowercase_       :   str			,							lowercase_       :   List[str]   ):
									if item not in self.set:
														heapq.heappush(self.elements			,							(priority, item)   )
														self.set.add(lowercase_   )
									else:
														# update
														# print("update", item)
														snake_case_		     =							[]
														((snake_case_)     ,(snake_case_))		     =							heapq.heappop(self.elements   )
														while x != item:
																			temp.append((pri, x)   )
																			((snake_case_)     ,(snake_case_))		     =							heapq.heappop(self.elements   )
														temp.append((priority, item)   )
														for pro, xxx in temp:
																			heapq.heappush(self.elements			,							(pro, xxx)   )


				def     A_					(						self       :   Union[str, Any]			,							lowercase_       :   List[Any]   ):
									if item in self.set:
														self.set.remove(lowercase_   )
														snake_case_		     =							[]
														((snake_case_)     ,(snake_case_))		     =							heapq.heappop(self.elements   )
														while x != item:
																			temp.append((pro, x)   )
																			((snake_case_)     ,(snake_case_))		     =							heapq.heappop(self.elements   )
														for prito, yyy in temp:
																			heapq.heappush(self.elements			,							(prito, yyy)   )


				def     A_					(						self       :   Optional[int]   ):
									return self.elements[0][1]


				def     A_					(						self       :   Tuple   ):
									((snake_case_)     ,(snake_case_))		     =							heapq.heappop(self.elements   )
									self.set.remove(lowercase_   )
									return (priority, item)







def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase      )						->   Any:

					'''simple docstring'''

					snake_case_		     =							np.array(__UpperCAmelCase      )
					snake_case_		     =							np.array(__UpperCAmelCase      )
					return np.linalg.norm(a - b      )


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase      )						->   int:

					'''simple docstring'''

					return consistent_heuristic(__UpperCAmelCase, __UpperCAmelCase      ) // t


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase      )						->   List[str]:

					'''simple docstring'''

					return abs(p[0] - goal[0]      ) + abs(p[1] - goal[1]      )


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )						->   Optional[int]:

					'''simple docstring'''

					snake_case_		     =							g_function[start] + Wa * heuristics[i](__UpperCAmelCase, __UpperCAmelCase      )
					return ans


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )						->   Optional[Any]:

					'''simple docstring'''

					snake_case_		     =							np.chararray((n, n)      )
					for i in range(__UpperCAmelCase      ):
										for j in range(__UpperCAmelCase      ):
															snake_case_		     =							'''*'''

					for i in range(__UpperCAmelCase      ):
										for j in range(__UpperCAmelCase      ):
															if (j, (n - 1) - i) in blocks:
																				snake_case_		     =							'''#'''

					snake_case_		     =							'''-'''
					snake_case_		     =							back_pointer[goal]
					while x != start:
										((snake_case_)     ,(snake_case_))		     =							x
										# print(x)
										snake_case_		     =							'''-'''
										snake_case_		     =							back_pointer[x]
					snake_case_		     =							'''-'''

					for i in range(__UpperCAmelCase      ):
										for j in range(__UpperCAmelCase      ):
															if (i, j) == (0, n - 1):
																				print(grid[i][j], end=''' '''      )
																				print('''<-- End position''', end=''' '''      )
															else:
																				print(grid[i][j], end=''' '''      )
										print()
					print('''^'''      )
					print('''Start position'''      )
					print()
					print('''# is an obstacle'''      )
					print('''- is the path taken by algorithm'''      )
					print('''PATH TAKEN BY THE ALGORITHM IS:-'''      )
					snake_case_		     =							back_pointer[goal]
					while x != start:
										print(__UpperCAmelCase, end=''' '''      )
										snake_case_		     =							back_pointer[x]
					print(__UpperCAmelCase      )
					sys.exit()


def 						__magic_name__       (      __UpperCAmelCase      )						->   int:

					'''simple docstring'''

					if p[0] < 0 or p[0] > n - 1:
										return False
					if p[1] < 0 or p[1] > n - 1:
										return False
					return True


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, )						->   str:

					'''simple docstring'''

					for itera in range(__UpperCAmelCase      ):
										open_list[itera].remove_element(__UpperCAmelCase      )
					# print("s", s)
					# print("j", j)
					((snake_case_)     ,(snake_case_))		     =							s
					snake_case_		     =							(x - 1, y)
					snake_case_		     =							(x + 1, y)
					snake_case_		     =							(x, y + 1)
					snake_case_		     =							(x, y - 1)

					for neighbours in [left, right, up, down]:
										if neighbours not in blocks:
															if valid(__UpperCAmelCase      ) and neighbours not in visited:
																				# print("neighbour", neighbours)
																				visited.add(__UpperCAmelCase      )
																				snake_case_		     =							-1
																				snake_case_		     =							float('''inf'''      )

															if valid(__UpperCAmelCase      ) and g_function[neighbours] > g_function[s] + 1:
																				snake_case_		     =							g_function[s] + 1
																				snake_case_		     =							s
																				if neighbours not in close_list_anchor:
																									open_list[0].put(__UpperCAmelCase, key(__UpperCAmelCase, 0, __UpperCAmelCase, __UpperCAmelCase      )      )
																									if neighbours not in close_list_inad:
																														for var in range(1, __UpperCAmelCase      ):
																																			if key(__UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      ) <= Wa * key(
																																			    __UpperCAmelCase, 0, __UpperCAmelCase, __UpperCAmelCase      ):
																																								open_list[j].put(
																																								    __UpperCAmelCase, key(__UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )      )


def 						__magic_name__       (      )						->   str:

					'''simple docstring'''

					snake_case_		     =							[]
					for x in range(1, 5      ):
										for y in range(1, 6      ):
															some_list.append((x, y)      )

					for x in range(15, 20      ):
										some_list.append((x, 17)      )

					for x in range(10, 19      ):
										for y in range(1, 15      ):
															some_list.append((x, y)      )

    # L block
					for x in range(1, 4      ):
										for y in range(12, 19      ):
															some_list.append((x, y)      )
					for x in range(3, 13      ):
										for y in range(16, 19      ):
															some_list.append((x, y)      )
					return some_list


a    :							Tuple										=    {0: consistent_heuristic, 1: heuristic_a, 2: heuristic_a}

a    :							Dict										=    [
    (0, 1),
    (1, 1),
    (2, 1),
    (3, 1),
    (4, 1),
    (5, 1),
    (6, 1),
    (7, 1),
    (8, 1),
    (9, 1),
    (10, 1),
    (11, 1),
    (12, 1),
    (13, 1),
    (14, 1),
    (15, 1),
    (16, 1),
    (17, 1),
    (18, 1),
    (19, 1),
]
a    :							List[str]										=    make_common_ground()


a    :							Optional[int]										=    blocks_blk
# hyper parameters
a    :							Union[str, Any]										=    1
a    :							str										=    1
a    :							int										=    20
a    :							Optional[int]										=    3  # one consistent and two other inconsistent

# start and end destination
a    :							List[str]										=    (0, 0)
a    :							str										=    (n - 1, n - 1)

a    :							str										=    1


def 						__magic_name__       (      __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )						->   List[str]:

					'''simple docstring'''

					snake_case_		     =							{start: 0, goal: float('''inf'''      )}
					snake_case_		     =							{start: -1, goal: -1}
					snake_case_		     =							[]
					snake_case_		     =							set()

					for i in range(__UpperCAmelCase      ):
										open_list.append(PriorityQueue()      )
										open_list[i].put(__UpperCAmelCase, key(__UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )      )

					snake_case_		     =							[]
					snake_case_		     =							[]
					while open_list[0].minkey() < float('''inf'''      ):
										for i in range(1, __UpperCAmelCase      ):
															# print(open_list[0].minkey(), open_list[i].minkey())
															if open_list[i].minkey() <= Wa * open_list[0].minkey():
																				global t
																				t += 1
																				if g_function[goal] <= open_list[i].minkey():
																									if g_function[goal] < float('''inf'''      ):
																														do_something(__UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )
																				else:
																									snake_case_     ,snake_case_		     =							open_list[i].top_show()
																									visited.add(__UpperCAmelCase      )
																									expand_state(
																									    __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, )
																									close_list_inad.append(__UpperCAmelCase      )
															else:
																				if g_function[goal] <= open_list[0].minkey():
																									if g_function[goal] < float('''inf'''      ):
																														do_something(__UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase      )
																				else:
																									snake_case_		     =							open_list[0].top_show()
																									visited.add(__UpperCAmelCase      )
																									expand_state(
																									    __UpperCAmelCase, 0, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, )
																									close_list_anchor.append(__UpperCAmelCase      )
					print('''No path found to goal'''      )
					print()
					for i in range(n - 1, -1, -1      ):
										for j in range(__UpperCAmelCase      ):
															if (j, i) in blocks:
																				print('''#''', end=''' '''      )
															elif (j, i) in back_pointer:
																				if (j, i) == (n - 1, n - 1):
																									print('''*''', end=''' '''      )
																				else:
																									print('''-''', end=''' '''      )
															else:
																				print('''*''', end=''' '''      )
															if (j, i) == (n - 1, n - 1):
																				print('''<-- End position''', end=''' '''      )
										print()
					print('''^'''      )
					print('''Start position'''      )
					print()
					print('''# is an obstacle'''      )
					print('''- is the path taken by algorithm'''      )


if __name__ == "__main__":
							multi_a_star(start, goal, n_heuristic)

