Add Parameters for Dispersal and Amount of Cells
This commit is contained in:
parent
9816778d4b
commit
4b35dbe5fc
1 changed files with 3 additions and 3 deletions
|
@ -25,7 +25,7 @@ class Grid {
|
|||
print("Grid creation finished");
|
||||
}
|
||||
|
||||
void startingPattern({Pattern pattern, int x, int y}) {
|
||||
void startingPattern({Pattern pattern, int x, int y, int amount, int dispersal}) {
|
||||
math.Random rng = new math.Random();
|
||||
int cx = x ?? rng.nextInt(w~/3) + (w~/3);
|
||||
int cy = y ?? rng.nextInt(h~/3) + (h~/3);
|
||||
|
@ -56,8 +56,8 @@ class Grid {
|
|||
setCellState(0 + cx, 2 + cy, true);
|
||||
break;
|
||||
default:
|
||||
for (var i = 0; i < rng.nextInt(20); i++) {
|
||||
setCellState(cx + rng.nextInt(10), cy + rng.nextInt(10), true);
|
||||
for (var i = 0; i < amount ?? rng.nextInt(20); i++) {
|
||||
setCellState(cx + dispersal ?? rng.nextInt(10), cy + dispersal ?? rng.nextInt(10), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue