```
class Solution(object):
def updateBoard(self, board, click):
(row,column)=click
direction=((-1,0),(1,0),(0,1),(0,-1),(1,1),(1,-1),(-1,1),(-1,-1))
if row in range(len(board)) and column in range(len(board[0])):
if board[row][column]=='M':
board[row][column]='X'
elif board[row][column]=='E':
n=sum(board[row+r][column+c]=='M' for r,c in direction if row+r in range(len(board)) and column+c in range(len(board[0])))
board[row][column]=str(n or 'B')
if not n:
for r,c in direction:
self.updateBoard(board,(row+r,column+c))
return board
```