setCell method

This commit is contained in:
yoyom 2024-05-07 15:55:56 +02:00
parent 6d0a3164a8
commit 1431bc0e25
1 changed files with 8 additions and 2 deletions

View File

@ -157,7 +157,8 @@ public class Simulator extends Thread {
return grid[x][y];
}
else {
return -1;// If the coordinates are out of the grid, we return -1 as a message error
System.out.println("Error: Coordinates out of the grid.");
return -1;// If the coordinates are out of the grid, we return -1 as an error value
}
}
/**
@ -192,7 +193,12 @@ public class Simulator extends Thread {
* @param val to set in cell
*/
public void setCell(int x, int y, int val) {
//TODO : complete method
if (x >= 0 && x < COL_NUM && y >= 0 && y < LINE_NUM) {
grid[x][y] = val;
}
else {
System.out.println("Error: Coordinates out of the grid.");
}
}
/**