Fix implicit Overwrite of Dart Pattern Class

This commit is contained in:
Marty Oehme 2018-07-09 17:45:11 +02:00
parent 436061a629
commit 4b7051a5e1

View file

@ -4,7 +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 CellPattern { SpaceShip, Blinker }
class Grid {
final int w;
@ -19,7 +19,7 @@ class Grid {
int _y;
int _amount;
int _dispersal;
Pattern _pattern;
CellPattern _pattern;
Grid(int w, int h)
: this.w = w,
@ -44,7 +44,7 @@ class Grid {
}
void addPattern(
{Pattern pattern, int x, int y, int amount, int dispersal, int seed}) {
{CellPattern pattern, int x, int y, int amount, int dispersal, int seed}) {
_startingSeed = seed ?? DateTime.now().millisecondsSinceEpoch;
math.Random rng = new math.Random(_startingSeed);
_x = x;
@ -58,7 +58,7 @@ class Grid {
// Two blocks, offset
// ##
// ##
case Pattern.Blinker:
case CellPattern.Blinker:
setCellState(cx, cy, true);
setCellState(cx + 1, cy, true);
setCellState(cx, cy + 1, true);
@ -73,7 +73,7 @@ class Grid {
// #
// #
// ###
case Pattern.SpaceShip:
case CellPattern.SpaceShip:
setCellState(1 + cx, 0 + cy, true);
setCellState(2 + cx, 1 + cy, true);
setCellState(2 + cx, 2 + cy, true);