Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void zaehleNachbarn(int posX, int posY) {
- char zaehler = '0';
- for (int x = posX - 1; x <= posX + 1; x++) {
- for (int y = posY - 1; y <= posY + 1; y++) {
- if (istHierMine(x, y))
- zaehler += 1;
- }
- }
- anzeige.spielfeld[posX][posY] = zaehler;
- if (zaehler == '0') {
- for (int x = posX - 1; x <= posX + 1; x++) {
- for (int y = posY - 1; y <= posY + 1; y++) {
- if (x < Anzeige.BREITE && y < Anzeige.HOEHE) {
- if (x >= 0 && y >= 0) {
- if (anzeige.spielfeld[x][y] == Anzeige.LEER) {
- zaehleNachbarn(x, y);
- versteckteFelder--;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement