Hi everyone,
I have a 2d array of cells (like a chessboard), the problem is that it seems that it keeps counting the indexes despite the edges of the grid.
This is happening in vertical but not in horizontal.
I don't understand why is counting that way and how to avoid this.
here is the code
for (int i = 0; i<ROW; i++) {
for (int j = 0; j<COL; j++) {
if (cells[i][j].rect.inside(x, y)) {
if (cells[i][j].getPossible() == true && cells[i][j].cellval == " ") {
clickCounter++;
refreshPossible();
cells[i][j].setActive(true);
cells[i][j].cellval = ofToString(clickCounter);
<img src="/uploads/default/original/2X/e/e1e139b0b69f30a69a1636c903f14179abfe9303.png" width="300" height="500"><img src="/uploads/default/original/2X/4/4876d1c1b3909c9dc1bc4e3f1505f34350c5444e.png" width="296" height="499">
cells[i][j-3].setPossible(true);
cells[i][j+3].setPossible(true);
}
}
}
}
I am attaching the images. The yellow cells are the one I am referring about (index +3 and -3)
any idea about this?
thanks.