Logic of minesweeper working