diff --git a/app/src/main/java/controller/GameController.java b/app/src/main/java/controller/GameController.java index f886ba7a87f51e5d39bf4add5c178a292ff1649f..2cac2e530d218ba433e66e7a9b463bed2988c269 100644 --- a/app/src/main/java/controller/GameController.java +++ b/app/src/main/java/controller/GameController.java @@ -88,24 +88,20 @@ public class GameController { } private void playComputerTurn(){ - // TODO - // uncomment - // if (!game.hasEnded() && !game.isHumanTurn()){ - // ComputerPlayer player = ((ComputerPlayer) game.getPlayer()); - // Flooder.flood(player.getStartCell(), player.play()); - // setScoreLabelTextProperty(); - // pause.play(); - // } + if (!game.hasEnded() && !game.isHumanTurn()){ + //ComputerPlayer player = ((ComputerPlayer) game.getPlayer()); + // Flooder.flood(player.getStartCell(), player.play()); + setScoreLabelTextProperty(); + pause.play(); + } } public void playHumanTurn(Color color){ - // TODO - // uncomment - // if(!game.hasEnded() && game.isHumanTurn()){ - // Flooder.flood(game.getPlayer().getStartCell(), color); - // setScoreLabelTextProperty(); - // game.incrementTurn(); - //} + if(!game.hasEnded() && game.isHumanTurn()){ + Flooder.flood(game.getPlayer().getStartCell(), color); + setScoreLabelTextProperty(); + game.incrementTurn(); + } } private void setPauseAnimation(){ @@ -117,10 +113,9 @@ public class GameController { } private void setScoreLabelTextProperty() { - // TODO - // uncomment - // Player player = game.getPlayer(); - // scoreLabel.textProperty().setValue(Integer.toString(game.getPlayerScore(player))); + + Player player = game.getPlayer(); + scoreLabel.textProperty().setValue(Integer.toString(game.getPlayerScore(player))); } @@ -140,8 +135,7 @@ public class GameController { @FXML public void setPlayerHuman(){ - // TODO - // game.setPlayer(new HumanPlayer("human", getGridStartCell())); + game.setPlayer(new HumanPlayer("human", getGridStartCell())); } @FXML diff --git a/app/src/main/java/model/Flooder.java b/app/src/main/java/model/Flooder.java index 19c268e6a4ba2217f9f8d5782fc67d8340074f50..83d989210e61819599cfc382dc0a2b421c6f6920 100644 --- a/app/src/main/java/model/Flooder.java +++ b/app/src/main/java/model/Flooder.java @@ -4,7 +4,7 @@ import javafx.scene.paint.Color; public class Flooder { - static void flood(Cell startCell, Color floodingColor){ + public static void flood(Cell startCell, Color floodingColor){ ColoredCellIterator myCell = new ColoredCellIterator(startCell); while (myCell.hasNext()) { @@ -12,7 +12,7 @@ public class Flooder { } } - static int coloredArea(Cell startCell){ + public static int coloredArea(Cell startCell){ ColoredCellIterator cell = new ColoredCellIterator(startCell); int numberOfCellColored = 0;