|
|
|
|
@ -1,15 +1,6 @@
|
|
|
|
|
import 'package:aoc2020/aocbase.dart';
|
|
|
|
|
import 'package:aoc2020/model/readdata.dart';
|
|
|
|
|
|
|
|
|
|
// byr (Birth Year)
|
|
|
|
|
// iyr (Issue Year)
|
|
|
|
|
// eyr (Expiration Year)
|
|
|
|
|
// hgt (Height)
|
|
|
|
|
// hcl (Hair Color)
|
|
|
|
|
// ecl (Eye Color)
|
|
|
|
|
// pid (Passport ID)
|
|
|
|
|
// cid (Country ID)
|
|
|
|
|
|
|
|
|
|
typedef Validator = bool Function(String);
|
|
|
|
|
|
|
|
|
|
class AOC20201204 extends AOCBase {
|
|
|
|
|
@ -50,18 +41,6 @@ class AOC20201204 extends AOCBase {
|
|
|
|
|
},
|
|
|
|
|
'cid': (val) => true,
|
|
|
|
|
};
|
|
|
|
|
// ^#([a-fA-F0-9]{6}])
|
|
|
|
|
|
|
|
|
|
// byr (Birth Year) - four digits; at least 1920 and at most 2002.
|
|
|
|
|
// iyr (Issue Year) - four digits; at least 2010 and at most 2020.
|
|
|
|
|
// eyr (Expiration Year) - four digits; at least 2020 and at most 2030.
|
|
|
|
|
// hgt (Height) - a number followed by either cm or in:
|
|
|
|
|
// If cm, the number must be at least 150 and at most 193.
|
|
|
|
|
// If in, the number must be at least 59 and at most 76.
|
|
|
|
|
// hcl (Hair Color) - a # followed by exactly six characters 0-9 or a-f.
|
|
|
|
|
// ecl (Eye Color) - exactly one of: amb blu brn gry grn hzl oth.
|
|
|
|
|
// pid (Passport ID) - a nine-digit number, including leading zeroes.
|
|
|
|
|
// cid (Country ID) - ignored, missing or not.
|
|
|
|
|
|
|
|
|
|
bool validate(Map<String, String> passport, Map<String, Validator> validatorFn) {
|
|
|
|
|
for (var field in fields) {
|
|
|
|
|
|