




import argparse
import json
from pathlib import Path

import requests
import torch
from huggingface_hub import cached_download, hf_hub_url
from PIL import Image

from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor
from transformers.utils import logging


logging.set_verbosity_info()
a_   		=     logging.get_logger(__name__)




def 					__SCREAMING_SNAKE_CASE   (  lowercase_      )       ->	Tuple:

    """simple docstring"""


    __UpperCamelCase  		=						DPTConfig()

    if "large" in checkpoint_url:
        __UpperCamelCase  		=						10_24
        __UpperCamelCase  		=						40_96
        __UpperCamelCase  		=						24
        __UpperCamelCase  		=						16
        __UpperCamelCase  		=						[5, 11, 17, 23]
        __UpperCamelCase  		=						[2_56, 5_12, 10_24, 10_24]
        __UpperCamelCase  		=						(1, 3_84, 3_84)

    if "ade" in checkpoint_url:
        __UpperCamelCase  		=						True

        __UpperCamelCase  		=						1_50
        __UpperCamelCase  		=						'''huggingface/label-files'''
        __UpperCamelCase  		=						'''ade20k-id2label.json'''
        __UpperCamelCase  		=						json.load(open(cached_download(hf_hub_url(lowercase_					,     lowercase_					,     repo_type='''dataset'''      )      )					,     '''r'''      )      )
        __UpperCamelCase  		=						{int(lowercase_      ): v for k, v in idalabel.items()}
        __UpperCamelCase  		=						idalabel
        __UpperCamelCase  		=						{v: k for k, v in idalabel.items()}
        __UpperCamelCase  		=						[1, 1_50, 4_80, 4_80]

    return config, expected_shape




def 					__SCREAMING_SNAKE_CASE   (  lowercase_      )       ->	Optional[Any]:

    """simple docstring"""


    __UpperCamelCase  		=						['''pretrained.model.head.weight''', '''pretrained.model.head.bias''']
    for k in ignore_keys:
        state_dict.pop(lowercase_					,     lowercase_      )




