From bac65ef1163c6479675e6c2fbf5d1d0ce2e7d194 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 18 Oct 2018 09:57:08 +0200 Subject: [PATCH] Remove unnecessary pattern parameters --- lib/src/Engine.dart | 16 ++-------------- lib/src/Simulation.dart | 15 ++++----------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/lib/src/Engine.dart b/lib/src/Engine.dart index 36ab89a..73ab7ea 100644 --- a/lib/src/Engine.dart +++ b/lib/src/Engine.dart @@ -124,20 +124,8 @@ class Engine { if (canvas != null) _grid.render(canvas, interp); } - void addPattern( - {CellPattern pattern, - int x, - int y, - int amount, - int dispersal, - int seed}) { - _grid.addPattern( - pattern: pattern, - x: x, - y: y, - amount: amount, - dispersal: dispersal, - seed: seed); + void addPattern({int amount, int dispersal}) { + _grid.addPattern(amount: amount, dispersal: dispersal); } void toggleEdgeRendering() { diff --git a/lib/src/Simulation.dart b/lib/src/Simulation.dart index 8342d7c..b0bbb46 100644 --- a/lib/src/Simulation.dart +++ b/lib/src/Simulation.dart @@ -13,7 +13,6 @@ class Simulation { bool _dirty = true; bool _renderEdges = true; - int _startingSeed; int _amount; int _dispersal; @@ -30,19 +29,13 @@ class Simulation { _dirty = true; } - void addPattern( - {CellPattern pattern, - int x, - int y, - int amount, - int dispersal, - int seed}) { - _startingSeed = seed ?? DateTime.now().millisecondsSinceEpoch; + void addPattern({int amount, int dispersal}) { + int _startingSeed = DateTime.now().millisecondsSinceEpoch; math.Random rng = new math.Random(_startingSeed); _amount = amount ?? rng.nextInt(20); _dispersal = dispersal ?? 10; - int cx = x ?? rng.nextInt(map.width ~/ 3) + (map.width ~/ 3); - int cy = y ?? rng.nextInt(map.height ~/ 3) + (map.height ~/ 3); + int cx = rng.nextInt(map.width ~/ 3) + (map.width ~/ 3); + int cy = rng.nextInt(map.height ~/ 3) + (map.height ~/ 3); int sanityCheck = 0; for (var i = 0; i < (_amount); i++) {