getCell method
This commit is contained in:
parent
27789202b3
commit
6d0a3164a8
|
|
@ -24,6 +24,7 @@ public class Simulator extends Thread {
|
||||||
private boolean loopingBorder;
|
private boolean loopingBorder;
|
||||||
private boolean clickActionFlag;
|
private boolean clickActionFlag;
|
||||||
private int loopDelay = 150;
|
private int loopDelay = 150;
|
||||||
|
|
||||||
private int[][] grid;
|
private int[][] grid;
|
||||||
|
|
||||||
//TODO : add missing attribute(s)
|
//TODO : add missing attribute(s)
|
||||||
|
|
@ -152,8 +153,12 @@ public class Simulator extends Thread {
|
||||||
* @return value 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
|
if (x >= 0 && x < COL_NUM && y >= 0 && y < LINE_NUM) {
|
||||||
return 0;
|
return grid[x][y];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return -1;// If the coordinates are out of the grid, we return -1 as a message error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue