Index: samples/pop_pop_win/lib/src/game/field.dart |
diff --git a/samples/pop_pop_win/lib/src/game/field.dart b/samples/pop_pop_win/lib/src/game/field.dart |
index 91f26806f4da612c100ba75a3cef8e4648f472eb..7123732909c98953ba32b419dec753a73298ce2d 100644 |
--- a/samples/pop_pop_win/lib/src/game/field.dart |
+++ b/samples/pop_pop_win/lib/src/game/field.dart |
@@ -4,12 +4,13 @@ class Field extends Array2d<bool> { |
final int bombCount; |
final Array2d<int> _adjacents; |
- factory Field([bombCount = 40, cols = 16, rows = 16, int seed = null]) { |
- final squares = new List<bool>.filled(rows * cols, false); |
+ factory Field([int bombCount = 40, int cols = 16, int rows = 16, |
+ int seed = null]) { |
+ var squares = new List<bool>.filled(rows * cols, false); |
assert(bombCount < squares.length); |
assert(bombCount > 0); |
- final rnd = new math.Random(seed); |
+ var rnd = new Random(seed); |
// This is the most simple code, but it'll get slow as |
// bombCount approaches the square count. |
@@ -24,7 +25,7 @@ class Field extends Array2d<bool> { |
} |
return new Field._internal(bombCount, cols, |
- new ReadOnlyCollection<bool>(squares)); |
+ new UnmodifiableListView<bool>(squares)); |
} |
factory Field.fromSquares(int cols, int rows, List<bool> squares) { |
@@ -42,19 +43,19 @@ class Field extends Array2d<bool> { |
assert(count < squares.length); |
return new Field._internal(count, cols, |
- new ReadOnlyCollection<bool>(squares)); |
+ new UnmodifiableListView<bool>(squares)); |
} |
- Field._internal(this.bombCount, int cols, ReadOnlyCollection<bool> source) : |
- this._adjacents = new Array2d<int>(cols, source.length ~/ cols), |
- super.wrap(cols, source.toList()) { |
+ Field._internal(this.bombCount, int cols, UnmodifiableListView<bool> source) |
+ : this._adjacents = new Array2d<int>(cols, source.length ~/ cols), |
+ super.wrap(cols, source.toList()) { |
assert(width > 0); |
assert(height > 0); |
assert(bombCount > 0); |
assert(bombCount < length); |
int count = 0; |
- for (final m in this) { |
+ for (var m in this) { |
if (m) { |
count++; |
} |
@@ -71,7 +72,7 @@ class Field extends Array2d<bool> { |
if (val == null) { |
val = 0; |
- for (final i in getAdjacentIndices(x, y)) { |
+ for (var i in getAdjacentIndices(x, y)) { |
if (this[i]) { |
val++; |
} |