Java algorithm for game minesweeping