Skip to content

Commit

Permalink
Add aoc2024
Browse files Browse the repository at this point in the history
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
  • Loading branch information
AndrejOrsula committed Nov 30, 2024
1 parent d29defd commit 3eba724
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 122 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

env:
MSRV: "1.75"
MSRV: "1.82"
CARGO_TERM_COLOR: always

jobs:
Expand Down Expand Up @@ -61,37 +61,37 @@ jobs:

## cargo check
- name: cargo check
run: cargo check --workspace --all-targets --verbose
run: cargo check --all-targets --verbose
- name: cargo check --no-default-features
run: cargo check --workspace --all-targets --no-default-features --verbose
run: cargo check --all-targets --no-default-features --verbose
- name: cargo check --all-features
run: cargo check --workspace --all-targets --all-features --verbose
run: cargo check --all-targets --all-features --verbose

## cargo test
- name: cargo test
run: cargo test --workspace --all-targets --verbose
run: cargo test --all-targets --verbose
- name: cargo test --no-default-features
run: cargo test --workspace --all-targets --no-default-features --verbose
run: cargo test --all-targets --no-default-features --verbose
- name: cargo test --all-features
run: cargo test --workspace --all-targets --all-features --verbose
run: cargo test --all-targets --all-features --verbose

## cargo test --doc
- name: cargo test --doc
run: cargo test --workspace --doc --verbose
run: cargo test --doc --verbose
- name: cargo test --doc --no-default-features
run: cargo test --workspace --doc --no-default-features --verbose
run: cargo test --doc --no-default-features --verbose
- name: cargo test --doc --all-features
run: cargo test --workspace --doc --all-features --verbose
run: cargo test --doc --all-features --verbose

## [stable] cargo clippy
- name: stable | cargo clippy
if: ${{ matrix.toolchain == 'stable' }}
run: cargo clippy --workspace --all-targets --all-features --no-deps --verbose -- --deny warnings
run: cargo clippy --all-targets --all-features --no-deps --verbose -- --deny warnings

## [stable] cargo doc
- name: stable | cargo doc --document-private-items
if: ${{ matrix.toolchain == 'stable' }}
run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose
run: cargo doc --all-features --no-deps --document-private-items --verbose

## [stable] Code coverage
- name: stable | Install cargo llvm-cov for code coverage
Expand All @@ -100,7 +100,7 @@ jobs:
## [stable] Generate coverage with cargo llvm-cov
- name: stable | Generate coverage
if: ${{ matrix.toolchain == 'stable' }}
run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
## [stable] Upload coverage to codecov.io
- name: stable | Upload coverage
if: ${{ matrix.toolchain == 'stable' }}
Expand Down
17 changes: 5 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,12 @@ repos:
hooks:
- id: cargo-fmt
- id: cargo-clippy
args:
[
"--workspace",
"--all-targets",
"--all-features",
"--",
"--deny=warnings",
]
args: ["--all-targets", "--all-features", "--", "--deny=warnings"]
- id: cargo-check
args: ["--workspace", "--all-targets", "--all-features"]
args: ["--all-targets", "--all-features"]
- id: cargo-test
args: ["--workspace", "--all-targets"]
args: ["--all-targets"]
- id: cargo-test-doc
args: ["--workspace", "--all-features"]
args: ["--all-features"]
- id: cargo-doc
args: ["--workspace", "--no-deps", "--document-private-items"]
args: ["--no-deps", "--document-private-items"]
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = ["aoc2023"]
members = ["aoc2023", "aoc2024"]
default-members = ["aoc2024"]
resolver = "2"

[workspace.package]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=latest
ARG RUST_VERSION=1.82
FROM rust:${RUST_VERSION}

### Use bash as the default shell
Expand Down
159 changes: 64 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,104 +11,73 @@ My solutions to [Advent of Code](https://adventofcode.com) puzzles.

## Edition

<details><summary><h3><a href="https://adventofcode.com/2023">Advent of Code 2023</a></h3></summary>
<details open><summary><h3><a href="https://adventofcode.com/2024">Advent of Code 2024</a></h3></summary>

> All benchmarks are run on a *Dell Precision 5550* laptop with an *Intel Core i7-10875H* CPU.
<table>
<tr><th>Day</th><th>Part 1 Performance</th><th>Part 2 Performance</th></tr>
<tr><td>

| D | Puzzle | Code |
| :---: | --------------------------------------------------------------- | :------------------------------: |
| 1 | [Trebuchet?!](https://adventofcode.com/2023/day/1) | [day1.rs](aoc2023/src/day1.rs) |
| 2 | [Cube Conundrum](https://adventofcode.com/2023/day/2) | [day2.rs](aoc2023/src/day2.rs) |
| 3 | [Gear Ratios](https://adventofcode.com/2023/day/3) | [day3.rs](aoc2023/src/day3.rs) |
| 4 | [Scratchcards](https://adventofcode.com/2023/day/4) | [day4.rs](aoc2023/src/day4.rs) |
| 5 | [If You Give A Seed ...](https://adventofcode.com/2023/day/5) | [day5.rs](aoc2023/src/day5.rs) |
| 6 | [Wait For It](https://adventofcode.com/2023/day/6) | [day6.rs](aoc2023/src/day6.rs) |
| 7 | [Camel Cards](https://adventofcode.com/2023/day/7) | [day7.rs](aoc2023/src/day7.rs) |
| 8 | [Haunted Wasteland](https://adventofcode.com/2023/day/8) | [day8.rs](aoc2023/src/day8.rs) |
| 9 | [Mirage Maintenance](https://adventofcode.com/2023/day/9) | [day9.rs](aoc2023/src/day9.rs) |
| 10 | [Pipe Maze](https://adventofcode.com/2023/day/10) | [day10.rs](aoc2023/src/day10.rs) |
| 11 | [Cosmic Expansion](https://adventofcode.com/2023/day/11) | [day11.rs](aoc2023/src/day11.rs) |
| 12 | [Hot Springs](https://adventofcode.com/2023/day/12) | [day12.rs](aoc2023/src/day12.rs) |
| 13 | [Point of Incidence](https://adventofcode.com/2023/day/13) | [day13.rs](aoc2023/src/day13.rs) |
| 14 | [Parabolic Reflector ...](https://adventofcode.com/2023/day/14) | [day14.rs](aoc2023/src/day14.rs) |
| 15 | [Lens Library](https://adventofcode.com/2023/day/15) | [day15.rs](aoc2023/src/day15.rs) |
| 16 | [The Floor Will Be ...](https://adventofcode.com/2023/day/16) | [day16.rs](aoc2023/src/day16.rs) |
| 17 | [Clumsy Crucible](https://adventofcode.com/2023/day/17) | [day17.rs](aoc2023/src/day17.rs) |
| 18 | [Lavaduct Lagoon](https://adventofcode.com/2023/day/18) | [day18.rs](aoc2023/src/day18.rs) |
| 19 | [Aplenty](https://adventofcode.com/2023/day/19) | [day19.rs](aoc2023/src/day19.rs) |
| 20 | [Pulse Propagation](https://adventofcode.com/2023/day/20) | [day20.rs](aoc2023/src/day20.rs) |
| 21 | [Step Counter](https://adventofcode.com/2023/day/21) | [day21.rs](aoc2023/src/day21.rs) |
| 22 | [Sand Slabs](https://adventofcode.com/2023/day/22) | [day22.rs](aoc2023/src/day22.rs) |
| 23 | [A Long Walk](https://adventofcode.com/2023/day/23) | [day23.rs](aoc2023/src/day23.rs) |
| 24 | [Never Tell Me The ...](https://adventofcode.com/2023/day/24) | [day24.rs](aoc2023/src/day24.rs) |
| 25 | [Snowverload](https://adventofcode.com/2023/day/25) | [day25.rs](aoc2023/src/day25.rs) |

</td><td>

| Generator | Runner |
| :-------: | :------: |
| 4.408 µs | 80.30 µs |
| 112.7 µs | 1.056 µs |
| 5.884 µs | 508.0 µs |
| 92.21 µs | 27.78 µs |
| 21.77 µs | 5.197 µs |
| 16.90 µs | 0.248 µs |
| 170.1 µs | 76.89 µs |
| 181.6 µs | 323.7 µs |
| 165.9 µs | 38.10 µs |
| 159.7 µs | 183.6 µs |
| 7.197 ms | 1.085 ms |
| 276.1 µs | 477.4 µs |
| 58.49 µs | 359.9 µs |
| 87.00 µs | 61.28 µs |
| 195.8 µs | 24.98 µs |
| 33.91 µs | 622.1 µs |
| 50.64 µs | 78.82 ms |
| 30.70 µs | 1.981 µs |
| 228.0 µs | 31.74 µs |
| 33.73 µs | 4.654 ms |
| 498.8 µs | 6.057 ms |
| 254.8 µs | 41.48 ms |
| 101.8 µs | 2.554 ms |
| 100.3 µs | 1.486 ms |
| 320.8 µs | 245.7 ms |

</td><td>

| Generator | Runner |
| :-------: | :------: |
| 0.558 µs | 930.2 µs |
| 126.6 µs | 1.347 µs |
| 0.462 µs | 437.1 µs |
| 113.4 µs | 27.97 µs |
| 17.87 µs | 108.7 µs |
| 0.666 µs | 0.659 µs |
| 177.0 µs | 66.30 µs |
| 153.8 µs | 1.069 ms |
| 119.2 µs | 45.94 µs |
| 163.3 µs | 222.8 µs |
| 7.172 ms | 1.080 ms |
| 247.1 µs | 8.984 ms |
| 10.10 µs | 192.8 µs |
| 72.12 µs | 38.33 ms |
| 161.4 µs | 128.9 µs |
| 32.84 µs | 20.16 ms |
| 29.74 µs | 289.0 ms |
| 43.98 µs | 1.778 µs |
| 213.9 µs | 69.56 µs |
| 32.87 µs | 21.57 ms |
| 491.3 µs | 86.90 ms |
| 252.4 µs | 61.18 ms |
| 101.2 µs | 2.5839 s |
| 79.73 µs | 2.4001 s |
|||

</td></tr>
</table>
| D | Puzzle | Code | Part 1 Performance | Part 2 Performance |
| :---: | ------ | :---: | :----------------: | :----------------: |

<!-- | 1 | [TODO](https://adventofcode.com/2024/day/1) | [day1.rs](aoc2024/src/day1.rs) | | | -->
<!-- | 2 | [TODO](https://adventofcode.com/2024/day/2) | [day2.rs](aoc2024/src/day2.rs) | | | -->
<!-- | 3 | [TODO](https://adventofcode.com/2024/day/3) | [day3.rs](aoc2024/src/day3.rs) | | | -->
<!-- | 4 | [TODO](https://adventofcode.com/2024/day/4) | [day4.rs](aoc2024/src/day4.rs) | | | -->
<!-- | 5 | [TODO](https://adventofcode.com/2024/day/5) | [day5.rs](aoc2024/src/day5.rs) | | | -->
<!-- | 6 | [TODO](https://adventofcode.com/2024/day/6) | [day6.rs](aoc2024/src/day6.rs) | | | -->
<!-- | 7 | [TODO](https://adventofcode.com/2024/day/7) | [day7.rs](aoc2024/src/day7.rs) | | | -->
<!-- | 8 | [TODO](https://adventofcode.com/2024/day/8) | [day8.rs](aoc2024/src/day8.rs) | | | -->
<!-- | 9 | [TODO](https://adventofcode.com/2024/day/9) | [day9.rs](aoc2024/src/day9.rs) | | | -->
<!-- | 10 | [TODO](https://adventofcode.com/2024/day/10) | [day10.rs](aoc2024/src/day10.rs) | | | -->
<!-- | 11 | [TODO](https://adventofcode.com/2024/day/11) | [day11.rs](aoc2024/src/day11.rs) | | | -->
<!-- | 12 | [TODO](https://adventofcode.com/2024/day/12) | [day12.rs](aoc2024/src/day12.rs) | | | -->
<!-- | 13 | [TODO](https://adventofcode.com/2024/day/13) | [day13.rs](aoc2024/src/day13.rs) | | | -->
<!-- | 14 | [TODO](https://adventofcode.com/2024/day/14) | [day14.rs](aoc2024/src/day14.rs) | | | -->
<!-- | 15 | [TODO](https://adventofcode.com/2024/day/15) | [day15.rs](aoc2024/src/day15.rs) | | | -->
<!-- | 16 | [TODO](https://adventofcode.com/2024/day/16) | [day16.rs](aoc2024/src/day16.rs) | | | -->
<!-- | 17 | [TODO](https://adventofcode.com/2024/day/17) | [day17.rs](aoc2024/src/day17.rs) | | | -->
<!-- | 18 | [TODO](https://adventofcode.com/2024/day/18) | [day18.rs](aoc2024/src/day18.rs) | | | -->
<!-- | 19 | [TODO](https://adventofcode.com/2024/day/19) | [day19.rs](aoc2024/src/day19.rs) | | | -->
<!-- | 20 | [TODO](https://adventofcode.com/2024/day/20) | [day20.rs](aoc2024/src/day20.rs) | | | -->
<!-- | 21 | [TODO](https://adventofcode.com/2024/day/21) | [day21.rs](aoc2024/src/day21.rs) | | | -->
<!-- | 22 | [TODO](https://adventofcode.com/2024/day/22) | [day22.rs](aoc2024/src/day22.rs) | | | -->
<!-- | 23 | [TODO](https://adventofcode.com/2024/day/23) | [day23.rs](aoc2024/src/day23.rs) | | | -->
<!-- | 24 | [TODO](https://adventofcode.com/2024/day/24) | [day24.rs](aoc2024/src/day24.rs) | | | -->
<!-- | 25 | [TODO](https://adventofcode.com/2024/day/25) | [day25.rs](aoc2024/src/day25.rs) | | — | -->

</details>

<details open><summary><h3><a href="https://adventofcode.com/2023">Advent of Code 2023</a></h3></summary>

> All benchmarks are run on a *Dell Precision 5550* laptop with an *Intel Core i7-10875H* CPU.
| D | Puzzle | Code | Part 1 Performance | Part 2 Performance |
| :---: | --------------------------------------------------------------- | :------------------------------: | :----------------: | :----------------: |
| 1 | [Trebuchet?!](https://adventofcode.com/2023/day/1) | [day1.rs](aoc2023/src/day1.rs) | 84.70 μs | 930.8 µs |
| 2 | [Cube Conundrum](https://adventofcode.com/2023/day/2) | [day2.rs](aoc2023/src/day2.rs) | 113.7 μs | 127.9 µs |
| 3 | [Gear Ratios](https://adventofcode.com/2023/day/3) | [day3.rs](aoc2023/src/day3.rs) | 513.8 μs | 437.6 µs |
| 4 | [Scratchcards](https://adventofcode.com/2023/day/4) | [day4.rs](aoc2023/src/day4.rs) | 119.9 μs | 141.4 µs |
| 5 | [If You Give A Seed ...](https://adventofcode.com/2023/day/5) | [day5.rs](aoc2023/src/day5.rs) | 26.96 μs | 126.6 µs |
| 6 | [Wait For It](https://adventofcode.com/2023/day/6) | [day6.rs](aoc2023/src/day6.rs) | 17.14 μs | 1.325 µs |
| 7 | [Camel Cards](https://adventofcode.com/2023/day/7) | [day7.rs](aoc2023/src/day7.rs) | 246.9 μs | 243.3 µs |
| 8 | [Haunted Wasteland](https://adventofcode.com/2023/day/8) | [day8.rs](aoc2023/src/day8.rs) | 505.3 µs | 1.223 ms |
| 9 | [Mirage Maintenance](https://adventofcode.com/2023/day/9) | [day9.rs](aoc2023/src/day9.rs) | 204.0 µs | 165.1 µs |
| 10 | [Pipe Maze](https://adventofcode.com/2023/day/10) | [day10.rs](aoc2023/src/day10.rs) | 343.3 µs | 386.1 µs |
| 11 | [Cosmic Expansion](https://adventofcode.com/2023/day/11) | [day11.rs](aoc2023/src/day11.rs) | 8.282 ms | 8.252 ms |
| 12 | [Hot Springs](https://adventofcode.com/2023/day/12) | [day12.rs](aoc2023/src/day12.rs) | 753.5 µs | 9.231 ms |
| 13 | [Point of Incidence](https://adventofcode.com/2023/day/13) | [day13.rs](aoc2023/src/day13.rs) | 418.4 µs | 202.9 µs |
| 14 | [Parabolic Reflector ...](https://adventofcode.com/2023/day/14) | [day14.rs](aoc2023/src/day14.rs) | 148.3 µs | 38.40 ms |
| 15 | [Lens Library](https://adventofcode.com/2023/day/15) | [day15.rs](aoc2023/src/day15.rs) | 220.8 µs | 290.3 µs |
| 16 | [The Floor Will Be ...](https://adventofcode.com/2023/day/16) | [day16.rs](aoc2023/src/day16.rs) | 656.0 µs | 20.19 ms |
| 17 | [Clumsy Crucible](https://adventofcode.com/2023/day/17) | [day17.rs](aoc2023/src/day17.rs) | 78.87 ms | 289.0 ms |
| 18 | [Lavaduct Lagoon](https://adventofcode.com/2023/day/18) | [day18.rs](aoc2023/src/day18.rs) | 32.68 µs | 45.76 µs |
| 19 | [Aplenty](https://adventofcode.com/2023/day/19) | [day19.rs](aoc2023/src/day19.rs) | 259.7 µs | 283.5 µs |
| 20 | [Pulse Propagation](https://adventofcode.com/2023/day/20) | [day20.rs](aoc2023/src/day20.rs) | 4.687 ms | 21.60 ms |
| 21 | [Step Counter](https://adventofcode.com/2023/day/21) | [day21.rs](aoc2023/src/day21.rs) | 6.556 ms | 87.39 ms |
| 22 | [Sand Slabs](https://adventofcode.com/2023/day/22) | [day22.rs](aoc2023/src/day22.rs) | 41.73 ms | 61.43 ms |
| 23 | [A Long Walk](https://adventofcode.com/2023/day/23) | [day23.rs](aoc2023/src/day23.rs) | 2.656 ms | 2.5840 s |
| 24 | [Never Tell Me The ...](https://adventofcode.com/2023/day/24) | [day24.rs](aoc2023/src/day24.rs) | 1.586 ms | 2.4002 s |
| 25 | [Snowverload](https://adventofcode.com/2023/day/25) | [day25.rs](aoc2023/src/day25.rs) | 246.0 ms ||

</details>

## Instructions
Expand Down
35 changes: 35 additions & 0 deletions aoc2024/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "aoc2024"
description = "Advent of Code 2024"
edition = "2021"
rust-version = "1.82"
version = "0.1.0"
authors.workspace = true
keywords.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
publish = false

[dependencies]
aoc-runner = { workspace = true }
aoc-runner-derive = { workspace = true }
indoc = { workspace = true }

derive_more = { version = "1", features = ["full"] }
itertools = { version = "0.13" }
num = { version = "0.4" }
num-integer = { version = "0.1" }
pathfinding = { version = "4.4" }
petgraph = { version = "0.6" }
rayon = { version = "1.8" }
rustc-hash = { version = "2.0" }
rustworkx-core = { version = "0.15" }
smallvec = { version = "1.11" }
strum = { version = "0.26", features = ["derive"] }

[features]
default = []

[lib]
bench = false
29 changes: 29 additions & 0 deletions aoc2024/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// pub mod day1;
// pub mod day2;
// pub mod day3;
// pub mod day4;
// pub mod day5;
// pub mod day6;
// pub mod day7;
// pub mod day8;
// pub mod day9;

// pub mod day10;
// pub mod day11;
// pub mod day12;
// pub mod day13;
// pub mod day14;
// pub mod day15;
// pub mod day16;
// pub mod day17;
// pub mod day18;
// pub mod day19;

// pub mod day20;
// pub mod day21;
// pub mod day22;
// pub mod day23;
// pub mod day24;
// pub mod day25;

aoc_runner_derive::aoc_lib! { year = 2024 }
1 change: 1 addition & 0 deletions aoc2024/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aoc_runner_derive::aoc_main! { lib = aoc2024 }

0 comments on commit 3eba724

Please sign in to comment.