扫雷源码 + 素材 for (int x = 0; x < widthx; x++) {
for (int y = 0; y < highty; y++) {
gridBlank[x][y] = new Blank();
// grid[x][y].addMouseListener();
}
}
// 开始布雷
count = 40;
do {
for (int x = 0; x < widthx; x++) {
for (int y = 0; y 0) {
if (!(gridBlank[x][y] instanceof Bomb)) {
rdm = new Random().nextInt(widthx * highty / 40);
if (rdm == 1) {
gridBlank[x][y] = new Bomb();
count--;
}
} else {
continue;
}
} else {
break;
}
}
}
} while (count > 0);
1