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