Add day 2 and 3
Add supporting class 'Point'
This commit is contained in:
+27
-28
@@ -1,7 +1,8 @@
|
||||
import 'package:aoc2020/aoc20201201.dart';
|
||||
import 'dart:mirrors';
|
||||
|
||||
import 'package:aoc2020/aocbase.dart';
|
||||
import 'package:aoc2020/aoc20201201.dart';
|
||||
import 'package:aoc2020/aoc20201202.dart';
|
||||
import 'package:aoc2020/aoc20201203.dart';
|
||||
import 'dart:mirrors';
|
||||
|
||||
class aoc2020 {
|
||||
final String dayParam;
|
||||
@@ -11,6 +12,8 @@ class aoc2020 {
|
||||
|
||||
static List<AOCBase> aocDays = [
|
||||
AOC20201201(),
|
||||
AOC20201202(),
|
||||
AOC20201203(),
|
||||
];
|
||||
|
||||
static void list() async {
|
||||
@@ -18,36 +21,32 @@ class aoc2020 {
|
||||
for (var index = 0; index < aocDays.length; index++) {
|
||||
var aocReflect = reflect(aocDays[index]);
|
||||
var classString = aocReflect.toString().split("'")[1];
|
||||
|
||||
print('${index + 1} : ${classString ?? 'null'}');
|
||||
// var myclass = aocDays[index];
|
||||
// await myclass.a(test: true);
|
||||
// await myclass.b(test: true);
|
||||
// print('$index : ${myclass.answerA ?? 'null'}');
|
||||
// print('$index : ${myclass.answerB ?? 'null'}');
|
||||
// await myclass.a();
|
||||
// await myclass.b();
|
||||
// print('$index : ${myclass.answerA ?? 'null'}');
|
||||
// print('$index : ${myclass.answerB ?? 'null'}');
|
||||
}
|
||||
}
|
||||
|
||||
static void runAll() async {
|
||||
print('Days available:');
|
||||
for (var index = 0; index < aocDays.length; index++) {
|
||||
var aocReflect = reflect(aocDays[index]);
|
||||
var classString = aocReflect.toString().split("'")[1];
|
||||
static void runAt({AOCBase single, bool testOnly}) async {
|
||||
var aocReflect = reflect(single);
|
||||
var classString = aocReflect.toString().split("'")[1];
|
||||
await single.a(test: true);
|
||||
await single.b(test: true);
|
||||
print('$classString A Test : ${single.answerA ?? 'null'}');
|
||||
print('$classString B Test : ${single.answerB ?? 'null'}');
|
||||
if (!testOnly) {
|
||||
await single.a();
|
||||
await single.b();
|
||||
print('$classString A : ${single.answerA ?? 'null'}');
|
||||
print('$classString B : ${single.answerB ?? 'null'}');
|
||||
}
|
||||
}
|
||||
|
||||
print('${index + 1} : ${classString ?? 'null'}');
|
||||
var myclass = aocDays[index];
|
||||
await myclass.a(test: true);
|
||||
await myclass.b(test: true);
|
||||
print('$classString A Test : ${myclass.answerA ?? 'null'}');
|
||||
print('$classString B Test : ${myclass.answerB ?? 'null'}');
|
||||
await myclass.a();
|
||||
await myclass.b();
|
||||
print('$classString A : ${myclass.answerA ?? 'null'}');
|
||||
print('$classString B : ${myclass.answerB ?? 'null'}');
|
||||
static void runLast({bool testOnly}) async {
|
||||
runAt(single: aocDays.last, testOnly: testOnly);
|
||||
}
|
||||
|
||||
static void runAll({bool testOnly}) async {
|
||||
for (var single in aocDays) {
|
||||
runAt(single: single, testOnly: testOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import 'package:aoc2020/aocbase.dart';
|
||||
import 'package:aoc2020/model/readdata.dart';
|
||||
// import 'dart:mirrors';
|
||||
|
||||
class AOC20201201 extends AOCBase {
|
||||
@override
|
||||
Future<void> a({bool test}) async {
|
||||
var filename = (test ?? false) ? classStringTest : classString;
|
||||
print("Running 'a'" + ((test ?? false) ? 'with test' : ''));
|
||||
print('$classStringTest');
|
||||
var mylist = await ReadData.readFileNum(filename);
|
||||
for (var index1 = 0; index1 < mylist.length - 1; index1++) {
|
||||
for (var index2 = index1 + 1; index2 < mylist.length; index2++) {
|
||||
@@ -21,8 +18,6 @@ class AOC20201201 extends AOCBase {
|
||||
@override
|
||||
Future<void> b({bool test}) async {
|
||||
var filename = (test ?? false) ? classStringTest : classString;
|
||||
print("Running 'b'" + ((test ?? false) ? 'with test' : ''));
|
||||
print('$classStringTest');
|
||||
var mylist = await ReadData.readFileNum(filename);
|
||||
for (var index1 = 0; index1 < mylist.length - 1; index1++) {
|
||||
for (var index2 = index1 + 1; index2 < mylist.length; index2++) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import 'package:aoc2020/aocbase.dart';
|
||||
import 'package:aoc2020/model/readdata.dart';
|
||||
// import 'dart:mirrors';
|
||||
|
||||
class AOC20201202 extends AOCBase {
|
||||
@override
|
||||
Future<void> a({bool test}) async {
|
||||
var filename = (test ?? false) ? classStringTest : classString;
|
||||
var mylist = await ReadData.readFileString(filename);
|
||||
var validPasswords = 0;
|
||||
for (var index = 0; index < mylist.length; index++) {
|
||||
var mysplit = mylist[index].split(' ');
|
||||
var password = mysplit[2];
|
||||
var testLetter = mysplit[1].split(':')[0];
|
||||
var rangeCount = mysplit[0].split('-');
|
||||
var minCount = int.parse(rangeCount[0]);
|
||||
var maxCount = int.parse(rangeCount[1]);
|
||||
var count = testLetter.allMatches(password).length;
|
||||
if (count >= minCount && count <= maxCount) validPasswords++;
|
||||
}
|
||||
answerA = validPasswords;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> b({bool test}) async {
|
||||
var filename = (test ?? false) ? classStringTest : classString;
|
||||
var mylist = await ReadData.readFileString(filename);
|
||||
var validPasswords = 0;
|
||||
for (var index = 0; index < mylist.length; index++) {
|
||||
var mysplit = mylist[index].split(' ');
|
||||
var password = mysplit[2];
|
||||
var testLetter = mysplit[1].split(':')[0];
|
||||
var rangeCount = mysplit[0].split('-');
|
||||
var index1 = int.parse(rangeCount[0]) - 1;
|
||||
var letter1 = password.substring(index1, index1+1) == testLetter;
|
||||
var index2 = int.parse(rangeCount[1]) - 1;
|
||||
var letter2 = password[index2] == testLetter;
|
||||
if (letter1 ^ letter2) validPasswords++;
|
||||
}
|
||||
answerB = validPasswords;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import 'package:aoc2020/aocbase.dart';
|
||||
import 'package:aoc2020/model/point.dart';
|
||||
import 'package:aoc2020/model/readdata.dart';
|
||||
|
||||
class AOC20201203 extends AOCBase {
|
||||
static const tree = '#';
|
||||
|
||||
int indexWrap({int index, int width}) => index % width;
|
||||
int treeTest({int index, String line}) {
|
||||
var width = line.length;
|
||||
var testChar = line[indexWrap(index: index, width: width)];
|
||||
return testChar == tree ? 1 : 0;
|
||||
}
|
||||
|
||||
int tobogganRide({List<String> hill, Point start, Point slope}) {
|
||||
var numberOfTrees = 0;
|
||||
var pos = start;
|
||||
for (var lineNum = 0; lineNum < hill.length; lineNum += slope.item2) {
|
||||
numberOfTrees += treeTest(index: pos.item1, line: hill[lineNum]);
|
||||
pos = pos + slope;
|
||||
}
|
||||
return numberOfTrees;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> a({bool test}) async {
|
||||
var filename = (test ?? false) ? classStringTest : classString;
|
||||
var mylist = await ReadData.readFileString(filename);
|
||||
answerA = tobogganRide(hill: mylist, start: Point(0, 0), slope: Point(3, 1));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> b({bool test}) async {
|
||||
var filename = (test ?? false) ? classStringTest : classString;
|
||||
var mylist = await ReadData.readFileString(filename);
|
||||
|
||||
var slopes = <Point>[
|
||||
Point(1, 1),
|
||||
Point(3, 1),
|
||||
Point(5, 1),
|
||||
Point(7, 1),
|
||||
Point(1, 2),
|
||||
];
|
||||
answerB = 0;
|
||||
for (var slope in slopes) {
|
||||
var trees = tobogganRide(hill: mylist, start: Point(0, 0), slope: slope);
|
||||
if (answerB == 0) {
|
||||
answerB = trees;
|
||||
} else {
|
||||
answerB *= trees;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
1-3 a: abcde
|
||||
1-3 b: cdefg
|
||||
2-9 c: ccccccccc
|
||||
@@ -0,0 +1,323 @@
|
||||
.#.#....###..#.#..............#
|
||||
#......#####..##.##.#.......#.#
|
||||
.###.....#..#.#..#..#.#......#.
|
||||
.........##.#.....#.#..........
|
||||
........##....#.......#.#..#..#
|
||||
#.#..####...#.....#.#.#...#....
|
||||
#....#...#.........#.....#..#.#
|
||||
.#..........#..#.............#.
|
||||
...##..##..#...####.#.#.#.#....
|
||||
.#...####............##....#...
|
||||
..##.....#.#......#......#.#.#.
|
||||
..##......#..##.....#.#.....#.#
|
||||
..#...#....#.#.........##......
|
||||
#..##..##..#..##....#....##.#.#
|
||||
..###.#....#.#.#...#......#.#.#
|
||||
....#...#...#.........#.....##.
|
||||
.#..#.#..........#.##.....#.#..
|
||||
.#...#...###..#..#..####.#...#.
|
||||
##..............#..#.#...###..#
|
||||
.#..#.#.#...#..#...#..#........
|
||||
..#.#......#.#..##...#.#..#....
|
||||
...#.#.....#.##..#...#..#......
|
||||
...#...##....##..#....#..#...#.
|
||||
#......##.#.......#...#..#.#...
|
||||
.#..#......####...#............
|
||||
...#..##.#...#....#.#.#.#......
|
||||
....##...........##.#.#...##...
|
||||
#.##.###........#..###.#..##...
|
||||
....#......#....##...##.#......
|
||||
#.............#...#.........#..
|
||||
..##.......#.......#.#...#...#.
|
||||
...#....####...#...#....#.###..
|
||||
...##......#...###.#...#....#..
|
||||
...#.............#...#.......#.
|
||||
...#..#.##.##.#..#.##.#..#....#
|
||||
..####.....#..#............#...
|
||||
##....##..#.#.#.#..#..#.....#..
|
||||
......##...##......#.#.........
|
||||
#.#............#.#.#..#......#.
|
||||
...#.#.#.....#..#..#.#..##.....
|
||||
.#.#.............###..#....##..
|
||||
....#.###..#..#.....#..#.##....
|
||||
..#.#....#.......#.......##..#.
|
||||
.#.##.#.#..#..##.........##....
|
||||
...#...###.##....#####.......#.
|
||||
......#.....##...##...#....#.#.
|
||||
###.......##..#.....#......#.#.
|
||||
...#..#..#....#.#.....##..#...#
|
||||
..#....##.......#....#.........
|
||||
#....##.........##......#.#..#.
|
||||
#.....#.#.#..##..#.#.....##....
|
||||
......#....#...#...#.###....##.
|
||||
#...####...###.##..#.#.#..##...
|
||||
......###....###..##......#..##
|
||||
.#.####.###..#.....#...#..#...#
|
||||
.###.#.....#..#.#..#.....##..##
|
||||
...##...#.####....#......###...
|
||||
...##.......#.#..#......#.#....
|
||||
......##....#......#.........#.
|
||||
............#....#............#
|
||||
..#.#..........#......#..#.....
|
||||
.#...#.#.#......#..##..#....##.
|
||||
..##.#.#.#..#...###..#.#.##.#..
|
||||
..#......#.........#.......#...
|
||||
...#...##.#.##......#.....#....
|
||||
..#.....#..##....#..##..#.#.##.
|
||||
....##....#.#...#..##.##.##....
|
||||
..#.............#...#......#...
|
||||
.#.#.#.##..#.#..##...#.........
|
||||
.##...........#..#.#........#..
|
||||
.#..##.....#....#...#...#......
|
||||
#.#.....##.#..#...######....#..
|
||||
....#..#...##...#.........###..
|
||||
..##.#...##..#......#.##..#...#
|
||||
##..##...........#.......#.#...
|
||||
.......##..##...###.##.......#.
|
||||
.#.##...#.##...............#...
|
||||
.......#.............#.......##
|
||||
......#...........#...#..##....
|
||||
.#..#..#....#..........#......#
|
||||
...........#..#.....#....##....
|
||||
###....#....##..#..##.....##...
|
||||
#........#........#...#.##.##..
|
||||
##.#.#........#..#.#..#.......#
|
||||
.##.#.....#............#.......
|
||||
.....#........#..##......##....
|
||||
.#.####.#.##..................#
|
||||
#...##.......#...#....#.#.##...
|
||||
#.#.##...#.#......#.....#....#.
|
||||
.........#....#...#....#.....#.
|
||||
...#..#..#.#..#.##........##.#.
|
||||
..#.##.#...#...#....#....##..#.
|
||||
.#..#...####..........#.......#
|
||||
....#...#...#...##.#.##......#.
|
||||
.#....#...#.#..##..##.#.....#..
|
||||
.....#....#......#.#####...###.
|
||||
..#...##..#......#.#....#.....#
|
||||
.##....##..###.#.....##.##.##..
|
||||
#...#.#.........#....#....#....
|
||||
...#.........#.##....##.#.#.#..
|
||||
...#...#.#....#..#.#.......#.#.
|
||||
#......#..#....##....#.........
|
||||
...........#......#......###..#
|
||||
#..#...#..##..#....#.....#.#.#.
|
||||
#.#.....##..#..........###..#..
|
||||
#...#.....#.......#..##...#....
|
||||
...#....##.....#..##..#....#...
|
||||
#...#.#......#..#...#........#.
|
||||
.#....#...#...#.........##....#
|
||||
..##...#.........#.......##..#.
|
||||
......#.......#.....##....#..#.
|
||||
.....##..#...#............#.#.#
|
||||
...#....#.##..#...#.#....#.....
|
||||
...#...........#.##....#..##.##
|
||||
##......##....##...........#.#.
|
||||
..##..##......#...#.##.##..#...
|
||||
.#..##.#...##...#......###.##.#
|
||||
###.#....##..#..#.##..##...##..
|
||||
..#........##.#...#.......#....
|
||||
.....##....##.#.###.....#....#.
|
||||
#.##....#....##.....#..#.#.....
|
||||
#.........#..##...##.......##..
|
||||
.#....#......#.#...##..........
|
||||
##..##.....##....###..#...#.#.#
|
||||
..##.#.#..#......#.#....###..#.
|
||||
.#.##.....##.......##.#.##..#..
|
||||
..##...#........#.#.#.##.#..###
|
||||
........#.......#...##....#.#..
|
||||
...#..#...#.##..#...#.#.###.##.
|
||||
..#.#....#..#...#..##.........#
|
||||
#....#..##..##....#.........#..
|
||||
.......#.......#....#....#.#...
|
||||
...#.##...#...#..#....#.###.##.
|
||||
##.##...#..........#....#......
|
||||
#.##.#.....#..#............##.#
|
||||
.##...#.#.#.##...........#..##.
|
||||
.#...#....#.......##...##...#.#
|
||||
.#......#..#...#...#....#.#....
|
||||
...#..#..#...#..##..##.....#..#
|
||||
.#.##..#.#...#..#.#...#...#...#
|
||||
#.##..........#.##..#....#.....
|
||||
##....#.#..........#..#....#...
|
||||
..#..##.#.......#...#.##......#
|
||||
....##......#......#.#.#.##....
|
||||
###......#...##..#..........###
|
||||
##.#.##.....###.#..#.#......#..
|
||||
#.#.#........#..........#....#.
|
||||
...#.#..#.......#......##.#....
|
||||
......#.....#.#.#....###..#...#
|
||||
.........#...#..#####..#.#..#..
|
||||
..........#.#.#####.#..#.....#.
|
||||
....#.......#.#....#.....##..#.
|
||||
#...##.#..#.#........#.#..#..##
|
||||
#......#..#.#.....##......#.##.
|
||||
.##...#....#.##..#.....###..#..
|
||||
#....#.#..##....##..#.#####....
|
||||
.......##..........#......#....
|
||||
......#.#...#............#.....
|
||||
.......###.....##.#..#.#....#.#
|
||||
...#...#..........#....##...##.
|
||||
.#..#.#.#....#.#.....##..#.#..#
|
||||
......#.#..#....#..#...#.......
|
||||
##.#####............#.#.####.#.
|
||||
#.....###.#.......##...###....#
|
||||
......#.##..##.........#.#.....
|
||||
.#.#......#..#.##......#......#
|
||||
.#.#.#..#.#...##.....#..#.#..#.
|
||||
.#.#....#......................
|
||||
#.#..###...#...####.##.#....#.#
|
||||
.....#............#....#..#.##.
|
||||
#..#...#.#....#....#..#..#...#.
|
||||
...#.......#..#.#....#.......#.
|
||||
.#..#.#...#.#.####..#...#....##
|
||||
....#..#..............####....#
|
||||
.....#.#.###....#.#.#.#...#....
|
||||
..####..#.#.##.##.##....#..#...
|
||||
.#.#.#.###..#.##..............#
|
||||
..#.#..#...#.....#.......#.##..
|
||||
.#.#..#.....##...###.....#..#..
|
||||
..#..#......#.##..#......##..#.
|
||||
.....#.#.#..##..###.#..........
|
||||
.##......#...#.##.......#..#..#
|
||||
.......#...#.....###.##...##...
|
||||
..##..#.#.......#..............
|
||||
#.....#......#.#..#..#..#......
|
||||
..###.......##...#.##....#.....
|
||||
.....##...........##.....#...##
|
||||
.#.#.####....###.#.......#...##
|
||||
#.#..##.#.#.....#.#....#.......
|
||||
.........#.#..#...............#
|
||||
..##.#..#..#####.###.........#.
|
||||
.#........#...#...#...#.##.#..#
|
||||
.#.##..........#..##....#.#.#..
|
||||
.##......#....#.#....##.#.#.#..
|
||||
.......##.####..#..#.#..#.#...#
|
||||
...#.....#..##..###.#..##...#..
|
||||
#.......##..#####....#.......#.
|
||||
#.#.##.................#...###.
|
||||
................####...........
|
||||
.#..#......#...###.............
|
||||
......#.#.##.##.....#..........
|
||||
.......#..#.#............##....
|
||||
#........#..#....#......#.####.
|
||||
...#.#....##..#..#.............
|
||||
..#.#......#...#.#..#..........
|
||||
###...###...........#......#...
|
||||
#.###..###........###...#..###.
|
||||
.#.....#...#.#...........##....
|
||||
....#..##.....#..#......#......
|
||||
#.###.#........#.#.##..........
|
||||
#.#.#.#.#..#.#...#...##.#......
|
||||
..###.......###..#.#.#.#.#.....
|
||||
...#........#.......#.###..##..
|
||||
.#........#...#.#........#..##.
|
||||
#.......###..#....##.###...#..#
|
||||
.##....###..##...........##...#
|
||||
#...#..........#.....#..##..#..
|
||||
#..##..#..##.#.........##......
|
||||
..#.#..###..###.....#.......#..
|
||||
#...#...........##.#.#.###.....
|
||||
...#....#.....#.....#.##.#.##.#
|
||||
...........##.......####...#..#
|
||||
#.#...#..##..#.#..#..........#.
|
||||
..#...#.##........#.#..........
|
||||
.##.....#.#.#....#.#.......#.#.
|
||||
.......#.##...#.##....#.#...#..
|
||||
......#...##...###...#.....###.
|
||||
##......#.##.####.##...##......
|
||||
..#....#.#..###.#..##....#..#..
|
||||
...##..###.....###.....#.......
|
||||
...#.....#.#........#..#..##.#.
|
||||
.....................#.....#.#.
|
||||
.#...#...##.#..#..........#...#
|
||||
#.....#..#....#..#.......####..
|
||||
.##.......##......###.#..#...##
|
||||
.#.##..#...#..........##.......
|
||||
...##...........##..##......#..
|
||||
#....##.##...#......##.#.##.##.
|
||||
..##.##.#.#.#....#........#.#..
|
||||
....#......#......##..##.#.#...
|
||||
.............#.##...#..#...#...
|
||||
.#..#...#.........#...........#
|
||||
....#.....#..................#.
|
||||
........##............#...#..##
|
||||
.###.....##...#...#.##.....##..
|
||||
...##.#.........##.#.#..#......
|
||||
#...........##.#..#........#..#
|
||||
....#....#..##.#..##..#..#..#.#
|
||||
#..##..#............#...#.#.#..
|
||||
#......#..##......#...##..#...#
|
||||
....#.#..##.#.#...####...#.....
|
||||
.##..#..##....#...#....#...##.#
|
||||
##.....#.#........#....#.#.#...
|
||||
......#.#...##....#.###.....#.#
|
||||
..#..#............###.###.##.#.
|
||||
#..#.##.##.##..#...#.#.##..#...
|
||||
....#..#.#...#......#..###.....
|
||||
.#........#...###.....#...#....
|
||||
....##.##....#..#...#.#####.#.#
|
||||
...#..#...#.#.....#....#...###.
|
||||
..........####...##............
|
||||
.....#....##...##......#..#...#
|
||||
..#...#.####......#...#..#..###
|
||||
.#.....#....#..#...###..#.#....
|
||||
..#..#......#.#...#.....##....#
|
||||
.....##....#....#...#.....##...
|
||||
#............##.#....#.#.#..#..
|
||||
#......#......#....#.#..##.#...
|
||||
#.#......##.....#.#..##.#.#....
|
||||
.#.###..#.#......##...........#
|
||||
#.#.........##..#.#.##......#..
|
||||
##....####...##...........#....
|
||||
....###.#..##.#.#.##...##.....#
|
||||
..###.......##.......#......#..
|
||||
..#.###.##.#...................
|
||||
...#.#...#..#..#..##.###...#.#.
|
||||
#...#..#...#..#....#..#...#....
|
||||
....#........#.#.#.##.##.#..#.#
|
||||
...#....#.#...#..#....#.#.#....
|
||||
..#...#..##.#....##...###...##.
|
||||
#......#.....#.....#....####.#.
|
||||
...##.#..#.#.....#..#..##.#....
|
||||
.####.#..#...#.#......#......#.
|
||||
..#.#....#..#..##.#......##....
|
||||
....#...#.#..#...#...##........
|
||||
##..#.#....#..#.........#..##..
|
||||
...#.......#....#..##...###..##
|
||||
#......##.#..#..#..#..###.#.###
|
||||
.#..##.#...##...#.............#
|
||||
###.........#...###.#.#..#....#
|
||||
.#.....#..#........#.#.......#.
|
||||
#..#.#.....#.........###..#....
|
||||
#..##.....#.#....#.###.....#..#
|
||||
....#..#.......##..#.#..##....#
|
||||
##.##..#....#..#.#.###.........
|
||||
..##....#........#..#..#.##.#.#
|
||||
.#....#...##..#.#.....#..##..#.
|
||||
#..#.......#......#...#...#.##.
|
||||
...##.#......#.#..#......#.....
|
||||
......#...#.##.#....#...#.##.#.
|
||||
#.....#..#.#.#...##...#........
|
||||
....#.#..#.#.....#....#.#..#...
|
||||
....#.#...###............#.....
|
||||
.#.#...##.......#....#.##...#.#
|
||||
.....#.##......#.#..#...#....#.
|
||||
.###....#...#........#.........
|
||||
..#.....#..#.#.#..##...#..#....
|
||||
...###..#....#.....#.........##
|
||||
#....#....###...#.#............
|
||||
.#..##.....#...........#.#..#..
|
||||
..#.#.#.......##..#.#..........
|
||||
.#...#...####.#...#####.....#.#
|
||||
..#....##.....#..#...#.........
|
||||
#.#......#.##.........#......##
|
||||
..#.#...#.##..#....#....#.##...
|
||||
#....#......##.#..#......#.#.#.
|
||||
#.#.............##..#.#........
|
||||
..#.###.......##.....##.#..##.#
|
||||
.........#........#...#..#....#
|
||||
.........##.#.#..#..#....#....#
|
||||
##..#..#.#.....##.........#.#.#
|
||||
..##.##..#.##..........##.#..#.
|
||||
...#..#####.......#.........#..
|
||||
@@ -0,0 +1,11 @@
|
||||
..##.......
|
||||
#...#...#..
|
||||
.#....#..#.
|
||||
..#.#...#.#
|
||||
.#...##..#.
|
||||
..#.##.....
|
||||
.#.#.#....#
|
||||
.#........#
|
||||
#.##...#...
|
||||
#...##....#
|
||||
.#..#...#.#
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class Point extends Tuple2 {
|
||||
Point(x, y) : super(x, y);
|
||||
|
||||
Point operator +(Point other) {
|
||||
return Point(item1 + other.item1, item2 + other.item2);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
class ReadData {
|
||||
static const prefix = 'lib/data/';
|
||||
|
||||
static Future<List<String>> readFileString(String classString) async {
|
||||
var fileName = 'lib/model/' + classString.toLowerCase() + '.data';
|
||||
var fileName = prefix + classString.toLowerCase() + '.data';
|
||||
var file = File(fileName);
|
||||
var contents = <String>[];
|
||||
|
||||
@@ -16,7 +18,7 @@ class ReadData {
|
||||
}
|
||||
|
||||
static Future<List<num>> readFileNum(String classString) async {
|
||||
var fileName = 'lib/model/' + classString.toLowerCase() + '.data';
|
||||
var fileName = prefix + classString.toLowerCase() + '.data';
|
||||
var file = File(fileName);
|
||||
var contents = <num>[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user