def 					__SCREAMING_SNAKE_CASE   (  lowercase_      )       ->	Any:

    """simple docstring"""


    if (
        "pretrained.model" in name
        and "cls_token" not in name
        and "pos_embed" not in name
        and "patch_embed" not in name
    ):
        __UpperCamelCase  		=						name.replace('''pretrained.model'''					,     '''dpt.encoder'''      )
    if "pretrained.model" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.model'''					,     '''dpt.embeddings'''      )
    if "patch_embed" in name:
        __UpperCamelCase  		=						name.replace('''patch_embed'''					,     '''patch_embeddings'''      )
    if "pos_embed" in name:
        __UpperCamelCase  		=						name.replace('''pos_embed'''					,     '''position_embeddings'''      )
    if "attn.proj" in name:
        __UpperCamelCase  		=						name.replace('''attn.proj'''					,     '''attention.output.dense'''      )
    if "proj" in name and "project" not in name:
        __UpperCamelCase  		=						name.replace('''proj'''					,     '''projection'''      )
    if "blocks" in name:
        __UpperCamelCase  		=						name.replace('''blocks'''					,     '''layer'''      )
    if "mlp.fc1" in name:
        __UpperCamelCase  		=						name.replace('''mlp.fc1'''					,     '''intermediate.dense'''      )
    if "mlp.fc2" in name:
        __UpperCamelCase  		=						name.replace('''mlp.fc2'''					,     '''output.dense'''      )
    if "norm1" in name:
        __UpperCamelCase  		=						name.replace('''norm1'''					,     '''layernorm_before'''      )
    if "norm2" in name:
        __UpperCamelCase  		=						name.replace('''norm2'''					,     '''layernorm_after'''      )
    if "scratch.output_conv" in name:
        __UpperCamelCase  		=						name.replace('''scratch.output_conv'''					,     '''head'''      )
    if "scratch" in name:
        __UpperCamelCase  		=						name.replace('''scratch'''					,     '''neck'''      )
    if "layer1_rn" in name:
        __UpperCamelCase  		=						name.replace('''layer1_rn'''					,     '''convs.0'''      )
    if "layer2_rn" in name:
        __UpperCamelCase  		=						name.replace('''layer2_rn'''					,     '''convs.1'''      )
    if "layer3_rn" in name:
        __UpperCamelCase  		=						name.replace('''layer3_rn'''					,     '''convs.2'''      )
    if "layer4_rn" in name:
        __UpperCamelCase  		=						name.replace('''layer4_rn'''					,     '''convs.3'''      )
    if "refinenet" in name:
        __UpperCamelCase  		=						int(name[len('''neck.refinenet'''      ) : len('''neck.refinenet'''      ) + 1]      )
        # tricky here: we need to map 4 to 0, 3 to 1, 2 to 2 and 1 to 3
        __UpperCamelCase  		=						name.replace(F"refinenet{layer_idx}"					,     F"fusion_stage.layers.{abs(layer_idx-4      )}"      )
    if "out_conv" in name:
        __UpperCamelCase  		=						name.replace('''out_conv'''					,     '''projection'''      )
    if "resConfUnit1" in name:
        __UpperCamelCase  		=						name.replace('''resConfUnit1'''					,     '''residual_layer1'''      )
    if "resConfUnit2" in name:
        __UpperCamelCase  		=						name.replace('''resConfUnit2'''					,     '''residual_layer2'''      )
    if "conv1" in name:
        __UpperCamelCase  		=						name.replace('''conv1'''					,     '''convolution1'''      )
    if "conv2" in name:
        __UpperCamelCase  		=						name.replace('''conv2'''					,     '''convolution2'''      )
    # readout blocks
    if "pretrained.act_postprocess1.0.project.0" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess1.0.project.0'''					,     '''neck.reassemble_stage.readout_projects.0.0'''      )
    if "pretrained.act_postprocess2.0.project.0" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess2.0.project.0'''					,     '''neck.reassemble_stage.readout_projects.1.0'''      )
    if "pretrained.act_postprocess3.0.project.0" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess3.0.project.0'''					,     '''neck.reassemble_stage.readout_projects.2.0'''      )
    if "pretrained.act_postprocess4.0.project.0" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess4.0.project.0'''					,     '''neck.reassemble_stage.readout_projects.3.0'''      )
    # resize blocks
    if "pretrained.act_postprocess1.3" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess1.3'''					,     '''neck.reassemble_stage.layers.0.projection'''      )
    if "pretrained.act_postprocess1.4" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess1.4'''					,     '''neck.reassemble_stage.layers.0.resize'''      )
    if "pretrained.act_postprocess2.3" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess2.3'''					,     '''neck.reassemble_stage.layers.1.projection'''      )
    if "pretrained.act_postprocess2.4" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess2.4'''					,     '''neck.reassemble_stage.layers.1.resize'''      )
    if "pretrained.act_postprocess3.3" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess3.3'''					,     '''neck.reassemble_stage.layers.2.projection'''      )
    if "pretrained.act_postprocess4.3" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess4.3'''					,     '''neck.reassemble_stage.layers.3.projection'''      )
    if "pretrained.act_postprocess4.4" in name:
        __UpperCamelCase  		=						name.replace('''pretrained.act_postprocess4.4'''					,     '''neck.reassemble_stage.layers.3.resize'''      )
    if "pretrained" in name:
        __UpperCamelCase  		=						name.replace('''pretrained'''					,     '''dpt'''      )
    if "bn" in name:
        __UpperCamelCase  		=						name.replace('''bn'''					,     '''batch_norm'''      )
    if "head" in name:
        __UpperCamelCase  		=						name.replace('''head'''					,     '''head.head'''      )
    if "encoder.norm" in name:
        __UpperCamelCase  		=						name.replace('''encoder.norm'''					,     '''layernorm'''      )
    if "auxlayer" in name:
        __UpperCamelCase  		=						name.replace('''auxlayer'''					,     '''auxiliary_head.head'''      )

    return name




def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_      )       ->	Any:

    """simple docstring"""


    for i in range(config.num_hidden_layers      ):
        # read in weights + bias of input projection layer (in timm, this is a single matrix + bias)
        __UpperCamelCase  		=						state_dict.pop(F"dpt.encoder.layer.{i}.attn.qkv.weight"      )
        __UpperCamelCase  		=						state_dict.pop(F"dpt.encoder.layer.{i}.attn.qkv.bias"      )
        # next, add query, keys and values (in that order) to the state dict
        __UpperCamelCase  		=						in_proj_weight[: config.hidden_size, :]
        __UpperCamelCase  		=						in_proj_bias[: config.hidden_size]
        __UpperCamelCase  		=						in_proj_weight[
            config.hidden_size : config.hidden_size * 2, :
        ]
        __UpperCamelCase  		=						in_proj_bias[
            config.hidden_size : config.hidden_size * 2
        ]
        __UpperCamelCase  		=						in_proj_weight[
            -config.hidden_size :, :
        ]
        __UpperCamelCase  		=						in_proj_bias[-config.hidden_size :]




def 					__SCREAMING_SNAKE_CASE   (  )       ->	int:

    """simple docstring"""


    __UpperCamelCase  		=						'''http://images.cocodataset.org/val2017/000000039769.jpg'''
    __UpperCamelCase  		=						Image.open(requests.get(lowercase_					,     stream=lowercase_      ).raw      )
    return im




@torch.no_grad()
def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_					,     lowercase_					,     lowercase_      )       ->	int:

    """simple docstring"""


    __UpperCamelCase		,      __UpperCamelCase  		=						get_dpt_config(lowercase_      )
    # load original state_dict from URL
    __UpperCamelCase  		=						torch.hub.load_state_dict_from_url(lowercase_					,     map_location='''cpu'''      )
    # remove certain keys
    remove_ignore_keys_(lowercase_      )
    # rename keys
    for key in state_dict.copy().keys():
        __UpperCamelCase  		=						state_dict.pop(lowercase_      )
        __UpperCamelCase  		=						val
    # read in qkv matrices
    read_in_q_k_v(lowercase_					,     lowercase_      )

    # load HuggingFace model
    __UpperCamelCase  		=						DPTForSemanticSegmentation(lowercase_      ) if '''ade''' in checkpoint_url else DPTForDepthEstimation(lowercase_      )
    model.load_state_dict(lowercase_      )
    model.eval()

    # Check outputs on an image
    __UpperCamelCase  		=						4_80 if '''ade''' in checkpoint_url else 3_84
    __UpperCamelCase  		=						DPTImageProcessor(size=lowercase_      )

    __UpperCamelCase  		=						prepare_img()
    __UpperCamelCase  		=						image_processor(lowercase_					,     return_tensors='''pt'''      )

    # forward pass
    __UpperCamelCase  		=						model(**lowercase_      ).logits if '''ade''' in checkpoint_url else model(**lowercase_      ).predicted_depth

    # Assert logits
    __UpperCamelCase  		=						torch.tensor([[6.3199, 6.3629, 6.4148], [6.3850, 6.3615, 6.4166], [6.3519, 6.3176, 6.3575]]      )
    if "ade" in checkpoint_url:
        __UpperCamelCase  		=						torch.tensor([[4.0480, 4.2420, 4.4360], [4.3124, 4.5693, 4.8261], [4.5768, 4.8965, 5.2163]]      )
    assert outputs.shape == torch.Size(lowercase_      )
    assert (
        torch.allclose(outputs[0, 0, :3, :3]					,     lowercase_					,     atol=1E-4      )
        if "ade" in checkpoint_url
        else torch.allclose(outputs[0, :3, :3]					,     lowercase_      )
    )

    Path(lowercase_      ).mkdir(exist_ok=lowercase_      )
    print(F"Saving model to {pytorch_dump_folder_path}"      )
    model.save_pretrained(lowercase_      )
    print(F"Saving image processor to {pytorch_dump_folder_path}"      )
    image_processor.save_pretrained(lowercase_      )

    if push_to_hub:
        print('''Pushing model to hub...'''      )
        model.push_to_hub(
            repo_path_or_name=Path(lowercase_					,     lowercase_      )					,     organization='''nielsr'''					,     commit_message='''Add model'''					,     use_temp_dir=lowercase_					,     )
        image_processor.push_to_hub(
            repo_path_or_name=Path(lowercase_					,     lowercase_      )					,     organization='''nielsr'''					,     commit_message='''Add image processor'''					,     use_temp_dir=lowercase_					,     )


if __name__ == "__main__":
 a_   		=     argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     "--checkpoint_url",
     default="https://github.com/intel-isl/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt",
     type=str,
     help="URL of the original DPT checkpoint you'd like to convert.",
 )
 parser.add_argument(
     "--pytorch_dump_folder_path",
     default=None,
     type=str,
     required=True,
     help="Path to the output PyTorch model directory.",
 )
 parser.add_argument(
     "--push_to_hub",
     action="store_true",
 )
 parser.add_argument(
     "--model_name",
     default="dpt-large",
     type=str,
     help="Name of the model, in case you're pushing to the hub.",
 )

 a_   		=     parser.parse_args()
 convert_dpt_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path, args.push_to_hub, args.model_name)












import heapq
import sys

import numpy as np

a_   		=     tuple[int, int]

class  _lowerCamelCase						:

      """simple docstring"""

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







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







      def       snake_case	(     self					: Optional[Any]				):
          return len(self.elements				) == 0







      def       snake_case	(     self					: Optional[int] ,       snake_case					: Tuple ,       snake_case					: Any				):
          if item not in self.set:
              heapq.heappush(self.elements ,       (priority, item)				)
              self.set.add(snake_case				)
          else:
              # update
              # print("update", item)
              __UpperCamelCase  		=						[]
              ((__UpperCamelCase)		,      (__UpperCamelCase))  		=						heapq.heappop(self.elements				)
              while x != item:
                  temp.append((pri, x)				)
                  ((__UpperCamelCase)		,      (__UpperCamelCase))  		=						heapq.heappop(self.elements				)
              temp.append((priority, item)				)
              for pro, xxx in temp:
                  heapq.heappush(self.elements ,       (pro, xxx)				)







      def       snake_case	(     self					: Any ,       snake_case					: int				):
          if item in self.set:
              self.set.remove(snake_case				)
              __UpperCamelCase  		=						[]
              ((__UpperCamelCase)		,      (__UpperCamelCase))  		=						heapq.heappop(self.elements				)
              while x != item:
                  temp.append((pro, x)				)
                  ((__UpperCamelCase)		,      (__UpperCamelCase))  		=						heapq.heappop(self.elements				)
              for prito, yyy in temp:
                  heapq.heappush(self.elements ,       (prito, yyy)				)







      def       snake_case	(     self					: Tuple				):
          return self.elements[0][1]







      def       snake_case	(     self					: List[str]				):
          ((__UpperCamelCase)		,      (__UpperCamelCase))  		=						heapq.heappop(self.elements				)
          self.set.remove(snake_case				)
          return (priority, item)







def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_      )       ->	Tuple:

    """simple docstring"""


    __UpperCamelCase  		=						np.array(lowercase_      )
    __UpperCamelCase  		=						np.array(lowercase_      )
    return np.linalg.norm(a - b      )




def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_      )       ->	int:

    """simple docstring"""


    return consistent_heuristic(lowercase_					,     lowercase_      ) // t




def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_      )       ->	Dict:

    """simple docstring"""


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




def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_					,     lowercase_					,     lowercase_      )       ->	str:

    """simple docstring"""


    __UpperCamelCase  		=						g_function[start] + Wa * heuristics[i](lowercase_					,     lowercase_      )
    return ans




def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_					,     lowercase_      )       ->	Dict:

    """simple docstring"""


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

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

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

    for i in range(lowercase_      ):
        for j in range(lowercase_      ):
            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:-'''      )
    __UpperCamelCase  		=						back_pointer[goal]
    while x != start:
        print(lowercase_					,     end=''' '''      )
        __UpperCamelCase  		=						back_pointer[x]
    print(lowercase_      )
    sys.exit()




def 					__SCREAMING_SNAKE_CASE   (  lowercase_      )       ->	List[Any]:

    """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 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     )       ->	Tuple:

    """simple docstring"""


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

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

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




def 					__SCREAMING_SNAKE_CASE   (  )       ->	str:

    """simple docstring"""


    __UpperCamelCase  		=						[]
    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_   		=     {0: consistent_heuristic, 1: heuristic_a, 2: heuristic_a}

a_   		=     [
    (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_   		=     make_common_ground()


a_   		=     blocks_blk
# hyper parameters
a_   		=     1
a_   		=     1
a_   		=     20
a_   		=     3  # one consistent and two other inconsistent

# start and end destination
a_   		=     (0, 0)
a_   		=     (n - 1, n - 1)

a_   		=     1




def 					__SCREAMING_SNAKE_CASE   (  lowercase_					,     lowercase_					,     lowercase_      )       ->	str:

    """simple docstring"""


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

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

    __UpperCamelCase  		=						[]
    __UpperCamelCase  		=						[]
    while open_list[0].minkey() < float('''inf'''      ):
        for i in range(1					,     lowercase_      ):
            # 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(lowercase_					,     lowercase_					,     lowercase_      )
                else:
                    __UpperCamelCase		,      __UpperCamelCase  		=						open_list[i].top_show()
                    visited.add(lowercase_      )
                    expand_state(
                        lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     )
                    close_list_inad.append(lowercase_      )
            else:
                if g_function[goal] <= open_list[0].minkey():
                    if g_function[goal] < float('''inf'''      ):
                        do_something(lowercase_					,     lowercase_					,     lowercase_      )
                else:
                    __UpperCamelCase  		=						open_list[0].top_show()
                    visited.add(lowercase_      )
                    expand_state(
                        lowercase_					,     0					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     lowercase_					,     )
                    close_list_anchor.append(lowercase_      )
    print('''No path found to goal'''      )
    print()
    for i in range(n - 1					,     -1					,     -1      ):
        for j in range(lowercase_      ):
            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)






