Compare commits
No commits in common. "fe14fed68cecf9e1b4b1b117d691c614b43c8091" and "dae33e4a4b1177607879bc69ee86f3421c166161" have entirely different histories.
fe14fed68c
...
dae33e4a4b
|
@ -11,8 +11,4 @@ Cargo.lock
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
# Added by cargo
|
|
||||||
|
|
||||||
/target
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"rust-analyzer.linkedProjects": [
|
|
||||||
"./Cargo.toml",
|
|
||||||
"./Cargo.toml"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "advent-of-code"
|
name = "trebuchet"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
mod part_one;
|
||||||
|
mod part_two;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
//part_one::part_one();
|
||||||
|
part_two::part_two();
|
||||||
|
}
|
|
@ -1,19 +1,28 @@
|
||||||
use crate::utils::input_reader;
|
// https://doc.rust-lang.org/stable/rust-by-example/std_misc/file/read_lines.html
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn part_one() -> String {
|
pub fn part_one() {
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_01/input.txt") {
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
result += parse_line(&line.unwrap());
|
result += parse_line(&line.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.to_string()
|
println!("{}", result);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_line(s: &str) -> u32 {
|
fn parse_line(s: &str) -> u32 {
|
||||||
const RADIX: u32 = 10;
|
const RADIX: u32 = 10;
|
||||||
|
|
|
@ -1,21 +1,27 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::utils::input_reader;
|
pub fn part_two() {
|
||||||
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
pub fn part_two() -> String {
|
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_01/input.txt") {
|
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
result += parse_line(&line.unwrap());
|
result += parse_line(&line.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.to_string()
|
println!("{}", result);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_line(s: &str) -> u32 {
|
fn parse_line(s: &str) -> u32 {
|
||||||
const RADIX: u32 = 10;
|
const RADIX: u32 = 10;
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "cube-conundrum"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
|
@ -0,0 +1,7 @@
|
||||||
|
mod part_one;
|
||||||
|
mod part_two;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
//part_one::part_one();
|
||||||
|
part_two::part_two();
|
||||||
|
}
|
|
@ -1,19 +1,27 @@
|
||||||
use crate::utils::input_reader;
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn part_one() -> String{
|
pub fn part_one() {
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_02/input.txt") {
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
result += process_line(&line.unwrap());
|
result += process_line(&line.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.to_string()
|
println!("{}", result);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
||||||
|
|
||||||
fn process_line(s: &str) -> u32 {
|
fn process_line(s: &str) -> u32 {
|
||||||
let v: Vec<&str> = s.split(':').collect();
|
let v: Vec<&str> = s.split(':').collect();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
|
use std::fs::File;
|
||||||
use crate::utils::input_reader;
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
struct Game {
|
struct Game {
|
||||||
red: u32,
|
red: u32,
|
||||||
|
@ -8,29 +9,32 @@ struct Game {
|
||||||
blue: u32,
|
blue: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn part_two() -> String {
|
pub fn part_two() {
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_02/input.txt") {
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
result += process_line(&line.unwrap());
|
result += process_line(&line.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.to_string()
|
println!("{}", result);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
||||||
|
|
||||||
fn process_line(s: &str) -> u32 {
|
fn process_line(s: &str) -> u32 {
|
||||||
let v: Vec<&str> = s.split(':').collect();
|
let v: Vec<&str> = s.split(':').collect();
|
||||||
|
|
||||||
v[0].split("Game ").collect::<Vec<&str>>()[1]
|
let game_id: u32 = v[0].split("Game ").collect::<Vec<&str>>()[1]
|
||||||
.parse::<u32>()
|
.parse::<u32>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let games: Vec<&str> = v[1].split(';').collect();
|
let games: Vec<&str> = v[1].split(';').collect();
|
||||||
|
|
||||||
let mut min_game = Game {
|
let mut min_game = Game {
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "gear-ratios"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
|
@ -0,0 +1,7 @@
|
||||||
|
mod part_one;
|
||||||
|
//mod part_two;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
part_one::part_one();
|
||||||
|
//part_two::part_two();
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{fs::File, io};
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
use crate::utils::input_reader;
|
use std::path::Path;
|
||||||
|
|
||||||
enum Engine {
|
enum Engine {
|
||||||
Symbol(char),
|
Symbol(char),
|
||||||
|
@ -8,17 +8,22 @@ enum Engine {
|
||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn part_one() -> String {
|
pub fn part_one() {
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_03/input.txt") {
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
let matrix = create_matrix(lines);
|
let matrix = create_matrix(lines);
|
||||||
let result = process_matrix(&matrix);
|
let result = process_matrix(&matrix);
|
||||||
|
|
||||||
result.to_string()
|
println!("{}", result);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
||||||
|
|
||||||
fn create_matrix(lines: io::Lines<io::BufReader<File>>) -> Vec<Vec<Engine>> {
|
fn create_matrix(lines: io::Lines<io::BufReader<File>>) -> Vec<Vec<Engine>> {
|
||||||
let mut matrix: Vec<Vec<Engine>> = Vec::new();
|
let mut matrix: Vec<Vec<Engine>> = Vec::new();
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "scratchcards"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
|
@ -0,0 +1,5 @@
|
||||||
|
mod part_one;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
part_one::part_one();
|
||||||
|
}
|
|
@ -1,18 +1,17 @@
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::utils::input_reader;
|
pub fn part_one() {
|
||||||
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
pub fn part_one() -> String {
|
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_04/input.txt") {
|
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
result += process_line(&line.unwrap());
|
result += process_line(&line.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.to_string()
|
println!("{}", result);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,3 +46,10 @@ fn process_line(s: &str) -> u32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "wait-for-it"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
|
@ -0,0 +1,7 @@
|
||||||
|
//mod part_one;
|
||||||
|
mod part_two;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
//part_one::part_one();
|
||||||
|
part_two::part_two();
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::utils::input_reader;
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn part_one() -> String {
|
pub fn part_one() {
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_06/input.txt") {
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
let mut margin = 1;
|
let mut margin = 1;
|
||||||
|
|
||||||
let mut race_results: Vec<Vec<u32>> = Vec::new();
|
let mut race_results: Vec<Vec<u32>> = Vec::new();
|
||||||
|
@ -14,9 +16,7 @@ pub fn part_one() -> String {
|
||||||
margin *= process_race_result(race_results[0][i], race_results[1][i]);
|
margin *= process_race_result(race_results[0][i], race_results[1][i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
margin.to_string()
|
println!("{:?}", margin);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,4 +41,10 @@ fn process_race_result(time: u32, distance: u32) -> u32 {
|
||||||
return win_count;
|
return win_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::utils::input_reader;
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn part_two() -> String {
|
pub fn part_two() {
|
||||||
if let Ok(lines) = input_reader::read_lines("./input/2023/day_06/input.txt") {
|
if let Ok(lines) = read_lines("./input.txt") {
|
||||||
let mut race_result: Vec<u64> = Vec::new();
|
let mut race_result: Vec<u64> = Vec::new();
|
||||||
|
|
||||||
for line in lines {
|
for line in lines {
|
||||||
|
@ -10,9 +12,7 @@ pub fn part_two() -> String {
|
||||||
|
|
||||||
let win_count = process_race_result(race_result[0], race_result[1]);
|
let win_count = process_race_result(race_result[0], race_result[1]);
|
||||||
|
|
||||||
win_count.to_string()
|
println!("{:?}", win_count);
|
||||||
} else {
|
|
||||||
panic!("Failed to read lines from input file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,4 +38,10 @@ fn process_race_result(time: u64, distance: u64) -> u64 {
|
||||||
return win_count;
|
return win_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
||||||
|
where
|
||||||
|
P: AsRef<Path>,
|
||||||
|
{
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
Ok(io::BufReader::new(file).lines())
|
||||||
|
}
|
21
src/main.rs
21
src/main.rs
|
@ -1,21 +0,0 @@
|
||||||
mod utils;
|
|
||||||
use std::env;
|
|
||||||
|
|
||||||
mod year_2023;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
// Parse command-line arguments
|
|
||||||
let args: Vec<String> = env::args().collect();
|
|
||||||
|
|
||||||
if args.len() != 3 {
|
|
||||||
panic!("Usage: {} <year> <day>", args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let year = &args[1];
|
|
||||||
let day = &args[2];
|
|
||||||
|
|
||||||
match year.as_str() {
|
|
||||||
"2023" => year_2023::run(day),
|
|
||||||
_ => panic!("Invalid year specified"),
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// https://doc.rust-lang.org/stable/rust-by-example/std_misc/file/read_lines.html
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::{self, BufRead};
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
|
|
||||||
pub fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
|
||||||
where
|
|
||||||
P: AsRef<Path>,
|
|
||||||
{
|
|
||||||
let file = File::open(filename)?;
|
|
||||||
Ok(io::BufReader::new(file).lines())
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
pub mod input_reader;
|
|
||||||
pub mod solution;
|
|
|
@ -1,4 +0,0 @@
|
||||||
pub trait Solution {
|
|
||||||
fn part_one(&self) -> String;
|
|
||||||
fn part_two(&self) -> String;
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
pub mod part_one;
|
|
||||||
pub mod part_two;
|
|
||||||
|
|
||||||
use crate::utils::solution::Solution;
|
|
||||||
|
|
||||||
pub struct Day1Solution;
|
|
||||||
|
|
||||||
impl Solution for Day1Solution {
|
|
||||||
fn part_one(&self) -> String{
|
|
||||||
// Implementation for part one of day 1
|
|
||||||
// ...
|
|
||||||
part_one::part_one()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn part_two(&self) -> String {
|
|
||||||
// Implementation for part two of day 1
|
|
||||||
// ...
|
|
||||||
part_two::part_two()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
pub mod part_one;
|
|
||||||
pub mod part_two;
|
|
||||||
|
|
||||||
use crate::utils::solution::Solution;
|
|
||||||
|
|
||||||
pub struct Day2Solution;
|
|
||||||
|
|
||||||
impl Solution for Day2Solution {
|
|
||||||
fn part_one(&self) -> String{
|
|
||||||
// Implementation for part one of day 1
|
|
||||||
// ...
|
|
||||||
part_one::part_one()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn part_two(&self) -> String {
|
|
||||||
// Implementation for part two of day 1
|
|
||||||
// ...
|
|
||||||
part_two::part_two()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
pub mod part_one;
|
|
||||||
|
|
||||||
|
|
||||||
use crate::utils::solution::Solution;
|
|
||||||
|
|
||||||
pub struct Day3Solution;
|
|
||||||
|
|
||||||
impl Solution for Day3Solution {
|
|
||||||
fn part_one(&self) -> String{
|
|
||||||
// Implementation for part one of day 1
|
|
||||||
// ...
|
|
||||||
part_one::part_one()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn part_two(&self) -> String {
|
|
||||||
// Implementation for part two of day 1
|
|
||||||
// ...
|
|
||||||
String::from("Not implemented")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
pub mod part_one;
|
|
||||||
|
|
||||||
|
|
||||||
use crate::utils::solution::Solution;
|
|
||||||
|
|
||||||
pub struct Day4Solution;
|
|
||||||
|
|
||||||
impl Solution for Day4Solution {
|
|
||||||
fn part_one(&self) -> String{
|
|
||||||
// Implementation for part one of day 1
|
|
||||||
// ...
|
|
||||||
part_one::part_one()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn part_two(&self) -> String {
|
|
||||||
// Implementation for part two of day 1
|
|
||||||
// ...
|
|
||||||
String::from("Not implemented")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
pub mod part_one;
|
|
||||||
pub mod part_two;
|
|
||||||
|
|
||||||
|
|
||||||
use crate::utils::solution::Solution;
|
|
||||||
|
|
||||||
pub struct Day6Solution;
|
|
||||||
|
|
||||||
impl Solution for Day6Solution {
|
|
||||||
fn part_one(&self) -> String{
|
|
||||||
// Implementation for part one of day 1
|
|
||||||
// ...
|
|
||||||
part_one::part_one()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn part_two(&self) -> String {
|
|
||||||
// Implementation for part two of day 1
|
|
||||||
// ...
|
|
||||||
part_two::part_two()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
use crate::utils::solution::Solution;
|
|
||||||
|
|
||||||
pub mod day_01_trebuchet;
|
|
||||||
pub mod day_02_cube_conundrum;
|
|
||||||
pub mod day_03_gear_ratios;
|
|
||||||
pub mod day_04_scratchcards;
|
|
||||||
pub mod day_06_wait_for_it;
|
|
||||||
|
|
||||||
pub fn run(day: &str) {
|
|
||||||
let solution: Box<dyn Solution> = match day {
|
|
||||||
"1" => Box::new(day_01_trebuchet::Day1Solution),
|
|
||||||
"2" => Box::new(day_02_cube_conundrum::Day2Solution),
|
|
||||||
"3" => Box::new(day_03_gear_ratios::Day3Solution),
|
|
||||||
"4" => Box::new(day_04_scratchcards::Day4Solution),
|
|
||||||
"6" => Box::new(day_06_wait_for_it::Day6Solution),
|
|
||||||
_ => panic!("Invalid day specified"),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Call part_one and part_two on the solution instance
|
|
||||||
println!("Part One Result: {}", solution.part_one());
|
|
||||||
println!("Part Two Result: {}", solution.part_two());
|
|
||||||
}
|
|
Loading…
Reference in New Issue