From 30903220e9ecc89c297f1add1b0fe707e0af7f9c Mon Sep 17 00:00:00 2001 From: kfkama Date: Thu, 17 Feb 2022 14:53:51 +0100 Subject: [PATCH] Refactore Playfield --- src/main/java/Minesweeper/MinesweeperGame.java | 3 ++- src/main/java/Minesweeper/Playfield.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/Minesweeper/MinesweeperGame.java b/src/main/java/Minesweeper/MinesweeperGame.java index 231c674..c3b9af4 100644 --- a/src/main/java/Minesweeper/MinesweeperGame.java +++ b/src/main/java/Minesweeper/MinesweeperGame.java @@ -24,7 +24,8 @@ public class MinesweeperGame extends JPanel { f.setSize(WIDTH, HEIGTH); f.setLayout(null); f.setVisible(true); - } + + } diff --git a/src/main/java/Minesweeper/Playfield.java b/src/main/java/Minesweeper/Playfield.java index 14f0a81..3fc9006 100644 --- a/src/main/java/Minesweeper/Playfield.java +++ b/src/main/java/Minesweeper/Playfield.java @@ -12,6 +12,10 @@ public class Playfield { public Playfield(MinesweeperGame _MsG, int _Size, int _bombAmount) { MsG = _MsG; Size = _Size; + generatePlayfield(_bombAmount); + } + + public void generatePlayfield(int _bombAmount) { cells = new Cell[Size][Size]; @@ -53,7 +57,7 @@ public class Playfield { } } } - + public void calculateBombProximity(int row, int column) { if (row > 0) {