class TestSolverDay22(PuzzleExamplesChecker): day: int = 22 solver: SolverDay22 = SolverDay22 examples: List[Example] = [ Example( data="""\ Player 1: 9 2 6 3 1 Player 2: 5 8 4 7 10""", solution_part1=306, solution_part2=291, ), Example(data=""" Player 1: 43 19 Player 2: 2 29 14""", solution_part2=105) ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay22.parser(y)
class TestSolverDay16(PuzzleExamplesChecker): day: int = 16 solver: SolverDay16 = SolverDay16 examples: List[Example] = [ Example( data="""\ class: 1-3 or 5-7 row: 6-11 or 33-44 seat: 13-40 or 45-50 your ticket: 7,1,14 nearby tickets: 7,3,47 40,4,50 55,2,20 38,6,12""", solution_part1=71, ), Example(data="""\ class: 0-1 or 4-19 departure_row: 0-5 or 8-19 departure_seat: 0-13 or 16-19 your ticket: 11,12,13 nearby tickets: 3,9,18 15,1,5 5,14,9""", solution_part2=143) ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay16.parser(y)
class TestSolverDay10(PuzzleExamplesChecker): day: int = 10 solver: SolverDay10 = SolverDay10 examples: List[Example] = [ Example( data="""\ 16 10 15 5 1 11 7 19 6 12 4""", solution_part1=35, solution_part2=8, ), Example( data="""\ 28 33 18 42 31 14 46 20 48 47 24 23 49 45 19 38 39 11 1 32 25 35 8 17 7 9 4 2 34 10 3""", solution_part1=220, solution_part2=19208, ), ] parser: Callable[[str], List[str]] = SolverDay10.parser
class TestSolverDay5(PuzzleExamplesChecker): day: int = 4 solver: SolverDay5 = SolverDay5 examples: List[Example] = [ Example(data="BFFFBBFRRR", solution_part1=567), Example(data="FFFBBBFRRR", solution_part1=119), Example(data="BBFFBBFRLL", solution_part1=820), ] parser: Callable[[str], List[Seat]] = SolverDay5.parser
class TestSolverDay4(PuzzleExamplesChecker): day: int = 4 solver: SolverDay4 = SolverDay4 examples: List[Example] = [ Example( data="""\ ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929 hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in""", solution_part1=2, ), Example(data="""\ eyr:1972 cid:100 hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926 iyr:2019 hcl:#602927 eyr:1967 hgt:170cm ecl:grn pid:012533040 byr:1946 hcl:dab227 iyr:2012 ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277 hgt:59cm ecl:zzz eyr:2038 hcl:74454a iyr:2023 pid:3556412378 byr:2007""", solution_part2=0), Example(data="""\ pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980 hcl:#623a2f eyr:2029 ecl:blu cid:129 byr:1989 iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm hcl:#888785 hgt:164cm byr:2001 iyr:2015 cid:88 pid:545766238 ecl:hzl eyr:2022 iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719""", solution_part2=4) ] # hack to get around the fact that python sucks ass parser: Callable[[str], List[Passport]] = lambda x, y: SolverDay4.parser(y)
class TestSolverDay6(PuzzleExamplesChecker): day: int = 6 solver: SolverDay6 = SolverDay6 examples: List[Example] = [ Example( data="""\ abc a b c ab ac a a a a b""", solution_part1=11, solution_part2=6, ), ] parser: Callable[[str], List[str]] = SolverDay6.parser
class TestSolverDay9(PuzzleExamplesChecker): def solver_(self, puzzle): return SolverDay9(puzzle, pool_size=5) day: int = 9 solver: SolverDay9 = solver_ examples: List[Example] = [ Example( data="""\ 35 20 15 25 47 40 62 55 65 95 102 117 150 182 127 219 299 277 309 576""", solution_part1=127, solution_part2=62, ), ] parser: Callable[[str], List[str]] = SolverDay9.parser
class TestSolverDay24(PuzzleExamplesChecker): day: int = 24 solver: SolverDay24 = SolverDay24 examples: List[Example] = [ Example( data="""\ sesenwnenenewseeswwswswwnenewsewsw neeenesenwnwwswnenewnwwsewnenwseswesw seswneswswsenwwnwse nwnwneseeswswnenewneswwnewseswneseene swweswneswnenwsewnwneneseenw eesenwseswswnenwswnwnwsewwnwsene sewnenenenesenwsewnenwwwse wenwwweseeeweswwwnwwe wsweesenenewnwwnwsenewsenwwsesesenwne neeswseenwwswnwswswnw nenwswwsewswnenenewsenwsenwnesesenew enewnwewneswsewnwswenweswnenwsenwsw sweneswneswneneenwnewenewwneswswnese swwesenesewenwneswnwwneseswwne enesenwswwswneneswsenwnewswseenwsese wnwnesenesenenwwnenwsewesewsesesew nenewswnwewswnenesenwnesewesw eneswnwswnwsenenwnwnwwseeswneewsenese neswnwewnwnwseenwseesewsenwsweewe wseweeenwnesenwwwswnew""", solution_part1=10, solution_part2=2208, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay24.parser(y)
class TestSolverDay1(PuzzleExamplesChecker): day: int = 1 solver: SolverDay1 = SolverDay1 examples: List[Example] = [ Example(data=[1721, 979, 366, 299, 675, 1456], solution_part1=514579, solution_part2=241861950) ]
class TestSolverDay23(PuzzleExamplesChecker): day: int = 23 solver: SolverDay23 = SolverDay23 examples: List[Example] = [ Example( data="389125467", solution_part1=67384529, # solution_part2=149245887792 # too slow, should rework this to use linked list first ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay23.parser(y)
class TestSolverDay25(PuzzleExamplesChecker): day: int = 25 solver: SolverDay25 = SolverDay25 examples: List[Example] = [ Example( data="""\ 5764801 17807724""", solution_part1=14897079, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay25.parser(y)
class TestSolverDay14(PuzzleExamplesChecker): day: int = 14 solver: SolverDay14 = SolverDay14 examples: List[Example] = [ Example( data="""\ mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X mem[8] = 11 mem[7] = 101 mem[8] = 0""", solution_part1=165, ), Example( data="""\ mask = 000000000000000000000000000000X1001X mem[42] = 100 mask = 00000000000000000000000000000000X0XX mem[26] = 1""", solution_part2=208, ) ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay14.parser(y)
class TestSolverDay17(PuzzleExamplesChecker): day: int = 17 solver: SolverDay17 = SolverDay17 examples: List[Example] = [ Example( data="""\ .#. ..# ###""", solution_part1=112, solution_part2=848, ) ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay17.parser(y)
class TestSolverDay18(PuzzleExamplesChecker): day: int = 18 solver: SolverDay18 = SolverDay18 examples: List[Example] = [ Example( data="2 * 3 + (4 * 5)", solution_part1=26, solution_part2=46, ), Example( data="5 + (8 * 3 + 9 + 3 * 4 * 3)", solution_part1=437, ), Example( data="5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))", solution_part1=12240, ), Example( data="((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2", solution_part1=13632, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay18.parser(y)
class TestSolverDay2(PuzzleExamplesChecker): day: int = 2 solver: SolverDay2 = SolverDay2 examples: List[Example] = [ Example( data="""\ 1-3 a: abcde 1-3 b: cdefg 2-9 c: ccccccccc""", solution_part1=2, solution_part2=1, ) ] parser: Callable[[str], Tuple[CorporatePolicy, Password]] = SolverDay2.parser
class TestSolverDay21(PuzzleExamplesChecker): day: int = 21 solver: SolverDay21 = SolverDay21 examples: List[Example] = [ Example( data="""\ mxmxvkd kfcds sqjhc nhms (contains dairy, fish) trh fvjkl sbzzf mxmxvkd (contains dairy) sqjhc fvjkl (contains soy) sqjhc mxmxvkd sbzzf (contains fish)""", solution_part1=5, solution_part2="mxmxvkd,sqjhc,fvjkl", # type: ignore ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay21.parser(y)
class TestSolverDay12(PuzzleExamplesChecker): day: int = 12 solver: SolverDay12 = SolverDay12 examples: List[Example] = [ Example( data="""\ F10 N3 F7 R90 F11""", solution_part1=25, solution_part2=286, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay12.parser(y)
class TestSolverDay6(PuzzleExamplesChecker): day: int = 7 solver: SolverDay7 = SolverDay7 examples: List[Example] = [ Example( data="""\ light red bags contain 1 bright white bag, 2 muted yellow bags. dark orange bags contain 3 bright white bags, 4 muted yellow bags. bright white bags contain 1 shiny gold bag. muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. dark olive bags contain 3 faded blue bags, 4 dotted black bags. vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. faded blue bags contain no other bags. dotted black bags contain no other bags.""", solution_part1=4, solution_part2=32, ), ] parser: Callable[[str], List[str]] = SolverDay7.parser
class TestSolverDay11(PuzzleExamplesChecker): day: int = 11 solver: SolverDay11 = SolverDay11 examples: List[Example] = [ Example( data="""\ L.LL.LL.LL LLLLLLL.LL L.L.L..L.. LLLL.LL.LL L.LL.LL.LL L.LLLLL.LL ..L.L..... LLLLLLLLLL L.LLLLLL.L L.LLLLL.LL""", solution_part1=37, solution_part2=26, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay11.parser(y)
class TestSolverDay3(PuzzleExamplesChecker): day: int = 3 solver: SolverDay3 = SolverDay3 examples: List[Example] = [ Example(data="""\ ..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ..#.##..... .#.#.#....# .#........# #.##...#... #...##....# .#..#...#.#""", solution_part1=7, solution_part2=336) ] # hack to get around the fact that python sucks ass parser: Callable[[str], Forest] = lambda x, y: SolverDay3.parser(y)
class TestSolverDay13(PuzzleExamplesChecker): day: int = 12 solver: SolverDay13 = SolverDay13 examples: List[Example] = [ Example( data="""\ 939 7,13,x,x,59,x,31,19""", solution_part1=295, solution_part2=1068781, ), Example( data="""\ 939 17,x,13,19""", solution_part2=3417, ), Example( data="""\ 939 67,7,59,61""", solution_part2=754018, ), Example( data="""\ 939 67,x,7,59,61""", solution_part2=779210, ), Example( data="""\ 939 67,7,x,59,61""", solution_part2=1261476, ), Example( data="""\ 939 1789,37,47,1889""", solution_part2=1202161486, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay13.parser(y)
class TestSolverDay19(PuzzleExamplesChecker): day: int = 19 solver: SolverDay19 = SolverDay19 examples: List[Example] = [ Example( data="""\ 0: 4 1 5 1: 2 3 | 3 2 2: 4 4 | 5 5 3: 4 5 | 5 4 4: "a" 5: "b" ababbb bababa abbbab aaabbb aaaabbb""", solution_part1=2, ), Example( data="""\ 42: 9 14 | 10 1 9: 14 27 | 1 26 10: 23 14 | 28 1 1: "a" 11: 42 31 5: 1 14 | 15 1 19: 14 1 | 14 14 12: 24 14 | 19 1 16: 15 1 | 14 14 31: 14 17 | 1 13 6: 14 14 | 1 14 2: 1 24 | 14 4 0: 8 11 13: 14 3 | 1 12 15: 1 | 14 17: 14 2 | 1 7 23: 25 1 | 22 14 28: 16 1 4: 1 1 20: 14 14 | 1 15 3: 5 14 | 16 1 27: 1 6 | 14 18 14: "b" 21: 14 1 | 1 14 25: 1 1 | 1 14 22: 14 14 8: 42 26: 14 22 | 1 20 18: 15 15 7: 14 5 | 1 21 24: 14 1 abbbbbabbbaaaababbaabbbbabababbbabbbbbbabaaaa bbabbbbaabaabba babbbbaabbbbbabbbbbbaabaaabaaa aaabbbbbbaaaabaababaabababbabaaabbababababaaa bbbbbbbaaaabbbbaaabbabaaa bbbababbbbaaaaaaaabbababaaababaabab ababaaaaaabaaab ababaaaaabbbaba baabbaaaabbaaaababbaababb abbbbabbbbaaaababbbbbbaaaababb aaaaabbaabaaaaababaa aaaabbaaaabbaaa aaaabbaabbaaaaaaabbbabbbaaabbaabaaa babaaabbbaaabaababbaabababaaab aabbbbbaabbbaaaaaabbbbbababaaaaabbaaabba""", solution_part2=12, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay19.parser(y)
class TestSolverDay20(PuzzleExamplesChecker): day: int = 20 solver: SolverDay20 = SolverDay20 examples: List[Example] = [ Example( data="""\ Tile 2311: ..##.#..#. ##..#..... #...##..#. ####.#...# ##.##.###. ##...#.### .#.#.#..## ..#....#.. ###...#.#. ..###..### Tile 1951: #.##...##. #.####...# .....#..## #...###### .##.#....# .###.##### ###.##.##. .###....#. ..#.#..#.# #...##.#.. Tile 1171: ####...##. #..##.#..# ##.#..#.#. .###.####. ..###.#### .##....##. .#...####. #.##.####. ####..#... .....##... Tile 1427: ###.##.#.. .#..#.##.. .#.##.#..# #.#.#.##.# ....#...## ...##..##. ...#.##### .#.####.#. ..#..###.# ..##.#..#. Tile 1489: ##.#.#.... ..##...#.. .##..##... ..#...#... #####...#. #..#.#.#.# ...#.#.#.. ##.#...##. ..##.##.## ###.##.#.. Tile 2473: #....####. #..#.##... #.##..#... ######.#.# .#...#.#.# .######### .###.#..#. ########.# ##...##.#. ..###.#.#. Tile 2971: ..#.#....# #...###... #.#.###... ##.##..#.. .#####..## .#..####.# #..#.#..#. ..####.### ..#.#.###. ...#.#.#.# Tile 2729: ...#.#.#.# ####.#.... ..#.#..... ....#..#.# .##..##.#. .#.####... ####.#.#.. ##.####... ##..#.##.. #.##...##. Tile 3079: #.#.#####. .#..###### ..#....... ######.... ####.#..#. .#...#.##. #.#####.## ..#.###... ..#....... ..#.###...""", solution_part1=20899048083289, solution_part2=273, ), Example( data="""\ tile 1: #.# #.# ... tile 2: #.# #.# ... tile 3: #.# #.# ... tile 4: #.# #.# ... """, solution_part1=24, ), Example( data="""\ tile 1: ##. ... ... tile 2: ### ### .## tile 3: ... ... ... tile 4: .## ... ... """, solution_part1=24, ), ] parser: Callable[[str], List[str]] = lambda x, y: SolverDay20.parser(y)