getCell method

This commit is contained in:
yoyom 2024-05-07 15:30:36 +02:00
parent 27789202b3
commit 6d0a3164a8
1 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,7 @@ public class Simulator extends Thread {
private boolean loopingBorder;
private boolean clickActionFlag;
private int loopDelay = 150;
private int[][] grid;
//TODO : add missing attribute(s)
@ -152,8 +153,12 @@ public class Simulator extends Thread {
* @return value of cell
*/
public int getCell(int x, int y) {
//TODO : complete method with proper return
return 0;
if (x >= 0 && x < COL_NUM && y >= 0 && y < LINE_NUM) {
return grid[x][y];
}
else {
return -1;// If the coordinates are out of the grid, we return -1 as a message error
}
}
/**
*