2021-12-13 16:03:09 +00:00
|
|
|
// https://adventofcode.com/2021/day/13
|
|
|
|
|
|
|
|
import tap from "tap";
|
|
|
|
import fs from "fs-extra";
|
|
|
|
|
|
|
|
import * as p1 from "./part1.mjs";
|
|
|
|
import * as p2 from "./part2.mjs";
|
|
|
|
|
2021-12-13 16:03:28 +00:00
|
|
|
const sample = p1.processInput("sample");
|
|
|
|
const input = p1.processInput("input");
|
2021-12-13 16:03:09 +00:00
|
|
|
|
|
|
|
tap.test("part1", async (t) => {
|
2021-12-13 16:03:28 +00:00
|
|
|
const x = await sample;
|
|
|
|
t.equal(p1.solution(x), 17);
|
|
|
|
t.equal(p1.solution(x), 16);
|
|
|
|
t.equal(p1.solution(await input), 745);
|
2021-12-13 16:03:09 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tap.test("part2", async (t) => {
|
2021-12-13 16:03:28 +00:00
|
|
|
// t.equal(p2.solution(await sample), 0);
|
|
|
|
t.equal(
|
|
|
|
p2.solution(await input),
|
|
|
|
`.##..###..#..#...##.####.###...##...##..
|
2021-12-13 16:03:09 +00:00
|
|
|
#..#.#..#.#.#.....#.#....#..#.#..#.#..#.
|
|
|
|
#..#.###..##......#.###..###..#....#....
|
|
|
|
####.#..#.#.#.....#.#....#..#.#.##.#....
|
|
|
|
#..#.#..#.#.#..#..#.#....#..#.#..#.#..#.
|
2021-12-13 16:03:28 +00:00
|
|
|
#..#.###..#..#..##..#....###...###..##..`
|
|
|
|
);
|
2021-12-13 16:03:09 +00:00
|
|
|
});
|