From f46e190e989f6d825221393a84486584bce5a01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Mon, 19 Dec 2022 22:17:29 +0100 Subject: [PATCH] Add all tests from previous days. --- 2022/day19.py | 1 - 2022/inputs/day20.txt | 0 2022/inputs/day21.txt | 0 2022/inputs/day22.txt | 0 2022/inputs/day23.txt | 0 2022/inputs/day24.txt | 0 2022/inputs/day25.txt | 0 2022/tests/day1.txt | 14 ++++ 2022/tests/day10.txt | 146 ++++++++++++++++++++++++++++++++++++++++++ 2022/tests/day11.txt | 27 ++++++++ 2022/tests/day12.txt | 5 ++ 2022/tests/day13.txt | 23 +++++++ 2022/tests/day14.txt | 2 + 2022/tests/day15.txt | 14 ++++ 2022/tests/day16.txt | 10 +++ 2022/tests/day2.txt | 3 + 2022/tests/day20.txt | 0 2022/tests/day21.txt | 0 2022/tests/day22.txt | 0 2022/tests/day23.txt | 0 2022/tests/day24.txt | 0 2022/tests/day25.txt | 0 2022/tests/day3.txt | 6 ++ 2022/tests/day4.txt | 6 ++ 2022/tests/day5.txt | 9 +++ 2022/tests/day6.txt | 1 + 2022/tests/day7.txt | 23 +++++++ 2022/tests/day8.txt | 5 ++ 2022/tests/day9.txt | 8 +++ run.ps1 | 6 +- 30 files changed, 306 insertions(+), 3 deletions(-) create mode 100644 2022/inputs/day20.txt create mode 100644 2022/inputs/day21.txt create mode 100644 2022/inputs/day22.txt create mode 100644 2022/inputs/day23.txt create mode 100644 2022/inputs/day24.txt create mode 100644 2022/inputs/day25.txt create mode 100644 2022/tests/day1.txt create mode 100644 2022/tests/day10.txt create mode 100644 2022/tests/day11.txt create mode 100644 2022/tests/day12.txt create mode 100644 2022/tests/day13.txt create mode 100644 2022/tests/day14.txt create mode 100644 2022/tests/day15.txt create mode 100644 2022/tests/day16.txt create mode 100644 2022/tests/day2.txt create mode 100644 2022/tests/day20.txt create mode 100644 2022/tests/day21.txt create mode 100644 2022/tests/day22.txt create mode 100644 2022/tests/day23.txt create mode 100644 2022/tests/day24.txt create mode 100644 2022/tests/day25.txt create mode 100644 2022/tests/day3.txt create mode 100644 2022/tests/day4.txt create mode 100644 2022/tests/day5.txt create mode 100644 2022/tests/day6.txt create mode 100644 2022/tests/day7.txt create mode 100644 2022/tests/day8.txt create mode 100644 2022/tests/day9.txt diff --git a/2022/day19.py b/2022/day19.py index 67673ae..9de2cd1 100644 --- a/2022/day19.py +++ b/2022/day19.py @@ -124,7 +124,6 @@ def run(blueprint: dict[Reagent, dict[Reagent, int]], max_time: int) -> int: ) ) - # this speeds-up the process and work but I am not 100% sure this is right if "geode" in robots_that_can_be_built: robots_that_can_be_built = ["geode"] else: diff --git a/2022/inputs/day20.txt b/2022/inputs/day20.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/inputs/day21.txt b/2022/inputs/day21.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/inputs/day22.txt b/2022/inputs/day22.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/inputs/day23.txt b/2022/inputs/day23.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/inputs/day24.txt b/2022/inputs/day24.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/inputs/day25.txt b/2022/inputs/day25.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day1.txt b/2022/tests/day1.txt new file mode 100644 index 0000000..2094f91 --- /dev/null +++ b/2022/tests/day1.txt @@ -0,0 +1,14 @@ +1000 +2000 +3000 + +4000 + +5000 +6000 + +7000 +8000 +9000 + +10000 diff --git a/2022/tests/day10.txt b/2022/tests/day10.txt new file mode 100644 index 0000000..37ee8ee --- /dev/null +++ b/2022/tests/day10.txt @@ -0,0 +1,146 @@ +addx 15 +addx -11 +addx 6 +addx -3 +addx 5 +addx -1 +addx -8 +addx 13 +addx 4 +noop +addx -1 +addx 5 +addx -1 +addx 5 +addx -1 +addx 5 +addx -1 +addx 5 +addx -1 +addx -35 +addx 1 +addx 24 +addx -19 +addx 1 +addx 16 +addx -11 +noop +noop +addx 21 +addx -15 +noop +noop +addx -3 +addx 9 +addx 1 +addx -3 +addx 8 +addx 1 +addx 5 +noop +noop +noop +noop +noop +addx -36 +noop +addx 1 +addx 7 +noop +noop +noop +addx 2 +addx 6 +noop +noop +noop +noop +noop +addx 1 +noop +noop +addx 7 +addx 1 +noop +addx -13 +addx 13 +addx 7 +noop +addx 1 +addx -33 +noop +noop +noop +addx 2 +noop +noop +noop +addx 8 +noop +addx -1 +addx 2 +addx 1 +noop +addx 17 +addx -9 +addx 1 +addx 1 +addx -3 +addx 11 +noop +noop +addx 1 +noop +addx 1 +noop +noop +addx -13 +addx -19 +addx 1 +addx 3 +addx 26 +addx -30 +addx 12 +addx -1 +addx 3 +addx 1 +noop +noop +noop +addx -9 +addx 18 +addx 1 +addx 2 +noop +noop +addx 9 +noop +noop +noop +addx -1 +addx 2 +addx -37 +addx 1 +addx 3 +noop +addx 15 +addx -21 +addx 22 +addx -6 +addx 1 +noop +addx 2 +addx 1 +noop +addx -10 +noop +noop +addx 20 +addx 1 +addx 2 +addx 2 +addx -6 +addx -11 +noop +noop +noop diff --git a/2022/tests/day11.txt b/2022/tests/day11.txt new file mode 100644 index 0000000..30e09e5 --- /dev/null +++ b/2022/tests/day11.txt @@ -0,0 +1,27 @@ +Monkey 0: + Starting items: 79, 98 + Operation: new = old * 19 + Test: divisible by 23 + If true: throw to monkey 2 + If false: throw to monkey 3 + +Monkey 1: + Starting items: 54, 65, 75, 74 + Operation: new = old + 6 + Test: divisible by 19 + If true: throw to monkey 2 + If false: throw to monkey 0 + +Monkey 2: + Starting items: 79, 60, 97 + Operation: new = old * old + Test: divisible by 13 + If true: throw to monkey 1 + If false: throw to monkey 3 + +Monkey 3: + Starting items: 74 + Operation: new = old + 3 + Test: divisible by 17 + If true: throw to monkey 0 + If false: throw to monkey 1 diff --git a/2022/tests/day12.txt b/2022/tests/day12.txt new file mode 100644 index 0000000..86e9cac --- /dev/null +++ b/2022/tests/day12.txt @@ -0,0 +1,5 @@ +Sabqponm +abcryxxl +accszExk +acctuvwj +abdefghi diff --git a/2022/tests/day13.txt b/2022/tests/day13.txt new file mode 100644 index 0000000..af73fbb --- /dev/null +++ b/2022/tests/day13.txt @@ -0,0 +1,23 @@ +[1,1,3,1,1] +[1,1,5,1,1] + +[[1],[2,3,4]] +[[1],4] + +[9] +[[8,7,6]] + +[[4,4],4,4] +[[4,4],4,4,4] + +[7,7,7,7] +[7,7,7] + +[] +[3] + +[[[]]] +[[]] + +[1,[2,[3,[4,[5,6,7]]]],8,9] +[1,[2,[3,[4,[5,6,0]]]],8,9] diff --git a/2022/tests/day14.txt b/2022/tests/day14.txt new file mode 100644 index 0000000..4e87bb5 --- /dev/null +++ b/2022/tests/day14.txt @@ -0,0 +1,2 @@ +498,4 -> 498,6 -> 496,6 +503,4 -> 502,4 -> 502,9 -> 494,9 diff --git a/2022/tests/day15.txt b/2022/tests/day15.txt new file mode 100644 index 0000000..a612424 --- /dev/null +++ b/2022/tests/day15.txt @@ -0,0 +1,14 @@ +Sensor at x=2, y=18: closest beacon is at x=-2, y=15 +Sensor at x=9, y=16: closest beacon is at x=10, y=16 +Sensor at x=13, y=2: closest beacon is at x=15, y=3 +Sensor at x=12, y=14: closest beacon is at x=10, y=16 +Sensor at x=10, y=20: closest beacon is at x=10, y=16 +Sensor at x=14, y=17: closest beacon is at x=10, y=16 +Sensor at x=8, y=7: closest beacon is at x=2, y=10 +Sensor at x=2, y=0: closest beacon is at x=2, y=10 +Sensor at x=0, y=11: closest beacon is at x=2, y=10 +Sensor at x=20, y=14: closest beacon is at x=25, y=17 +Sensor at x=17, y=20: closest beacon is at x=21, y=22 +Sensor at x=16, y=7: closest beacon is at x=15, y=3 +Sensor at x=14, y=3: closest beacon is at x=15, y=3 +Sensor at x=20, y=1: closest beacon is at x=15, y=3 diff --git a/2022/tests/day16.txt b/2022/tests/day16.txt new file mode 100644 index 0000000..9f30acc --- /dev/null +++ b/2022/tests/day16.txt @@ -0,0 +1,10 @@ +Valve AA has flow rate=0; tunnels lead to valves DD, II, BB +Valve BB has flow rate=13; tunnels lead to valves CC, AA +Valve CC has flow rate=2; tunnels lead to valves DD, BB +Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE +Valve EE has flow rate=3; tunnels lead to valves FF, DD +Valve FF has flow rate=0; tunnels lead to valves EE, GG +Valve GG has flow rate=0; tunnels lead to valves FF, HH +Valve HH has flow rate=22; tunnel leads to valve GG +Valve II has flow rate=0; tunnels lead to valves AA, JJ +Valve JJ has flow rate=21; tunnel leads to valve II diff --git a/2022/tests/day2.txt b/2022/tests/day2.txt new file mode 100644 index 0000000..db60e36 --- /dev/null +++ b/2022/tests/day2.txt @@ -0,0 +1,3 @@ +A Y +B X +C Z diff --git a/2022/tests/day20.txt b/2022/tests/day20.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day21.txt b/2022/tests/day21.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day22.txt b/2022/tests/day22.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day23.txt b/2022/tests/day23.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day24.txt b/2022/tests/day24.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day25.txt b/2022/tests/day25.txt new file mode 100644 index 0000000..e69de29 diff --git a/2022/tests/day3.txt b/2022/tests/day3.txt new file mode 100644 index 0000000..f17e726 --- /dev/null +++ b/2022/tests/day3.txt @@ -0,0 +1,6 @@ +vJrwpWtwJgWrhcsFMMfFFhFp +jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL +PmmdzqPrVvPwwTWBwg +wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn +ttgJtRGJQctTZtZT +CrZsJsPPZsGzwwsLwLmpwMDw diff --git a/2022/tests/day4.txt b/2022/tests/day4.txt new file mode 100644 index 0000000..9f9e9cf --- /dev/null +++ b/2022/tests/day4.txt @@ -0,0 +1,6 @@ +2-4,6-8 +2-3,4-5 +5-7,7-9 +2-8,3-7 +6-6,4-6 +2-6,4-8 diff --git a/2022/tests/day5.txt b/2022/tests/day5.txt new file mode 100644 index 0000000..42ef47f --- /dev/null +++ b/2022/tests/day5.txt @@ -0,0 +1,9 @@ + [D] +[N] [C] +[Z] [M] [P] + 1 2 3 + +move 1 from 2 to 1 +move 3 from 1 to 3 +move 2 from 2 to 1 +move 1 from 1 to 2 diff --git a/2022/tests/day6.txt b/2022/tests/day6.txt new file mode 100644 index 0000000..7980a82 --- /dev/null +++ b/2022/tests/day6.txt @@ -0,0 +1 @@ +mjqjpqmgbljsphdztnvjfqwrcgsmlb diff --git a/2022/tests/day7.txt b/2022/tests/day7.txt new file mode 100644 index 0000000..09a921e --- /dev/null +++ b/2022/tests/day7.txt @@ -0,0 +1,23 @@ +$ cd / +$ ls +dir a +14848514 b.txt +8504156 c.dat +dir d +$ cd a +$ ls +dir e +29116 f +2557 g +62596 h.lst +$ cd e +$ ls +584 i +$ cd .. +$ cd .. +$ cd d +$ ls +4060174 j +8033020 d.log +5626152 d.ext +7214296 k diff --git a/2022/tests/day8.txt b/2022/tests/day8.txt new file mode 100644 index 0000000..16d6fbd --- /dev/null +++ b/2022/tests/day8.txt @@ -0,0 +1,5 @@ +30373 +25512 +65332 +33549 +35390 diff --git a/2022/tests/day9.txt b/2022/tests/day9.txt new file mode 100644 index 0000000..9874df2 --- /dev/null +++ b/2022/tests/day9.txt @@ -0,0 +1,8 @@ +R 4 +U 4 +L 3 +D 1 +R 4 +D 1 +L 5 +R 2 diff --git a/run.ps1 b/run.ps1 index 8a58dea..0fb46b3 100644 --- a/run.ps1 +++ b/run.ps1 @@ -1,3 +1,5 @@ -param ($day) +param([switch]$Test, $day) -Get-Content ".\2022\inputs\day$day.txt" | python ".\2022\day$day.py" +$folder = $Test ? "tests" : "inputs" + +Get-Content ".\2022\$folder\day$day.txt" | python ".\2022\day$day.py"