Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def minesweeper2(b, o, m):
- p = -1,0,1
- for s in m:
- y = s[0]
- x = s[1]
- if b[y][x] == 9:
- return []
- elif b[y][x] == 0:
- o[y][x]==1
- t=[s]
- while t:
- y=t[0][0]
- x=t[0][1]
- for m in p:
- for n in p:
- Y = y+m
- X = x+n
- if Y in range(len(b)) and X in range(len(b[0])):
- if not(b[Y][X] or o[Y][X]):
- t.append((Y,X))
- o[Y][X] = 1
- t=t[1:]
- else:
- o[y][x]=1
- return o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement