Make outbound cells = 0; clean up code
This commit is contained in:
parent
7d2d708e1a
commit
e641c40832
|
|
@ -75,10 +75,12 @@ public class Table {
|
|||
if (loopingBorder) {
|
||||
x = (x + width) % width;
|
||||
y = (y + height) % height;
|
||||
}
|
||||
|
||||
if (!loopingBorder && (x < 0 || x >= width || y < 0 || y >= height)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (x < 0 || x >= width || y < 0 || y >= height) {
|
||||
count += 0; // Border cell is dead
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
count += this.getCell(x, y).getValue();
|
||||
|
|
@ -87,6 +89,7 @@ public class Table {
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
//TODO : set agent (x y agent) load an agent to coordinates x,y
|
||||
|
||||
//TODO : set random (density) create a random table of determined density
|
||||
|
|
|
|||
Loading…
Reference in New Issue