Moved aoc challenges from their own repos to this one

This commit is contained in:
2024-10-25 11:07:47 +02:00
commit ae00eb4f80
51 changed files with 11067 additions and 0 deletions

20
y2022/src/bin/d1.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d1;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap();
println!("{}", d1::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap();
println!("{}", d1::process_part2(&content));
}

20
y2022/src/bin/d2.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d2::{process_part1, process_part2};
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/2_input.txt")).unwrap();
println!("{}", process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/2_input.txt")).unwrap();
println!("{}", process_part2(&content));
}

20
y2022/src/bin/d3.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d3;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/3_input.txt")).unwrap();
println!("{}", d3::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/3_input.txt")).unwrap();
println!("{}", d3::process_part2(&content));
}

20
y2022/src/bin/d4.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d4;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/4_input.txt")).unwrap();
println!("{}", d4::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/4_input.txt")).unwrap();
println!("{}", d4::process_part2(&content));
}

20
y2022/src/bin/d5.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d5;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/5_input.txt")).unwrap();
println!("{}", d5::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/5_input.txt")).unwrap();
println!("{}", d5::process_part2(&content));
}

20
y2022/src/bin/d6.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d6;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/6_input.txt")).unwrap();
println!("{}", d6::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/6_input.txt")).unwrap();
println!("{}", d6::process_part2(&content));
}

20
y2022/src/bin/d7.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d7;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/7_input.txt")).unwrap();
println!("{}", d7::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/7_input.txt")).unwrap();
println!("{}", d7::process_part2(&content));
}

20
y2022/src/bin/d8.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d8;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/8_input.txt")).unwrap();
println!("{}", d8::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/8_input.txt")).unwrap();
println!("{}", d8::process_part2(&content));
}

20
y2022/src/bin/d9.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y2022::days::d9;
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/9_input.txt")).unwrap();
println!("{}", d9::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/9_input.txt")).unwrap();
println!("{}", d9::process_part2(&content));
}