Make outbound cells = 0; clean up code

This commit is contained in:
Balthazar SQUINABOL 2024-05-08 11:02:41 +02:00
parent 7d2d708e1a
commit e641c40832
1 changed files with 7 additions and 4 deletions

View File

@ -75,10 +75,12 @@ public class Table {
if (loopingBorder) { if (loopingBorder) {
x = (x + width) % width; x = (x + width) % width;
y = (y + height) % height; y = (y + height) % height;
} }
else {
if (!loopingBorder && (x < 0 || x >= width || y < 0 || y >= height)) { if (x < 0 || x >= width || y < 0 || y >= height) {
continue; count += 0; // Border cell is dead
continue;
}
} }
count += this.getCell(x, y).getValue(); count += this.getCell(x, y).getValue();
@ -87,6 +89,7 @@ public class Table {
return count; return count;
} }
//TODO : set agent (x y agent) load an agent to coordinates x,y //TODO : set agent (x y agent) load an agent to coordinates x,y
//TODO : set random (density) create a random table of determined density //TODO : set random (density) create a random table of determined density