Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day10 #11

Merged
merged 6 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ My solutions to AOC2023.
* All days combined running in under 1s

## ☠️ Fails
* **Day 5** - Completed without any external help. I however had to resort to getting a hint on what algorithm to use in order to optimize, as my initial solution ran for +10 minutes. A small win on implementing an algorithm i didn't know before.
* **Day 5 (Part 2)** - Completed without any external help. I however had to resort to getting a hint on what algorithm to use in order to optimize, as my initial solution ran for +10 minutes. A small win on implementing an algorithm i didn't know before (Ford–Fulkerson).

* **Day 8** - Completed but never finished *completely* on my own as my initial solution ran for hours without ever ending (Which i knew would happen). I had to get a hint on how to solve this, which lead to implementing LCM.
* **Day 8 (Part 2)** - Completed but never finished *completely* on my own as my initial solution ran for hours without ever ending (Which i knew would happen..). I had to get a hint on how to optimize this, which lead to implementing LCM.

* **Day 10 (Part 2)** - After 12 hours of hacking away, i couldn't get a solution running that worked. Got a hint about implementing Picks Theorem with the Shoelace algorithm, which i tried (And apparently succeeded), but resorted to posting on reddit as it didn't work. It was however, another bug/mistake that caused it not to work - Not the algorithm itself nessecarily.
3 changes: 2 additions & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ almanac = { path = "../lib/almanac" }
boat_race = { path = "../lib/boat_race" }
camel_cards = { path = "../lib/camel_cards" }
network_nodes = { path = "../lib/network_nodes" }
oasis = { path = "../lib/oasis" }
oasis = { path = "../lib/oasis" }
pipe_maze = { path = "../lib/pipe_maze" }
11 changes: 11 additions & 0 deletions bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use cube_game::{cube::Color, Cubes, Game};
use gondola_lift::EngineSchematic;
use network_nodes::{Network, Node};
use oasis::Report;
use pipe_maze::Maze;
use scratchcard::ScratchCards;
use trebuchet::Trebuchet;

Expand Down Expand Up @@ -117,6 +118,15 @@ fn day9(input: String) {
println!("Sum of prev values for histories: {prev_sum}")
}

fn day10(input: String) {
let maze = Maze::from_str(&input).expect("Failed parsing maze");
let farthest_point = maze.find_farthest_point_from_start();
println!("Farthest point from start: {farthest_point}");

let area = maze.find_nest_area();
println!("Area of nest: {area}");
}

fn main() {
println!("## Advent of Code 2023 solutions ##");
time!("All", {
Expand All @@ -129,5 +139,6 @@ fn main() {
day!(7, day7);
day!(8, day8);
day!(9, day9);
day!(10, day10);
})
}
140 changes: 140 additions & 0 deletions inputs/day10.txt

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions lib/pipe_maze/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "pipe_maze"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Loading
Loading