clickCell
This commit is contained in:
parent
d05f4211f1
commit
b27ef8ffe0
|
|
@ -148,7 +148,17 @@ public class Simulator extends Thread {
|
||||||
* method called when clicking on a cell in the interface
|
* method called when clicking on a cell in the interface
|
||||||
*/
|
*/
|
||||||
public void clickCell(int x, int y) {
|
public void clickCell(int x, int y) {
|
||||||
//TODO : complete method
|
int currentCellValue = getCell(x, y);
|
||||||
|
int newCellValue;
|
||||||
|
if (currentCellValue == 0) {
|
||||||
|
System.out.println("Cell :" + x + "," + y + " is now alive");
|
||||||
|
newCellValue = 1; // If the cell is dead, make it alive
|
||||||
|
} else {
|
||||||
|
System.out.println("Cell :" + x + "," + y + " is now dead");
|
||||||
|
newCellValue = 0; // If the cell is alive, make it dead
|
||||||
|
}
|
||||||
|
|
||||||
|
setCell(x, y, newCellValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue