setCell method
This commit is contained in:
parent
6d0a3164a8
commit
1431bc0e25
|
|
@ -157,7 +157,8 @@ public class Simulator extends Thread {
|
||||||
return grid[x][y];
|
return grid[x][y];
|
||||||
}
|
}
|
||||||
else {
|
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
|
* @param val to set in cell
|
||||||
*/
|
*/
|
||||||
public void setCell(int x, int y, int val) {
|
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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue