Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Bacteria Colonies by StefanPochmann
from collections import Counter
from itertools import product
def healthy(grid):
cells = list(product(range(len(grid)), range(len(grid[0]))))
def judge(c):
ctr = Counter(abs(i-c[0])+abs(j-c[1]) for i, j in cells if grid[i][j])
r = min(r for r in range(20) if ctr[r] < 4 * r)
return r if ctr[r] == 0 else 0
return max(cells, key=judge)
April 19, 2015
Comments: