Apply dartfmt

This commit is contained in:
Marty Oehme 2018-07-07 20:49:02 +02:00
parent 2f96712b60
commit 34bdd1ae81
5 changed files with 27 additions and 31 deletions

View file

@ -6,8 +6,7 @@ import 'package:rules_of_living/src/App.dart';
@Component(
selector: 'my-app',
templateUrl: "app_component.html",
directives: [coreDirectives]
)
directives: [coreDirectives])
class AppComponent implements OnInit {
var name = "World";

View file

@ -18,7 +18,6 @@ class App {
num _updateLag = 0.0;
num _drawLag = 0.0;
final html.CanvasElement canvas;
Grid grid = new Grid(100, 100);
bool running = false;
@ -59,7 +58,6 @@ class App {
grid.update();
}
void render([num interp]) {
// print("rendering");
grid.render(canvas, interp);

View file

@ -4,10 +4,7 @@ import 'dart:math' as math;
import 'package:rules_of_living/src/Cell.dart';
import 'package:rules_of_living/src/Rule.dart';
enum Pattern {
SpaceShip,
Blinker
}
enum Pattern { SpaceShip, Blinker }
class Grid {
final int w;
@ -25,7 +22,8 @@ class Grid {
print("Grid creation finished");
}
void startingPattern({Pattern pattern, int x, int y, int amount, int dispersal}) {
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);
@ -57,7 +55,8 @@ class Grid {
break;
default:
for (var i = 0; i < amount ?? rng.nextInt(20); i++) {
setCellState(cx + dispersal ?? rng.nextInt(10), cy + dispersal ?? rng.nextInt(10), true);
setCellState(cx + dispersal ?? rng.nextInt(10),
cy + dispersal ?? rng.nextInt(10), true);
}
break;
}