diff --git a/src/main/java/app/SimulatorApplication.java b/src/main/java/app/SimulatorApplication.java index 879c96b160f38bae4cd47433c8dfbc4e6ae1bdf4..a51c3869a0ac790405a2f9185ceac5f4b6d8ed4a 100644 --- a/src/main/java/app/SimulatorApplication.java +++ b/src/main/java/app/SimulatorApplication.java @@ -1,25 +1,28 @@ package app; -import controller.Controller; +import controller.fireFigther.ControllerFireFigtherBord; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; +import model.Element.*; +import java.util.HashMap; import java.io.IOException; import java.net.URL; +import java.util.Map; public class SimulatorApplication extends javafx.application.Application { - private static final String VIEW_RESOURCE_PATH = "/view/view.fxml"; + private static final String VIEW_RESOURCE_PATH = "/view/fireFigtherView/fireFigtherBord.fxml"; + private static final String APP_NAME = "Firefighter simulator"; private static final int ROW_COUNT = 20; private static final int COLUMN_COUNT = 20; - private static final int SQUARE_WIDTH = 50; - private static final int SQUARE_HEIGHT = 50; - public static final int INITIAL_FIRE_COUNT = 3; - public static final int INITIAL_FIREFIGHTER_COUNT = 10; - public static final int INITIAL_CLOUD_COUNT=10; + private static final int SQUARE_WIDTH = 30; + private static final int SQUARE_HEIGHT = 30; + private Map<ModelElement,Integer> INITIAL_ELEMENTS_COUNT; + private Stage primaryStage; private Parent view; @@ -31,21 +34,34 @@ public class SimulatorApplication extends javafx.application.Application { this.primaryStage.sizeToScene(); } + @Override public void start(Stage primaryStage) throws IOException { initializePrimaryStage(primaryStage); + initializeInitialElementCount(); initializeView(); showScene(); } + private void initializeInitialElementCount() { + INITIAL_ELEMENTS_COUNT = new HashMap<>(); + INITIAL_ELEMENTS_COUNT.put(new Fire(), 1); + INITIAL_ELEMENTS_COUNT.put(new FireFigther(), 3); + INITIAL_ELEMENTS_COUNT.put(new Cloud(), 2); + INITIAL_ELEMENTS_COUNT.put(new MotorisedFirefigther(), 3); + INITIAL_ELEMENTS_COUNT.put(new Mountain(), 1); + INITIAL_ELEMENTS_COUNT.put(new Road(), 4); + INITIAL_ELEMENTS_COUNT.put(new Rockerie(), 5); + } + - private void initializeView() throws IOException { + private void initializeView() throws IOException { FXMLLoader loader = new FXMLLoader(); URL location = SimulatorApplication.class.getResource(VIEW_RESOURCE_PATH); loader.setLocation(location); view = loader.load(); - Controller controller = loader.getController(); - controller.initialize(SQUARE_WIDTH, SQUARE_HEIGHT, COLUMN_COUNT, ROW_COUNT, - INITIAL_FIRE_COUNT, INITIAL_FIREFIGHTER_COUNT); + ControllerFireFigtherBord controller = loader.getController(); + controller.initialize(SQUARE_WIDTH, SQUARE_HEIGHT, COLUMN_COUNT, ROW_COUNT,INITIAL_ELEMENTS_COUNT + ); } private void showScene() { diff --git a/src/main/java/controller/SettingsController.java b/src/main/java/controller/SettingsController.java new file mode 100644 index 0000000000000000000000000000000000000000..1f601978aaee01b0b677c3119e212466a35b048f --- /dev/null +++ b/src/main/java/controller/SettingsController.java @@ -0,0 +1,21 @@ +package controller; + +import javafx.fxml.FXML; +import javafx.scene.control.Spinner; + +public class SettingsController { + + @FXML + private Spinner<Integer> rowCountSpinner; + + @FXML + private Spinner<Integer> columnCountSpinner; + + public int getRowCount() { + return rowCountSpinner.getValue(); + } + + public int getColumnCount() { + return columnCountSpinner.getValue(); + } +} diff --git a/src/main/java/controller/controllerMenu.java b/src/main/java/controller/controllerMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..f6ffd5fa263a268b99943afe1c644c438ce97be6 --- /dev/null +++ b/src/main/java/controller/controllerMenu.java @@ -0,0 +1,4 @@ +package controller; + +public class controllerMenu { +} diff --git a/src/main/java/controller/fireFigther/ContollerPutElementCount.java b/src/main/java/controller/fireFigther/ContollerPutElementCount.java new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/java/controller/Controller.java b/src/main/java/controller/fireFigther/ControllerFireFigtherBord.java similarity index 92% rename from src/main/java/controller/Controller.java rename to src/main/java/controller/fireFigther/ControllerFireFigtherBord.java index 3482ecee980103fe888f90a7a2d4aef5b1d51124..7577440bc4e149bea00c875aa2574963dbc7d44d 100644 --- a/src/main/java/controller/Controller.java +++ b/src/main/java/controller/fireFigther/ControllerFireFigtherBord.java @@ -1,5 +1,6 @@ -package controller; +package controller.fireFigther; +import controller.fireFigther.PersistentToggleGroup; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; @@ -13,8 +14,6 @@ import javafx.scene.control.ToggleGroup; import javafx.util.Duration; import javafx.util.Pair; import model.Board; -import model.Element.Fire; -import model.Element.FireFigther; import model.Element.ModelElement; import model.FirefighterBoard; import util.Position; @@ -27,7 +26,7 @@ import java.util.Map; import static java.util.Objects.requireNonNull; -public class Controller { +public class ControllerFireFigtherBord { public static final int PERIOD_IN_MILLISECONDS = 50; @FXML @@ -98,7 +97,7 @@ public class Controller { private void initializeTimeline() { - Duration duration = new Duration(Controller.PERIOD_IN_MILLISECONDS); + Duration duration = new Duration(ControllerFireFigtherBord.PERIOD_IN_MILLISECONDS); EventHandler<ActionEvent> eventHandler = event -> updateBoard(); KeyFrame keyFrame = new KeyFrame(duration, eventHandler); @@ -130,9 +129,9 @@ public class Controller { } public void initialize(int squareWidth, int squareHeight, int columnCount, - int rowCount, int initialFireCount, int initialFirefighterCount) { + int rowCount,Map<ModelElement,Integer> initialElementCount) { grid.setDimensions(columnCount, rowCount, squareWidth, squareHeight); - this.setModel(new FirefighterBoard(columnCount, rowCount, initialFireCount, initialFirefighterCount)); + this.setModel(new FirefighterBoard(columnCount, rowCount, initialElementCount)); repaintGrid(); } diff --git a/src/main/java/controller/PersistentToggleGroup.java b/src/main/java/controller/fireFigther/PersistentToggleGroup.java similarity index 96% rename from src/main/java/controller/PersistentToggleGroup.java rename to src/main/java/controller/fireFigther/PersistentToggleGroup.java index 7c2c4b5c79d6ff65e0bfbe53c2fb7e9fd5944a1b..30ba8b2b05d3c5df1a832142a8483eb7c6b04139 100644 --- a/src/main/java/controller/PersistentToggleGroup.java +++ b/src/main/java/controller/fireFigther/PersistentToggleGroup.java @@ -1,4 +1,4 @@ -package controller; +package controller.fireFigther; import javafx.collections.ListChangeListener.Change; import javafx.scene.control.Toggle; diff --git a/src/main/java/model/Element/Cloud.java b/src/main/java/model/Element/Cloud.java index b5eb6db0d4684ac395d3f58fcedbab20e69f7d33..6e6c2b912a078b9fbfdfe92256961a173d8f9142 100644 --- a/src/main/java/model/Element/Cloud.java +++ b/src/main/java/model/Element/Cloud.java @@ -19,13 +19,18 @@ public class Cloud implements ModelElement { @Override public void update(Position position, Map<Position, List<ModelElement>> board, int step, int columnCount, int rowCount) { - Random nextCloud =new Random() ; - addElement(neighbors(position, rowCount, columnCount).get(nextCloud.nextInt()),board, new Cloud()); - removeElement(position,board,new Cloud()); - + List<Position> neighbors = neighbors(position, rowCount, columnCount); + if (!neighbors.isEmpty()) { + Random nextCloud = new Random(); + Position randomNeighbor = neighbors.get(nextCloud.nextInt(neighbors.size())); + addElement(randomNeighbor, board, new Cloud()); + } + + removeElement(position, board, new Cloud()); } + @Override public ViewElement getViewElement() { return ViewElement.Cloud; diff --git a/src/main/java/model/Element/Fire.java b/src/main/java/model/Element/Fire.java index b67356cc27f9fe03d4a3cbacbca8d55310e08889..ab24feb9d0af1bde2bc0fdf736900e2964470cff 100644 --- a/src/main/java/model/Element/Fire.java +++ b/src/main/java/model/Element/Fire.java @@ -1,12 +1,8 @@ package model.Element; - -import model.FirefighterBoard; import util.Position; import view.ViewElement; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; import static util.Tools.addElement; @@ -14,34 +10,60 @@ import static util.Tools.neighbors; public class Fire implements ModelElement { int fireWasCreate; + private final List<ModelElement>prohibitedPropagationFire; + + public Fire() { + this.prohibitedPropagationFire= Collections.unmodifiableList(Arrays.asList( + new Mountain(), + new FireFigther(), + new MotorisedFirefigther(), + new Cloud(), + new Road())); + + } + public void setFireWasCreate(int fireWasCreate) { this.fireWasCreate = fireWasCreate; } + private boolean canFireSpread(Position position, Map<Position, List<ModelElement>> board) { + if(board.getOrDefault(position,List.of()).contains(new Fire()))return false; + for (ModelElement element : prohibitedPropagationFire) { + if (board.getOrDefault(position,List.of()).contains(element)) { + return false; + } + } + + return true; + } @Override public void update(Position position, Map<Position, List<ModelElement>> board,int step, int columnCount, int rowCount) { - if (step%2==0){ + if (step % 2 == 0) { Fire nextFire = new Fire(); nextFire.setFireWasCreate(step); for (Position position1 : neighbors(position, rowCount, columnCount)) { + if (canFireSpread(position1,board)) { + addElement(position1, board, nextFire); + } else if (board.get(position1).isEmpty()) { + addElement(position1, board, nextFire); + } + if (board.get(position1).contains(new Rockerie()) && (step - fireWasCreate) % 4 == 0) { + if (canFireSpread(position1,board)) { + addElement(position1, board, nextFire); - if (!board.containsKey(position1)){ - addElement(position1, board, new Fire()); - } else if (board.get(position1).isEmpty()) { - addElement(position1, board, new Fire()); - } - if (board.get(position1).contains(new Rockerie()) && (step - fireWasCreate)%4 ==0){ - if (!(board.get(position1).contains(new Mountain())||board.get(position1).contains(new FireFigther())||board.get(position1).contains(new MotorisedFirefigther())||board.get(position1).contains(new Cloud())||(board.get(position1).contains(new FireFigther())))){ - addElement(position1, board, new Fire()); + } } } - } } + } + + + @Override public ViewElement getViewElement() { return ViewElement.FIRE; diff --git a/src/main/java/model/Element/FireFigther.java b/src/main/java/model/Element/FireFigther.java index 07c24b7564b1d6503d7ea957b153b861b8a15cf2..afd16d2aaa65bf25577b8dc1347bfb2104d282ec 100644 --- a/src/main/java/model/Element/FireFigther.java +++ b/src/main/java/model/Element/FireFigther.java @@ -14,14 +14,14 @@ public class FireFigther implements ModelElement{ for (Position position1 : neighbors(position, rowCount, columnCount)) { if (board.containsKey(position1)) { if (board.get(position1).contains(new Fire())) { - extinguish(position,board); - return; + extinguish(position1,board); + } } } - Position newPositionStep = neighborClosestToFire(position,board,rowCount,columnCount); + Position newPositionStep = neighborClosestTo(position,board,rowCount,columnCount); extinguish(newPositionStep,board); removeElement(position,board,new FireFigther()); addElement(newPositionStep,board,new FireFigther()); diff --git a/src/main/java/model/Element/MotorisedFirefigther.java b/src/main/java/model/Element/MotorisedFirefigther.java index 94bc962bc927f699954ea2543b720ed6c02c19ff..4d093a3a85f739cb5246cb84765ec9414cae8b5b 100644 --- a/src/main/java/model/Element/MotorisedFirefigther.java +++ b/src/main/java/model/Element/MotorisedFirefigther.java @@ -22,11 +22,13 @@ public class MotorisedFirefigther implements ModelElement{ } } - Position newPositionStep = neighborClosestToFire(position,board,rowCount,columnCount); - Position newPositionTwoStep=neighborClosestToFire(newPositionStep,board,rowCount,columnCount); + MotorisedFirefigther motorisedFirefigther=new MotorisedFirefigther(); + Position newPositionStep = neighborClosestTo(position,board,rowCount,columnCount); + Position newPositionTwoStep= neighborClosestTo(newPositionStep,board,rowCount,columnCount); extinguish(newPositionTwoStep,board); - addElement(newPositionTwoStep,board,new MotorisedFirefigther()); - removeElement(position,board,new MotorisedFirefigther()); + removeElement(position,board,motorisedFirefigther); + addElement(newPositionTwoStep,board,motorisedFirefigther); + } @@ -37,6 +39,6 @@ public class MotorisedFirefigther implements ModelElement{ } @Override public boolean equals(Object obj) { - return obj instanceof Mountain; + return obj instanceof MotorisedFirefigther; } } diff --git a/src/main/java/model/FirefighterBoard.java b/src/main/java/model/FirefighterBoard.java index c520278216887e6f8dca58ce583867af44018a09..a4b6bda573f38982463e004fa17488123e151855 100644 --- a/src/main/java/model/FirefighterBoard.java +++ b/src/main/java/model/FirefighterBoard.java @@ -1,5 +1,6 @@ package model; +import model.Element.Cloud; import model.Element.Fire; import model.Element.FireFigther; import model.Element.ModelElement; @@ -13,30 +14,31 @@ import static util.Tools.addElement; public class FirefighterBoard implements Board<List<ModelElement>> { private final int columnCount; private final int rowCount; - private int initialFireCount ; - private int initialFirefighterCount; + + private Map<ModelElement,Integer>initialElementCount; private Map<Position,List<ModelElement>>board; private int step = 0; private final Random randomGenerator = new Random(); - public FirefighterBoard(int columnCount, int rowCount, int initialFireCount, int initialFirefighterCount) { + public FirefighterBoard(int columnCount, int rowCount,Map<ModelElement,Integer>initialElementCount ) { this.columnCount = columnCount; this.rowCount = rowCount; - this.initialFirefighterCount=initialFirefighterCount; - this.initialFireCount=initialFireCount; + this.initialElementCount=initialElementCount; board=new HashMap<>(); - initializeElements(); + initializeElements(initialElementCount); } - public void initializeElements() { - for (int index = 0; index < initialFireCount; index++) { - addElement(randomPosition(),board,new Fire()); - } - for (int index = 0; index < initialFirefighterCount; index++) { - addElement(randomPosition(),board,new FireFigther()); - } + public void initializeElements(Map<ModelElement,Integer>initialElementCount) { + for (ModelElement element :initialElementCount.keySet() + ) { + for (int index = 0; index < initialElementCount.get(element); index++) { + addElement(randomPosition(),board,element); + } + } + + } private Position randomPosition() { @@ -90,7 +92,8 @@ public class FirefighterBoard implements Board<List<ModelElement>> { @Override public void reset() { step = 0; - initializeElements(); + board.clear(); + initializeElements(initialElementCount); } @Override diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 4c36d97709b342e457203c75d081fc5cc1955c0f..d55a91e09820fe1bc057a9a9c27278d7f838b363 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -5,4 +5,5 @@ module firefighter { opens controller to javafx.fxml; exports app; opens app to javafx.fxml; + opens controller.fireFigther to javafx.fxml; } diff --git a/src/main/java/util/Tools.java b/src/main/java/util/Tools.java index 84098d694fe88cc0c3cfe57e7cfe6e764be555ec..c8e284935d33ba0e1859aa22b2f1d2867a38b15a 100644 --- a/src/main/java/util/Tools.java +++ b/src/main/java/util/Tools.java @@ -1,7 +1,6 @@ package util; import model.Element.Fire; -import model.Element.FireFigther; import model.Element.ModelElement; import model.Element.Mountain; @@ -18,7 +17,8 @@ public class Tools { if (position.column() < columnCount - 1) list.add(new Position(position.row(), position.column() + 1)); return list; } - public static Position neighborClosestToFire(Position position,Map<Position, List<ModelElement>> board,int rowCount , int columnCount) { + + public static Position neighborClosestTo(Position position, Map<Position, List<ModelElement>> board, int rowCount , int columnCount) { Set<Position> seen = new HashSet<>(); HashMap<Position, Position> firstMove = new HashMap<>(); Queue<Position> toVisit = new LinkedList<>(neighbors(position,rowCount,columnCount)); @@ -28,24 +28,25 @@ public class Tools { while (!toVisit.isEmpty()) { Position current = toVisit.poll(); if (board.containsKey(current)) { - if (board.get(current).contains(new Fire())){ - System.out.println("ok chef 4"); - return firstMove.get(current); - } - for (Position adjacent : neighbors(current, rowCount, columnCount)) { - if (seen.contains(adjacent)) { - continue; - } - toVisit.add(adjacent); - seen.add(adjacent); - firstMove.put(adjacent, firstMove.get(current)); - + if (board.get(current).contains(new Fire())){ + return firstMove.get(current); } + } + for (Position adjacent : neighbors(current, rowCount, columnCount)) { + if (!(seen.contains(adjacent) )) { + toVisit.add(adjacent); + seen.add(adjacent); + firstMove.put(adjacent, firstMove.get(current)); + + } } } return position; } + + + public static void extinguish(Position position,Map<Position, List<ModelElement>> board) { board.remove(position); } @@ -69,4 +70,6 @@ public class Tools { + + } diff --git a/src/main/java/view/ViewElement.java b/src/main/java/view/ViewElement.java index a5b26b5fd7a80708445db2fafc2b6448c474faf9..c360b71cdbd39431341d250867236f7cb03ed772 100644 --- a/src/main/java/view/ViewElement.java +++ b/src/main/java/view/ViewElement.java @@ -3,7 +3,7 @@ package view; import javafx.scene.paint.Color; public enum ViewElement { - FIREFIGHTER(Color.BLUE), FIRE(Color.RED),Cloud(Color.GRAY),Rockerie(Color.LIGHTGREY),MotorisedFirefigther(Color.ALICEBLUE),Road(Color.BLACK),Mountain(Color.BROWN), EMPTY(Color.WHITE); + FIREFIGHTER(Color.BLUE), FIRE(Color.RED),Cloud(Color.GRAY),Rockerie(Color.LIGHTGREY),MotorisedFirefigther(Color.ORANGE),Road(Color.BLACK),Mountain(Color.BROWN), EMPTY(Color.WHITE); final Color color; ViewElement(Color color) { this.color = color; diff --git a/src/main/resources/view/Settings.fxml b/src/main/resources/view/Settings.fxml new file mode 100644 index 0000000000000000000000000000000000000000..8670e2f77bd945350b4f809bbe105e90a597f6ee --- /dev/null +++ b/src/main/resources/view/Settings.fxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.Spinner?> +<?import javafx.scene.layout.GridPane?> + +<GridPane xmlns:fx="http://javafx.com/fxml" + fx:controller="controller.fireFigther.SettingsController" alignment="center" hgap="10" vgap="10" padding="20"> + <Label text="Settings" style="-fx-font-size: 16;" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/> + + <!-- Row Count --> + <Label text="Row Count:" GridPane.columnIndex="0" GridPane.rowIndex="1"/> + <Spinner fx:id="rowCountSpinner" value="10" min="1" max="100" GridPane.columnIndex="1" GridPane.rowIndex="1"/> + + <!-- Column Count --> + <Label text="Column Count:" GridPane.columnIndex="0" GridPane.rowIndex="2"/> + <Spinner fx:id="columnCountSpinner" value="10" min="1" max="100" GridPane.columnIndex="1" GridPane.rowIndex="2"/> +</GridPane> diff --git a/src/main/resources/view/DarkTheme.css b/src/main/resources/view/fireFigtherView/DarkTheme.css similarity index 100% rename from src/main/resources/view/DarkTheme.css rename to src/main/resources/view/fireFigtherView/DarkTheme.css diff --git a/src/main/resources/view/view.fxml b/src/main/resources/view/fireFigtherView/fireFigtherBord.fxml similarity index 96% rename from src/main/resources/view/view.fxml rename to src/main/resources/view/fireFigtherView/fireFigtherBord.fxml index 3f19ac9de44d6f0b571dc29e43bf15ff2ebeff79..7e1c179c34759e686122a03577556f25d189aece 100644 --- a/src/main/resources/view/view.fxml +++ b/src/main/resources/view/fireFigtherView/fireFigtherBord.fxml @@ -10,7 +10,7 @@ <?import javafx.scene.control.Label?> <HBox styleClass="background" stylesheets="@DarkTheme.css" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" - fx:controller="controller.Controller"> + fx:controller="controller.fireFigther.ControllerFireFigtherBord"> <VBox> <Separator maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="24.0" prefWidth="200.0"/> diff --git a/src/main/resources/view/fireFigtherView/putElementCount.fxml b/src/main/resources/view/fireFigtherView/putElementCount.fxml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/resources/view/menu.fxml b/src/main/resources/view/menu.fxml new file mode 100644 index 0000000000000000000000000000000000000000..ca96e53c1888262a2367f5a2ae6853530fb3666d --- /dev/null +++ b/src/main/resources/view/menu.fxml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import java.lang.*?> +<?import java.util.*?> +<?import javafx.scene.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> + +<AnchorPane xmlns="http://javafx.com/javafx" + xmlns:fx="http://javafx.com/fxml" + fx:controller="controller.controllerMenu" + prefHeight="400.0" prefWidth="600.0"> + +</AnchorPane> diff --git a/src/test/java/model/FirefighterBoardTest.java b/src/test/java/model/FirefighterBoardTest.java deleted file mode 100644 index 532a38b409c2209d14d637d393a9b5d0b6fd11ad..0000000000000000000000000000000000000000 --- a/src/test/java/model/FirefighterBoardTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package model; - -import model.Element.Fire; -import model.Element.ModelElement; -import org.junit.jupiter.api.Test; -import util.Position; - -import java.util.List; - -import static org.assertj.core.api.Assertions.*; - -public class FirefighterBoardTest { - @Test - void testColumnCount(){ - Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 1, 3); - assertThat(board.columnCount()).isEqualTo(20); - } - @Test - void testRowCount(){ - Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 1, 3); - assertThat(board.rowCount()).isEqualTo(10); - } - @Test - void testStepNumber(){ - Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 1, 3); - for(int index = 0; index < 10; index++){ - assertThat(board.stepNumber()).isEqualTo(index); - board.updateToNextGeneration(); - } - assertThat(board.stepNumber()).isEqualTo(10); - } - @Test - void testGetState_afterSet(){ - Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 0, 0); - Position position = new Position(1,2); - assertThat(board.getState(position)).isEmpty(); - board.setState(List.of(new Fire()), position); - assertThat(board.getState(position)).containsExactly(new Fire()); - } - -} diff --git a/src/test/java/view/FirefighterGridTest.java b/src/test/java/view/FirefighterGridTest.java deleted file mode 100644 index 4b45ebdca3b936b42c2b322b1294488341d180bb..0000000000000000000000000000000000000000 --- a/src/test/java/view/FirefighterGridTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package view; - -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class FirefighterGridTest { - @Test - void testColumnCount(){ - Grid<ViewElement> grid = new FirefighterGrid(); - grid.setDimensions(20,10,10,10); - assertThat(grid.columnCount()).isEqualTo(20); - } - @Test - void testRowCount(){ - Grid<ViewElement> grid = new FirefighterGrid(); - grid.setDimensions(20,10,10,10); - assertThat(grid.rowCount()).isEqualTo(10); - } -}