Skip to content

Commit

Permalink
fix test, add real input because there was no test for part2
Browse files Browse the repository at this point in the history
  • Loading branch information
mirsella committed Dec 21, 2023
1 parent a324102 commit a8b2896
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 20 deletions.
131 changes: 131 additions & 0 deletions 2023/day21/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
...................................................................................................................................
.......#.#.#.#.....#.#...##..........#........##....#......#...............##........#..#...##.......###....#.##........#.#....#...
.###............#........#......#.....#...................................#............#..........#.....#..##.#.......#.....#......
.......#....#...##......#..............##.###....##......#..................#.....#..#.....#...#.#....#................#....#.##...
..............#................#..#.#...#......#.#..#....................##....#..#.#.....#.#..........#...#.#......#...#..#.......
.....#.....#............##.#.....#......#..#...................................#......##..#.#..........#.#..##..#................#.
.#....#......##.#...#..#.....#................##.#....#.............................##...#...#........#....#.......................
....#.....#................#.....##...............#...............#...........#..#...........#.........#.............#........#....
.........#.................#...........#......#...#...............#...........#....#....#..........#...#.#.##.................#....
.........#....#..#.....#..#..#.#....#...#......................#................####...#.....#..........#.......#..#........#......
..............#.##...............#.#.#..........#..#............#.........................................#.#.#............#.#.....
..............#...#.....#...#....##.............##............##..#.................###........#....#.#.......................#..#.
......#.....##..#....#.#......#.#....#..#.#.....#............................................##.#.....#.#.......#......#.#.#.......
........#.............#.............#.....#................#.......#.....................#...#.........#..#...##..##...##..###.....
.......#..........................#........................................#........###..##......#.#.....#....#....#....#.......#..
...#......#.#..........#..#..........#..#.....#..........#........#.......................#....#.......#...##.............#.#......
..#..##...#...........#.#.#.##........##..#...................#....##..##..##...............#....#...........#......##..#.......#..
....................#.#...#.........##....................#.....#.....#..#....................................#.#.#........#.#.....
............##.#..#.#..#............#..#..#...........#.........#...#...............................#...............#...#........#.
.......##......#..............###......#............#.....#..........#..#.#.....#............#.#.......#..#...............#.....#..
.......###.......#......#..#..#...#...#...........#......#.........#...........#...................#.....##..........#....#........
..#...#.#..................##........................#..............##.....#.#.......................#...#..#...#..................
.........#.......#...#...#.....#......#..............##.......##....#.............##..............##.....#....................#....
..#....#.....#.....#............................#.#.......#.............#.....................#.........#.......#....##.#..........
...#.#...#........#....#........#.#...............#..##......#........#.........#...................#...#.......#...#......#...#...
.......................#..#..#.....#............#.#...#..#...........#.......##....#.#................#...................#....#...
.........#....#.#..........#.#....#..................#..............#...#...#..........#..........#.............##..#.......#..#...
...#......#.#......#.....#.##.#...#.....................#....##............#......#...#.........##...............#...............#.
........#.......#...................................#....#...............#....#.##..#............#...#........................#....
.......................#.......#..............#........#.#............#............................#...#......#..#..#.##.#.........
......#...#.##.............................##.#...................#..#......#.#...#...##..#.........##......#..#....#........#..#..
.........#.#............#................#...#.##......#..#.....#.##....##.#...........#....................#.............#........
.....#...#.........#...#.#...#.........#...#....#......#......##...#..#........#.....#.....#.............##.........#..........#...
.....#.......#............#.#............###..#..#.#.....#.##.......#.#.............##..##.....................#.#.......#..##.....
.#...#.....#...#.......................#...#.##...#....#........#.....#...#..................#............##..#...#....#.##.#...#..
......##.............#...#.........#.....#.....#..#........#......#..#......#..##...#..##.....#.#.................#..#.........#...
.........#..........#.#............###.................#..#.....#.....#..#...#..........#........#..........#.................#....
..#..........#....................#.....#..#...#....#.....#..#............#....#..#.........##..##..........#....#......#..........
.........#..........#..#.......#............#...........#.......#..#...........#.......##.....................#.......#............
...#...........................#..#.........#.#.....#.........#..........#........##.......#...#...............#....##.#.#....#....
....##.....#...#.......................#..#...#......#....#.#.....#..##.......#.........##.....................................#...
.#......#....##...#............#.....#..#........#......#...##.......#...#...#.#...#.#.....##..........................#..#........
.#.......##...................#..#......#..#..................##....#..#....#..##.......#..#.....###................#.#............
..............#.............#..#....#.....#.......#..#....##.........#..#.#.....###.......#.....##...##..........#..........#......
..#.#..#.................#......#...#.#...#......#...#.............#...#..##...............#........#............##.#.....#........
........#.....#.................#.....##.....#.#...#..#...........#..............#...#........#........##..............#...........
.#......#........................#..##.#........##......##....#...#........#..#...#..##.........#....#...............#.............
....#.....##..#............##.........#...#......#.#.....#.........#.#.#....###......................#...#.........................
.........###............##..........#.#.#.....#.....#..###.....................##.....#.....#....#.#...............................
...#.#.#............#..#.........###.....####.......#.....#...................#..##..##.......#....................................
.#.#.....#.#...............................#..#.......##........................#...#....#...##.#...#....................##........
...#.....................#...#...............#...#..#...#....#......##....#.#..#.#......#...#........#.....##.................##...
.........#.........#..#...#.#.#...#...#..........#......####.#.......#................#.........###...#..#.........................
....##..........#.........#..................#....#....#........#...#.........#..##...#....##.....#.#..........#..#..........#.....
...#............#...#..#.#.#.....#..##.#..#.......................#..#.....#....#...#.....#.....#..........#...#...#...............
.#..................................#..#..#..............#...#.....#...#................#.....#...#...........##..#................
....##................#....#.......#..#....#....#............##..........##...#.......#.......#...........#....#...................
....#..........#..........#..##......#.......###...........#............#..........#...#.#.#........#.#.#.#.#.#......#..........#..
............#...........................................#.......#.##.#.....................#..#..#..#.............#..............#.
...........#...#.........#.#....#................#.....#........#..#...#.#.....#..........#....................#...#..#............
...........#.#...#....#.....#..#..........#...#.#..#..#.#.........#.#.##........#......#................#...........#..............
................................................#..#..#....#.........#.............#....###..#...............#...#.......#.........
............................#...#..#......##......#...#........#....#.....#.....#...#..#...#..........................###.#........
..............#............#...#.#...##.......##.....#.##..........#....#............#.......#......##.#....#.......#..............
...........#.##.##..#.#.#.........###........#...#...#................#.#...............#..#.#........##........#.##.......#.......
.................................................................S.................................................................
.............#.#......#..##..#.............#...........#..........#..##.#...............#..###..............#...#.##.##....#.......
......#......##..#...............#..#............##.......#.#.......##..#...#.....##........#.................#....#......#........
..........#..........#.#........#....#......#........#.....#.............#....#..............#.#..#...#.............#..............
...........#........##.#.......#...#....#........#.#.....#........#..#..........#......##.....#...............#....#....#..........
...........#............#.....#..#.............#..#....#.#.....##............#.......#.......#............#.#..##..................
...........##..#...#.....##.........##.......#.......#.............#...#......#...##........#..#....#.......##..........#..........
.............#.......#......#..#...##..#.................................####...#......#.............#..#..#.......#...............
................#............#........#...##......##...................#..#...#.........#..#.........................#.............
.........................#...##.#......#...........#........#........#...............###....#.#........#............#..............
...#...........##........#..##.....#.....#.##......#....#..#........#.................#.#.........#........##..#..#................
..#.............#.##....#......#...#.#.......#.......#.................#.....#.....#.............###......#...#............##......
........................#.....#..##.........#.....#.....#..#........#...#.....#.....#....#......#...##..#...#.............#..#.....
......#........................#.....#..#...#....#......#....#..#.#.#...#.....#..#......#..#..#...#...#..#..#...............#......
..........#...........#......##.#.#............#...................##.....#..#...##....#..........#........#.............#.........
.#.......................#.....#..........#..##....#....#...............##......#.#..#.###..............................#..#..#....
.......................#........##......#.#......#......####..........#..#........#.#...........#..#.#..#.....#....................
....##.....................#..#.......###.................##.......#...#..#.###..#...#..###........#....#.#.............##....#....
........#..#............#...#.........#........#....#.##.......#...#.......#..#.#.......................................###........
.......##.....#..............#..#....#..#...............#......#................#................##......#.............#.#.........
....#......##...........###.....##................#...#....##.#......#....................#...##.#.......#............###...#......
.#...#.........#..........#..#.##.#.#...........#.#.........##....#.#......#........#.....#..#..........##.............#...#....##.
.........#.#.#....#..........#.....#...#..#.#...............#..........#....................##........................#.##....#..#.
........###..#..................#...#.....#.................#.#....#........#................#...#...........................#...#.
.....#.#..#........#.............#.........#.............#..###......#..#.#....#................##.....................##..........
.#......###....#....#........#.#..#...#.#..#.#...#........................#.........#...#.........#..........#.......#.........#...
..#.....#...........###........#.............#......#......#..........##.......#.#.#....#...#.................#...........#........
.....#........#..#..#................#......#....#.........#.##.......#...........#...........#.#............#.#....#......##......
.....#...##.#.....................#......................................#.#..#.#.....#.......#.#............####.#................
.......#...#......................####..#..#.............#..#.................#.....#...........#............#..#..........#.......
.##.............#...#.#...........................#..........##............#.......#.#......#............#........#................
.......#.......#.......#................#......#.#.#...#.............#........#........#.....#.#..............#....................
.#....#......#.#....#.................#.................##..............................#...............#.....###....#......#....#.
........##...............................#........#.............................#.....#..####.............#...#..#.........##.##...
.#.#............#..#..........#.......#......##.#.#..........#.........##.....#...........#..................#......##.......#.....
.................##.....#.#..............#.#.#.###...#.............#.#....#.....##...#.##..#...........#.#.#....#..................
..#.#..#..#................................#.#.......##.............#.#..........###................#.....##....#..................
........#........#.##..#.....##.#........#.#...#..#..#.....#...#....#.#.......#...#.....#..............#.........#.#...#...........
........#.....##..#..#......................#................#...............#...#.#.#..........#.#.##......................#......
........#......#.....#.#.......#............#...........##...............#............#...........#..........#.#..........#.#......
......###.....#.................###................#......#........#...#.#.#...#....#.#.........#...#...##........#...#............
..#.##..#..#....#.....##..........#............#................#.#..#.........................#.##..##..........##....#...#.....#.
....#............#.#..#...#......#..............#..#....##...#..#.....#.........#...#...........#..........#.#......#.#...##.###...
....#................#.........#...............##..#...........#.......#.#..#.......................#....#...##........#...........
....#....................##......#...#...........#.......#.#..#..............##.#....................#....#...................#....
...#..............##......#..............#...........#.......#......#........##.............#.........#...#.#..##..................
....#........#.#....#....#.#.....#........#..........................#..#.#.#.#.........#..........#.##...#.##..###.....#..........
.#.......#.#............#..#....#.......#.#............#..........#.#........##.............#...#..#....#..........#..........#....
...#...#......#..............#...##.......#..........#.....#......##...#..............#................#..............#...##..##...
....#......#.##..##....#.....................#..........#....##......#................#.......#.#..................#......#.#......
...#...............#..#..........#..#.....#..##............#.......###...........................##................#...#...........
........#....#........#.......#....#..#.#..................#.............##.............#..#.......##..........................#...
.#....................#......#.#........#..................#.##.#..#.....#.........##................................#.............
.......#....................#..#................#......................................##..........#.....#..##..#..........#.#..#..
..#.....#..#....#.....#......#..##...#.........#.........................................#...#....#.........#...##.......#.#.....#.
...........#..........#..#.#...#...##..#.........#.#...........#....#..............#.............#.......##..#...#....##.......#...
..#.........#.#..#...#.....#......................#..........#........#.......#....................#...##......#.................#.
.#......#...#.#.#......#.#........#.#......#....#....#............................#......####............#.......#..#..........##..
.#......##..........#...#...........#....#...#.#.................................#.##...#......................#..#..........#.#...
.....#...#.......#...................##.#....#...##............#..##.........#..................#..#......#..........#....#.....##.
.#..................#..........#.....................#.#.........................#...........#...##...#...#...##.#.................
.#..#..#..#..#......#........#........#.......#.#...#.#..................#.......#.......#..#.#......#...#...............#.....#...
.#........#......................#...##.......#..##......................###......#.....##....#..#................#................
.#...........#.............#..#.....##.........#.##........#.............#....#.#...........#...............#.........#........#...
......#....#.#...###................#....#......#..#........#.........................##.##...#..#..#.#......#.....................
...................................................................................................................................
49 changes: 29 additions & 20 deletions 2023/day21/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,41 @@ mod tests {
.##.#.####.
.##..##.##.
...........";
const REALINPUT: &str = include_str!("../input.txt");
#[test]
fn part1_6() {
assert_eq!(super::part1(INPUT, 6), 16);
}
#[test]
fn part2_10() {
assert_eq!(super::part2(INPUT, 10), 50);
fn part1_real() {
assert_eq!(super::part1(REALINPUT, 64), 3594);
}
#[test]
fn part2_50() {
assert_eq!(super::part2(INPUT, 50), 1594);
}
#[test]
fn part2_100() {
assert_eq!(super::part2(INPUT, 100), 6536);
}
#[test]
fn part2_500() {
assert_eq!(super::part2(INPUT, 500), 167004);
}
#[test]
fn part2_1000() {
assert_eq!(super::part2(INPUT, 1000), 668697);
}
#[test]
fn part2_5000() {
assert_eq!(super::part2(INPUT, 5000), 16733044);
fn part2_real() {
assert_eq!(super::part2(REALINPUT, 26501365), 605247138198755);
}
// #[test]
// fn part2_10() {
// assert_eq!(super::part2(INPUT, 10), 50);
// }
// #[test]
// fn part2_50() {
// assert_eq!(super::part2(INPUT, 50), 1594);
// }
// #[test]
// fn part2_100() {
// assert_eq!(super::part2(INPUT, 100), 6536);
// }
// #[test]
// fn part2_500() {
// assert_eq!(super::part2(INPUT, 500), 167004);
// }
// #[test]
// fn part2_1000() {
// assert_eq!(super::part2(INPUT, 1000), 668697);
// }
// #[test]
// fn part2_5000() {
// assert_eq!(super::part2(INPUT, 5000), 16733044);
// }
}

0 comments on commit a8b2896

Please sign in to comment.