s = "0;0 5;5 5;0 5;5 5;3 5;3 5;5 4;5 4;3 4;5 5;7 5;6 5;7 5;7"
num = 3
def box_visible_directions(st, idx):
    n, m = 0, 0
    for x in st.split(' '):
        y = x.split(';')
        j = int(y[0])
        i = int(y[1])
        n = max(n, i)
        m = max(m, j)
    print(n, m)
    h = [[0 for _ in range(m + 1)] for _ in range(n + 1)] 
    cnt = 0
    for x in st.split(' '):
        y = x.split(';')
        j = int(y[0])
        i = int(y[1])
        h[i][j] += 1
        if cnt == idx:
            x0 = i
            h0 = h[i][j]
            y0 = j
        cnt += 1
    print('\n'.join(' '.join(map(str, r)) for r in h))   
    print(h0, x0, y0)
    dirs = []
    seen_north = True
    for i in range(x0):
        if h[i][y0] >= h0:
            seen_north = False
            break
    if seen_north:
        dirs.append('n')
        
    seen_west = True
    for j in range(y0):
        if h[x0][j] >= h0:
            seen_west = False
            break
    if seen_west:
        dirs.append('w')
        
    seen_south = True
    for i in range(n, x0, -1):
        print("height :", i, y0, h[i][y0])
        if h[i][y0] >= h0:
            seen_south = False
            break
    if seen_south:
        dirs.append('s')
        
    seen_east = True
    for j in range(m, y0, -1):
        if h[x0][j] >= h0:
            seen_east = False
            break
    if seen_east:
        dirs.append('e')   


    return dirs


r = box_visible_directions(s, num)
print(r)

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: