Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
7-liner: blah blah solution in Creative category for Minesweeper by przemyslaw.daniel
def checkio(d, c=lambda i, j, k='-1': 0 <= i < 10 and 0 <= j < 10 and eval(k) == -1):
p = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
for x, y in [divmod(i, 10) for i in range(100)]:
f, m = [[d[x+i][y+j] for i, j in p if c(i+x, j+y)].count(z) for z in (-1, 9)]
if not f or d[x][y] not in [f+m, m]: continue
return [[d[x][y] != m, x+i, y+j] for i, j in p if c(i+x, j+y, '%s[i][j]' % d)][0]
return [False, 0, 0]
May 8, 2017
Comments: