diff --git a/.aoc_tiles/tiles/2022/01.png b/.aoc_tiles/tiles/2022/01.png new file mode 100644 index 0000000..7266f86 Binary files /dev/null and b/.aoc_tiles/tiles/2022/01.png differ diff --git a/.aoc_tiles/tiles/2022/02.png b/.aoc_tiles/tiles/2022/02.png new file mode 100644 index 0000000..2dd639b Binary files /dev/null and b/.aoc_tiles/tiles/2022/02.png differ diff --git a/.aoc_tiles/tiles/2022/03.png b/.aoc_tiles/tiles/2022/03.png new file mode 100644 index 0000000..83eecee Binary files /dev/null and b/.aoc_tiles/tiles/2022/03.png differ diff --git a/.aoc_tiles/tiles/2022/04.png b/.aoc_tiles/tiles/2022/04.png new file mode 100644 index 0000000..af65e1c Binary files /dev/null and b/.aoc_tiles/tiles/2022/04.png differ diff --git a/.aoc_tiles/tiles/2022/05.png b/.aoc_tiles/tiles/2022/05.png new file mode 100644 index 0000000..33f19f3 Binary files /dev/null and b/.aoc_tiles/tiles/2022/05.png differ diff --git a/.aoc_tiles/tiles/2022/06.png b/.aoc_tiles/tiles/2022/06.png new file mode 100644 index 0000000..2613b93 Binary files /dev/null and b/.aoc_tiles/tiles/2022/06.png differ diff --git a/.aoc_tiles/tiles/2022/07.png b/.aoc_tiles/tiles/2022/07.png new file mode 100644 index 0000000..747f727 Binary files /dev/null and b/.aoc_tiles/tiles/2022/07.png differ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..677bd11 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +repos: + - repo: local + hooks: + - id: rust-linting + name: Rust linting + entry: cargo fmt --all -- + pass_filenames: true + types: [file, rust] + language: system + - id: rust-clippy + name: Rust clippy + entry: cargo clippy --lib --all-features --tests -- + pass_filenames: false + types: [file, rust] + language: system + - repo: https://github.com/LiquidFun/aoc_tiles + rev: 0.7.2 + hooks: + - id: aoc-tiles + language: system + # Optionally use these arguments. Auto add tiles to git adds the tiles to git, + # possibly amends your commit by creating the tile images and updating the README. + # Language sorting shows the preference of the order of the languages to use. + # Exclude paterns are globs which can be used to exclude files when creating + # the tiles. See the customization section in the README for more flags. + # Simply remove the comments (#) below for args and the flags you want. + args: + - --auto-add-tiles-to-git=amend + - --overwrite-year=2022 + - --tile-width-px=200 + # - --language-sorting=jl,kt,py,rs + # - --exclude-patterns=2021/*/*.apl,2021/*/*.py,2021/*/*.cpp diff --git a/README.md b/README.md new file mode 100644 index 0000000..648b411 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/day7.rs b/src/day7.rs
new file mode 100644
index 0000000..9784d36
--- /dev/null
+++ b/src/day7.rs
@@ -0,0 +1,142 @@
+use std::{
+ collections::{HashMap, HashSet},
+ fs::File,
+};
+
+use aoc_runner_derive::{aoc, aoc_generator};
+use itertools::Itertools;
+
+#[derive(Debug)]
+enum DirEntry {
+ Directory,
+ File(u64),
+}
+
+type Filesystem = HashMap