fixed typos, setCell(), removed countAround in Simulator, commented out getCell() in Simulator and updated clickCell to use the Table getCell.getValue
This commit is contained in:
parent
b11eba4039
commit
c478c29673
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ public class Simulator extends Thread {
|
|||
Table tempTable = new Table(this.height, this.width);
|
||||
for(int x=0; x<width; x++) {
|
||||
for(int y=0; y<height; y++) {
|
||||
<<<<<<< HEAD
|
||||
if (this.table.getCell(x, y).getValue()=1) {
|
||||
if (table.countNear(x,y)<2) {
|
||||
tempTable.getCell(x,y).setValue(0);
|
||||
|
|
@ -133,13 +132,7 @@ public class Simulator extends Thread {
|
|||
}
|
||||
}
|
||||
this.table = tempTable;
|
||||
=======
|
||||
if (table.countNear(x,y)<2) {
|
||||
tempTable.getCell(x,y).setValue(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
>>>>>>> 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue