The number of a cell indicates the number of mines in the 8 neighbor cells that are not blocked by
a wall. (No number on an explored cell means 0.)
Walls don't block diagonal counting.
The game concept is that adding walls gives information but blocks your movements.
The information you can get after putting a wall (counter is decreased or not) is displayed
automatically.
That's why it shows a mine if the counter is decreased, and a "?" if it's not.