Input: mat={‘E’,’E’,’E’,’E’,’E’},
{‘E’,’E’,’M’,’E’,’E’},
{‘E’,’E’,’E’,’E’,’E’},
{‘E’,’E’,’E’,’E’,’E’}}, click = {3,0}
Output: {{‘B’,’1′,’E’,’1′,’B’},
{‘B’,’1′,’M’,’1′,’B’},
{‘B’,’1′,’1′,’1′,’B’},
{‘B’,’B’,’B’,’B’,’B’}}
Explanation: At cell {3,0} there is ‘E’ it is revealed and no adjacent mines so it is changed to ‘B’ and all the adjacent directions recursively which are ‘E’ are revealed { {3,1}, {3,2}, {3,3}, {3,4}, {4,1}, {4,2}, {4,3} } are changed to ‘B’ because they have no adjacent hence they are blank cells, { {0,1}, {1,1}, {2,1}, {2,2}, {2,3}, {1,3}, {0,3} } are adjacent to the above cells that are changed to ‘B’ so these cells are explored recursively from the cells that are changed to ‘B’ so these are changed to ‘1’ since they have 1 adjacent mine they are revealed to ‘1’ and no further exploration done.
Input: mat = {{‘B’,’1′,’E’,’1′,’B’},
{‘B’,’1′,’M’,’1′,’B’},
{‘B’,’1′,’1′,’1′,’B’},
{‘B’,’B’,’B’,’B’,’B’}}, click = {1,2}
Output: {{‘B’,’1′,’E’,’1′,’B’},
{‘B’,’1′,’X’,’1′,’B’},
{‘B’,’1′,’1′,’1′,’B’},
{‘B’,’B’,’B’,’B’,’B’}}
Explanation: At cell {1,2} there is already a mine so change it to ‘X’ only.