From c478c296735f9a0cf496635551bf934d254c19c0 Mon Sep 17 00:00:00 2001 From: "guillaume.bonabau" Date: Wed, 10 Apr 2024 16:18:36 +0200 Subject: [PATCH] fixed typos, setCell(), removed countAround in Simulator, commented out getCell() in Simulator and updated clickCell to use the Table getCell.getValue --- src/backend/Cell.java | 6 +++--- src/backend/Simulator.java | 34 +++++----------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/backend/Cell.java b/src/backend/Cell.java index cfd5a9e..a5aff96 100644 --- a/src/backend/Cell.java +++ b/src/backend/Cell.java @@ -1,10 +1,10 @@ package backend; public class Cell { - protected int value; - protected int density; + private int value; + private int density; - protected Cell(int value, int density) { + public Cell(int value, int density) { this.value = value; this.density = density; } diff --git a/src/backend/Simulator.java b/src/backend/Simulator.java index 88ae35a..3fc18f1 100644 --- a/src/backend/Simulator.java +++ b/src/backend/Simulator.java @@ -116,7 +116,6 @@ public class Simulator extends Thread { Table tempTable = new Table(this.height, this.width); for(int x=0; x>>>>>> 343c71dc317aee3d5caa32ac9b6c57dd3ac996bc /* you should distribute this action in methods/classes * don't write everything here ! @@ -157,8 +150,6 @@ public class Simulator extends Thread { - - } /* * leave this as is @@ -187,7 +178,7 @@ public class Simulator extends Thread { */ public void clickCell(int x, int y) { if (clickActionFlag) { - int currentCellValue = getCell(x, y); + int currentCellValue = table.getCell(x, y).getValue(); int newCellValue; if (currentCellValue == 0) { if (enableLogs) { @@ -213,10 +204,10 @@ public class Simulator extends Thread { * @param y coordinate of cell * @return value of cell */ - public int getCell(int x, int y) { + //public int getCell(int x, int y) { //TODO : complete method with proper return - return 0; - } + // return; + //} /** * * @return list of Animals in simulated world @@ -249,22 +240,7 @@ public class Simulator extends Thread { * @param val to set in cell */ public void setCell(int x, int y, int val) { - //TODO : complete method - //j'ai ajouté une base, mais manque la partie qui modifie la valeur de la cellule - int currentCellValue = getCell(x, y); - // set cell value to !currentCellValue - } - - public void countAround(int x, int y) { - //enableLogs - //getCell - //if loopingBorder TRUE, border count as living. - if (loopingBorder == true){ - - } - else { - - } + this.table.getCell(x, y).setValue(val); }