|
|
@ -11,7 +11,9 @@ public class Playfield { |
|
|
|
private MinesweeperGame MsG; |
|
|
|
public Cell[][] cells; |
|
|
|
private int bombAmount; |
|
|
|
|
|
|
|
private int cellsFlooded = 0; |
|
|
|
|
|
|
|
|
|
|
|
public Playfield(MinesweeperGame _MsG, int _Size, int _bombAmount) { |
|
|
|
MsG = _MsG; |
|
|
|
Size = _Size; |
|
|
@ -123,5 +125,12 @@ public class Playfield { |
|
|
|
|
|
|
|
cells[row][column].update(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void cellFlooded() { |
|
|
|
cellsFlooded++; |
|
|
|
if(cellsFlooded >= Size * Size - bombAmount) { |
|
|
|
JOptionPane.showMessageDialog(MsG, "You won, congratulations!"); |
|
|
|
System.exit(0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |