def calculate_manhattan_dist(idx, value, n):
    """calculate the manhattan distance of a single tile"""

    goalRow = value // n #row index at goal

    goalCol = value % n #col index at goal

    currentRow = idx // n #current row index

    currentCol = idx % n #current col index

    dist = abs(goalRow - currentRow) + abs(goalCol - currentCol) #manhattan
    
    return dist