This commit is contained in:
Guillaume BONABAU 2024-04-25 12:09:27 +02:00
commit 630ab51514
1 changed files with 12 additions and 1 deletions

View File

@ -76,7 +76,18 @@ public class Table {
//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
public void setRandom(double density) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
double random = Math.random();
if (random < density) {
table.get(i).get(j).setValue(1);
} else {
table.get(i).get(j).setValue(0);
}
}
}
}
//TODO : load(filepath) turn a loaded saveable file into a table //TODO : load(filepath) turn a loaded saveable file into a table
//TODO : save(filename) turn the table into saveable file //TODO : save(filename) turn the table into saveable file