You are viewing a single comment's thread. Return to all comments →
def cavityMap(grid): arrlen = len(grid) cellidupdate = list() for i in range(1, arrlen-1): currentrow = list(grid[i]) for j in range(1, arrlen-1): #print(grid[i]) currcell = currentrow[j] _n = int(grid[i-1][j]) _e = int(grid[i][j+1]) _s = int(grid[i+1][j]) _w = int(grid[i][j-1]) if int(currcell) > max(_n, _e, _s, _w): cellidupdate.append([i,j]) #print(cellidupdate) for i in cellidupdate: newrow = list(grid[i[0]]) newrow[i[1]] = "X" grid[i[0]] = "".join( newrow) result = grid return result
Seems like cookies are disabled on this browser, please enable them to open this website
Cavity Map
You are viewing a single comment's thread. Return to all comments →