Exemplo n.º 1
0
def print_map(win_map, path, start_row, start_col):
    """
    Prints a map of paths that lead to treasure
    :param start_row: The starting row of the map
    :param start_col: The starting column of the map
    :param path: the stack of directions that have been made
    :param win_map: The map that has the winning paths on it
    :return: none
    """
    if path.size() == 0:
        return
    else:
        path = copy.deepcopy(path)
        path.items.reverse()
        winner = Explorer(start_row, start_col)
        print(
            "The following is the total paths to treasure. Underscore's denote the path to a treasure:"
        )
        for i in range(path.size() - 1):
            forward = path.pop()
            if forward == "north":
                winner.move_n()
            elif forward == "south":
                winner.move_s()
            elif forward == "east":
                winner.move_e()
            elif forward == "west":
                winner.move_w()
            win_map[winner.row][winner.col] = "_"
    for i in win_map:
        print(i)