in reply to Need help with a minesweeper game

Another good strategy for games of this kind is to include in your data, a row of blank, never-used cells on each edge of the data map. This makes the check routine much cleaner. Checking an edge or corner cell does not require special code to not look at adjacent squares that are not there. They are there. They are always blank. They are never displayed. And the check-adjacent-cells routine doesn't care. It's just happy to be able to check edge cells as if they were any other cell.