feat: implement day06 and add test cases
This commit is contained in:
parent
c44f8b3c5c
commit
56bd3207db
19
.fleet/run.json
Normal file
19
.fleet/run.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "cargo",
|
||||||
|
"name": "run-main",
|
||||||
|
"cargoArgs": ["run","--"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "cargo",
|
||||||
|
"name": "build-dev",
|
||||||
|
"cargoArgs": ["build"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "cargo",
|
||||||
|
"name": "build-release",
|
||||||
|
"cargoArgs": ["build", "--release"]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
41
src/day01.rs
41
src/day01.rs
@ -1,23 +1,32 @@
|
|||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
|
||||||
pub fn execute_task01(content: &str) {
|
pub fn execute_task01(content: &str) {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let max: i32 = solve_task01(content);
|
||||||
let mut sum_vector = collect_all_calories(vector);
|
|
||||||
sum_vector.sort_by_key(|a| std::cmp::Reverse(*a));
|
|
||||||
|
|
||||||
let max: i32 = sum_vector[0];
|
|
||||||
|
|
||||||
println!("Day01 - Task01 - Biggest Calories {}", max)
|
println!("Day01 - Task01 - Biggest Calories {}", max)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn execute_task02(content: &str) {
|
pub fn execute_task02(content: &str) {
|
||||||
|
let max_three: i32 = solve_task02(content);
|
||||||
|
|
||||||
|
println!("Day01 - Task02 - Biggest Calories of top three: {}", max_three);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task01(content: &str) -> i32 {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
let mut sum_vector = collect_all_calories(vector);
|
let mut sum_vector = collect_all_calories(vector);
|
||||||
sum_vector.sort_by_key(|a| std::cmp::Reverse(*a));
|
sum_vector.sort_by_key(|a| std::cmp::Reverse(*a));
|
||||||
|
|
||||||
let max_three: i32 = sum_vector.iter().take(3).sum();
|
sum_vector[0]
|
||||||
|
}
|
||||||
|
|
||||||
println!("Day01 - Task02 - Biggest Calories of top three: {}", max_three);
|
fn solve_task02(content: &str) -> i32 {
|
||||||
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
|
let mut sum_vector = collect_all_calories(vector);
|
||||||
|
sum_vector.sort_by_key(|a| std::cmp::Reverse(*a));
|
||||||
|
|
||||||
|
sum_vector.iter().take(3).sum()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_all_calories(list: Vec<&str>) -> Vec<i32> {
|
fn collect_all_calories(list: Vec<&str>) -> Vec<i32> {
|
||||||
@ -34,6 +43,24 @@ fn collect_all_calories(list: Vec<&str>) -> Vec<i32> {
|
|||||||
|
|
||||||
calories += var.parse::<i32>().unwrap_or(0);
|
calories += var.parse::<i32>().unwrap_or(0);
|
||||||
}
|
}
|
||||||
|
calories_list.push(calories);
|
||||||
|
|
||||||
return calories_list;
|
return calories_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
const EXAMPLE01: &'static str = include_str!("input/day01/example01");
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_first() {
|
||||||
|
assert_eq!(super::solve_task01(EXAMPLE01), 24000);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_second() {
|
||||||
|
assert_eq!(super::solve_task02(EXAMPLE01), 45000);
|
||||||
|
}
|
||||||
|
}
|
50
src/day02.rs
50
src/day02.rs
@ -34,30 +34,38 @@ enum Move {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_task01(content: &str) {
|
pub fn execute_task01(content: &str) {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let score = solve_task01(content);
|
||||||
let score: i32 = vector.into_iter().map(|line| {
|
|
||||||
let opp_char: char = line.chars().nth(0).unwrap();
|
|
||||||
let you_char: char = line.chars().nth(2).unwrap();
|
|
||||||
|
|
||||||
calculate_score_from_game(&convert_to_move(opp_char), &convert_to_move(you_char))
|
|
||||||
}).sum();
|
|
||||||
|
|
||||||
println!("Day02 - Task01 - Score: {}", score);
|
println!("Day02 - Task01 - Score: {}", score);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_task02(content: &str) {
|
pub fn execute_task02(content: &str) {
|
||||||
|
let score = solve_task02(content);
|
||||||
|
|
||||||
|
println!("Day02 - Task01 - Score: {}", score);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task01(content: &str) -> i32 {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
let score: i32 = vector.into_iter().map(|line| {
|
vector.into_iter().map(|line| {
|
||||||
|
let opp_char: char = line.chars().nth(0).unwrap();
|
||||||
|
let you_char: char = line.chars().nth(2).unwrap();
|
||||||
|
|
||||||
|
calculate_score_from_game(&convert_to_move(opp_char), &convert_to_move(you_char))
|
||||||
|
}).sum()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task02(content: &str) -> i32 {
|
||||||
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
|
vector.into_iter().map(|line| {
|
||||||
let opp_char: char = line.chars().nth(0).unwrap();
|
let opp_char: char = line.chars().nth(0).unwrap();
|
||||||
let you_char: char = line.chars().nth(2).unwrap();
|
let you_char: char = line.chars().nth(2).unwrap();
|
||||||
let opp_move: Move = convert_to_move(opp_char);
|
let opp_move: Move = convert_to_move(opp_char);
|
||||||
|
|
||||||
calculate_score_from_game(&opp_move, &convert_to_conditional_move(&opp_move ,you_char))
|
calculate_score_from_game(&opp_move, &convert_to_conditional_move(&opp_move ,you_char))
|
||||||
}).sum();
|
}).sum()
|
||||||
|
|
||||||
println!("Day02 - Task01 - Score: {}", score);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_to_conditional_move(opp: &Move, you: char) -> Move {
|
fn convert_to_conditional_move(opp: &Move, you: char) -> Move {
|
||||||
@ -95,3 +103,21 @@ fn calculate_score_from_game(opp: &Move, you: &Move) -> i32 {
|
|||||||
(Scissors, Scissors) => 3 + 3, // You Draw with Scissors
|
(Scissors, Scissors) => 3 + 3, // You Draw with Scissors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
const EXAMPLE01: &'static str = include_str!("input/day02/example01");
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_first() {
|
||||||
|
assert_eq!(super::solve_task01(EXAMPLE01), 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_second() {
|
||||||
|
assert_eq!(super::solve_task02(EXAMPLE01), 12);
|
||||||
|
}
|
||||||
|
}
|
39
src/day03.rs
39
src/day03.rs
@ -1,6 +1,18 @@
|
|||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
|
||||||
pub fn execute_task01(content: &str) {
|
pub fn execute_task01(content: &str) {
|
||||||
|
let sum = solve_task01(content);
|
||||||
|
|
||||||
|
println!("Day03 - Task01 - Sum of Priorities: {}", sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_task02(content: &str) {
|
||||||
|
let sum = solve_task02(content);
|
||||||
|
|
||||||
|
println!("Day03 - Task02 - Sum of Groups of Priorities: {}", sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task01(content: &str) -> i32 {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
let rucksack_compartments: Vec<(Vec<char>, Vec<char>)> = vector.iter().map(|line| split_rucksack_in_two_compartments(line)).collect();
|
let rucksack_compartments: Vec<(Vec<char>, Vec<char>)> = vector.iter().map(|line| split_rucksack_in_two_compartments(line)).collect();
|
||||||
|
|
||||||
@ -12,12 +24,10 @@ pub fn execute_task01(content: &str) {
|
|||||||
.map(|(a, _)| a))
|
.map(|(a, _)| a))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let sum: i32 = duplicates.iter().copied().map(|c| convert_char_to_prio(&c)).sum();
|
duplicates.iter().copied().map(|c| convert_char_to_prio(&c)).sum()
|
||||||
|
|
||||||
println!("Day03 - Task01 - Sum of Priorities: {}", sum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_task02(content: &str) {
|
fn solve_task02(content: &str) -> i32 {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
let compartments: Vec<Vec<char>> = vector.iter().map(|line| split_rucksack_in_items(line)).collect();
|
let compartments: Vec<Vec<char>> = vector.iter().map(|line| split_rucksack_in_items(line)).collect();
|
||||||
let mut duplicates: Vec<char> = vec![];
|
let mut duplicates: Vec<char> = vec![];
|
||||||
@ -43,9 +53,7 @@ pub fn execute_task02(content: &str) {
|
|||||||
duplicates.append(&mut dups)
|
duplicates.append(&mut dups)
|
||||||
}
|
}
|
||||||
|
|
||||||
let sum: i32 = duplicates.iter().copied().map(|c| convert_char_to_prio(&c)).sum();
|
duplicates.iter().copied().map(|c| convert_char_to_prio(&c)).sum()
|
||||||
|
|
||||||
println!("Day03 - Task02 - Sum of Groups of Priorities: {}", sum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn split_rucksack_in_two_compartments(rucksack_content: &str) -> (Vec<char>, Vec<char>) {
|
fn split_rucksack_in_two_compartments(rucksack_content: &str) -> (Vec<char>, Vec<char>) {
|
||||||
@ -85,3 +93,20 @@ pub fn convert_char_to_prio(c: &char) -> i32 {
|
|||||||
|
|
||||||
panic!("never should called");
|
panic!("never should called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
const EXAMPLE01: &'static str = include_str!("input/day03/example01");
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_first() {
|
||||||
|
assert_eq!(super::solve_task01(EXAMPLE01), 157);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_second() {
|
||||||
|
assert_eq!(super::solve_task02(EXAMPLE01), 70);
|
||||||
|
}
|
||||||
|
}
|
49
src/day04.rs
49
src/day04.rs
@ -1,29 +1,36 @@
|
|||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
|
||||||
pub fn execute_task01(content: &str) {
|
pub fn execute_task01(content: &str) {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let sum: usize = solve_task01(content);
|
||||||
let pairs: Vec<((i32, i32), (i32, i32))> = vector.iter().map(|line| convert_to_tuple(line)).collect();
|
|
||||||
|
|
||||||
let fully_pairs: usize = pairs
|
println!("Day04 - Task01 - Sum of fully included pairs: {}", sum);
|
||||||
.into_iter()
|
|
||||||
.filter(|pair| is_fully_in_other(pair.0, pair.1))
|
|
||||||
.count();
|
|
||||||
|
|
||||||
println!("Day04 - Task01 - Sum of fully included pairs: {}", fully_pairs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_task02(content: &str) {
|
pub fn execute_task02(content: &str) {
|
||||||
|
let sum: usize = solve_task02(content);
|
||||||
|
|
||||||
|
println!("Day04 - Task02 - Sum of partial included pairs: {}", sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task01(content: &str) -> usize {
|
||||||
let vector = utils::convert_to_string_slice(&content);
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
let pairs: Vec<((i32, i32), (i32, i32))> = vector.iter().map(|line| convert_to_tuple(line)).collect();
|
let pairs: Vec<((i32, i32), (i32, i32))> = vector.iter().map(|line| convert_to_tuple(line)).collect();
|
||||||
|
|
||||||
let fully_pairs: usize = pairs
|
pairs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|pair| is_partial_in_other(pair.0, pair.1))
|
.filter(|pair| is_fully_in_other(pair.0, pair.1))
|
||||||
.count();
|
.count()
|
||||||
|
|
||||||
println!("Day04 - Task02 - Sum of partial included pairs: {}", fully_pairs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn solve_task02(content: &str) -> usize {
|
||||||
|
let vector = utils::convert_to_string_slice(&content);
|
||||||
|
let pairs: Vec<((i32, i32), (i32, i32))> = vector.iter().map(|line| convert_to_tuple(line)).collect();
|
||||||
|
|
||||||
|
pairs
|
||||||
|
.into_iter()
|
||||||
|
.filter(|pair| is_partial_in_other(pair.0, pair.1))
|
||||||
|
.count()
|
||||||
|
}
|
||||||
|
|
||||||
fn convert_to_tuple(line: &str) -> ((i32, i32), (i32, i32)) {
|
fn convert_to_tuple(line: &str) -> ((i32, i32), (i32, i32)) {
|
||||||
let pairs: Vec<(i32, i32)> = line
|
let pairs: Vec<(i32, i32)> = line
|
||||||
@ -61,3 +68,19 @@ fn is_partial_in_other(first: (i32, i32), second: (i32, i32)) -> bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
const EXAMPLE01: &'static str = include_str!("input/day04/example01");
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_first() {
|
||||||
|
assert_eq!(super::solve_task01(EXAMPLE01), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_second() {
|
||||||
|
assert_eq!(super::solve_task02(EXAMPLE01), 4);
|
||||||
|
}
|
||||||
|
}
|
40
src/day05.rs
40
src/day05.rs
@ -5,6 +5,18 @@ use crate::utils;
|
|||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
pub fn execute_task01(content: &str) {
|
pub fn execute_task01(content: &str) {
|
||||||
|
let line = solve_task01(content);
|
||||||
|
|
||||||
|
println!("Day05 - Task01 - Last Item Str Line: {}", line);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_task02(content: &str) {
|
||||||
|
let line = solve_task02(content);
|
||||||
|
|
||||||
|
println!("Day05 - Task02 - Last Item Str Line: {}", line);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task01(content: &str) -> String {
|
||||||
let re = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap();
|
let re = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap();
|
||||||
|
|
||||||
let mut setup: Vec<&str> = vec![];
|
let mut setup: Vec<&str> = vec![];
|
||||||
@ -33,12 +45,10 @@ pub fn execute_task01(content: &str) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let str_line_vec: Vec<String> = port.into_iter().map(|vec| vec.into_iter().last().unwrap().trim().replace("[", "").replace("]", "")).collect();
|
let str_line_vec: Vec<String> = port.into_iter().map(|vec| vec.into_iter().last().unwrap().trim().replace("[", "").replace("]", "")).collect();
|
||||||
|
str_line_vec.join("")
|
||||||
println!("Day05 - Task01 - Last Item Str Line: {}", str_line_vec.join(""));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_task02(content: &str) {
|
fn solve_task02(content: &str) -> String {
|
||||||
let re = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap();
|
let re = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap();
|
||||||
|
|
||||||
let mut setup: Vec<&str> = vec![];
|
let mut setup: Vec<&str> = vec![];
|
||||||
@ -68,10 +78,10 @@ pub fn execute_task02(content: &str) {
|
|||||||
|
|
||||||
let str_line_vec: Vec<String> = port.into_iter().map(|vec| vec.into_iter().last().unwrap().trim().replace("[", "").replace("]", "")).collect();
|
let str_line_vec: Vec<String> = port.into_iter().map(|vec| vec.into_iter().last().unwrap().trim().replace("[", "").replace("]", "")).collect();
|
||||||
|
|
||||||
println!("Day05 - Task02 - Last Item Str Line: {}", str_line_vec.join(""));
|
str_line_vec.join("")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn move_in_port(mut port: &mut Vec<LinkedList<String>>, from: &str, to: &str, size: i32) {
|
fn move_in_port(mut port: &mut Vec<LinkedList<String>>, from: &str, to: &str, size: i32) {
|
||||||
for _ in 0..size {
|
for _ in 0..size {
|
||||||
move_in_port_once(&mut port, from, to)
|
move_in_port_once(&mut port, from, to)
|
||||||
@ -124,3 +134,21 @@ fn parse_port_level(line: &str) -> Vec<String> {
|
|||||||
.map(|c| c.iter().collect::<String>())
|
.map(|c| c.iter().collect::<String>())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
const EXAMPLE01: &'static str = include_str!("input/day05/example01");
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_first() {
|
||||||
|
assert_eq!(super::solve_task01(EXAMPLE01), "CMZ");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_second() {
|
||||||
|
assert_eq!(super::solve_task02(EXAMPLE01), "MCD");
|
||||||
|
}
|
||||||
|
}
|
56
src/day06.rs
Normal file
56
src/day06.rs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
pub fn execute_task01(content: &str) {
|
||||||
|
let index = solve_task01(content);
|
||||||
|
|
||||||
|
println!("Day06 - Task01 - First code start at: {}", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_task02(content: &str) {
|
||||||
|
let index = solve_task02(content);
|
||||||
|
|
||||||
|
println!("Day06 - Task02 - First code start at: {}", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task01(content: &str) -> usize {
|
||||||
|
find_code(content, 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn solve_task02(content: &str) -> usize {
|
||||||
|
find_code(content, 14)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn find_code(content: &str, len: usize) -> usize {
|
||||||
|
content
|
||||||
|
.as_bytes()
|
||||||
|
.windows(len)
|
||||||
|
.enumerate()
|
||||||
|
.filter(|(_, part)| {
|
||||||
|
let mut used = HashSet::new();
|
||||||
|
part.iter().all(move |elt| used.insert(elt))
|
||||||
|
})
|
||||||
|
.map(|(i, _)| i + len)
|
||||||
|
.next().unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_first() {
|
||||||
|
assert_eq!(super::solve_task01("bvwbjplbgvbhsrlpgdmjqwftvncz"), 5);
|
||||||
|
assert_eq!(super::solve_task01("nppdvjthqldpwncqszvftbrmjlhg"), 6);
|
||||||
|
assert_eq!(super::solve_task01("nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg"), 10);
|
||||||
|
assert_eq!(super::solve_task01("zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw"), 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_second() {
|
||||||
|
assert_eq!(super::solve_task02("mjqjpqmgbljsphdztnvjfqwrcgsmlb"), 19);
|
||||||
|
assert_eq!(super::solve_task02("bvwbjplbgvbhsrlpgdmjqwftvncz"), 23);
|
||||||
|
assert_eq!(super::solve_task02("nppdvjthqldpwncqszvftbrmjlhg"), 23);
|
||||||
|
assert_eq!(super::solve_task02("nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg"), 29);
|
||||||
|
assert_eq!(super::solve_task02("zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw"), 26);
|
||||||
|
}
|
||||||
|
}
|
14
src/input/day01/example01
Normal file
14
src/input/day01/example01
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
1000
|
||||||
|
2000
|
||||||
|
3000
|
||||||
|
|
||||||
|
4000
|
||||||
|
|
||||||
|
5000
|
||||||
|
6000
|
||||||
|
|
||||||
|
7000
|
||||||
|
8000
|
||||||
|
9000
|
||||||
|
|
||||||
|
10000
|
3
src/input/day02/example01
Normal file
3
src/input/day02/example01
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
A Y
|
||||||
|
B X
|
||||||
|
C Z
|
6
src/input/day03/example01
Normal file
6
src/input/day03/example01
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||||
|
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||||
|
PmmdzqPrVvPwwTWBwg
|
||||||
|
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||||
|
ttgJtRGJQctTZtZT
|
||||||
|
CrZsJsPPZsGzwwsLwLmpwMDw
|
6
src/input/day04/example01
Normal file
6
src/input/day04/example01
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
2-4,6-8
|
||||||
|
2-3,4-5
|
||||||
|
5-7,7-9
|
||||||
|
2-8,3-7
|
||||||
|
6-6,4-6
|
||||||
|
2-6,4-8
|
9
src/input/day05/example01
Normal file
9
src/input/day05/example01
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[D]
|
||||||
|
[N] [C]
|
||||||
|
[Z] [M] [P]
|
||||||
|
1 2 3
|
||||||
|
|
||||||
|
move 1 from 2 to 1
|
||||||
|
move 3 from 1 to 3
|
||||||
|
move 2 from 2 to 1
|
||||||
|
move 1 from 1 to 2
|
1
src/input/day06/input01
Normal file
1
src/input/day06/input01
Normal file
@ -0,0 +1 @@
|
|||||||
|
sgrrrrwcrrlqqgppfgfnngsgcgngrrllnqnndzzjgzzzjdjqdjdhhjshjhwwqnnwjnwnjwjttvgvddjrrtvtsvtvqtqhhbchcdhhnwwvqvvsbsqswqqdwdjwwjvvrddgpdpdlpljjwffqnffbllplmmwzwtzzvfzvvjbbmnmppzgzszllsqqpvqvmmzzlccjhchdhlddchdchcddnwdwhhhczzldlsdlssdmmswswzwtwzwjzwzfwwdhwdwjdjldjldlqddhttfbfnbfnfgnfnvnffsszjjsqqdzdsdrsswddggstgsgqgzqgqcqdccqcvcpcspccdgccfflppddqfdfmdffmlflplnppfvvgsgbgtgccmfccfwwthhcjcbbhbwbjbhjjtddrldlrddzjdzdttbfbmmtjmjtjzjvjvgvttthwhhgqhggcbbtqbbqgbqqvccdttfgfwfnwffbfqbfbbnlnzlzbbwnwntwtjwjnjwwsdwwcbbwhwzwhwvhhpwwnvvtvnttgtrrnjjzppmbmfmjffdddvfvjjpfpgpzzwqwpwllwjjzmjmdmdwwdrdttpmmdhdndvvpbpqbbzqzmmtdmmtddlccjvjsjrsscqqzvvbsstccvffcttwrwjjsgsttmgmvvzbbcjbjrbrddvjjnhjhphvhsszqqfrfzfssgfssgddcbbplbbsfsmfmpphssmvvcvrrcgrcgcvggrzggzjjfhjjtpphzppqtptllssbmbrrgrvvhjjnznlnggrnrsnrrphhbqhhhsthsthhhnssmsjjwjppqfqlqqgnnhnmmfsfslfllvnnsdnssgngbbjmjccsrrmjjnljlwlttpffddgbdggmbgbtbzzwgwppczcffvccnssbmmjrrfwwhcwhwqwnqqzsqqjsqqnndqdgqdqgggzjjcvvzdddhnhjnnzlnlwlzlqqvjjpprqrjrfjjrpjjnfntffqtttnjjdbjbdjbbrsrbbmrmccpllmccqrqwqnnsjjmjgjqjpqjqgjjtwwqdqmqtqqmsqmmvlldtllbcctfcccdcddcggmmmsggjddcqddbqqdgqgffststgtftbbdrbrlllnvllcflfpfdffjvvvmdmvvtfvfcvvfgghzzlgzgszzhmzzhfhllgblggfpfzfvzvdzzhsspmmjtjhjggfhggnggbtggqqtztqtmqtqddmzmrmdrmdmqqcbqcqzzvczvzfvvsggcgssjnnjqnntwtmwwhzzzhllqvlljsljjfnnjwjnwnffpggqwwvbwwdbbmbvmvlvnnnppqvqqghqgqppnllhjllvlflfpfhfjjhgjgpjpbjjdpdqdpqdpdwpwffqlffrbrjrtrvtvrtvrtrvtvltlrrvjjlttmtffhvfhfnhnlnfnvvltvlvlbbfllfnllndndcdrrnznssvpvhhhmrmlmhhrnhhpggtftddghhqrqddjttbdbqddpsdppwrwhhhgwhhqrhqrqhhqdhqddjpjqqsdsmddnqncqnqwqdwwhghbhffnsffnsszlssntnbbbfhbhwhzhdzhzbhblbzzzbqzbbgtbbcjbjtjptpwwhlwwhhmshhmbbfjbfflnnlmnnzvnnbtnbbvwvvgcggrzrffwmwhmwhwjwpwwzbbvtbtssdhdlhhdppmmcnmcmffnpfffvbfvfhvhjhffzfbzzfdfpdpzzhbzblbbmffvvcmmttdntnmtmztzbbncbctcqtcqqcvcfcwcdcchphfhjhhjbjnjtjnjwwzsstpprnnhtntvtpthpttpdpzzwcczsscqscsbbmpbbdsdlsslzszjszsczntrqjmmmfqsdwtqqflgsttwfqqvvspnlfvqlrvvbjmmpmttcdnhncmmdfhwwqdrqjqwggrbtgbrdmmrhhvqfvvhsmtfbnthrbltgvdrsbqglgjqtssbvmbjjjbbcgfftgbjmfqzggdtcfzddqlrvwqjjvnmjzjwqrwsqbjgnswpnlbdzdlcvcbqplzgqwmsntzzjhqwfjdprglcccnldfqftgttqbrmclsqtncrjbttcglcvspsgvdjqgrdzzlnhbfqbwnfqcjrrqpprjbqpzhthgsgcflqldsnwsvzgcmfrdvfmqhbcfczhschpwnmdjnjlvrwqllnnhjvjtzhcrqcwlmrqfdhvzcbnvwrgngttwlhcmmgtzwjztscjnmslbvtdrvgdprlfrhggcwtwjhblppfbpljbmwrlwqrfwjwfsftmflsdfrhlvgcbzcvhlhgclvnmtfcqttvcphgvflhdclbmtgsrldgfvtpjcphtzdctrcchwdbdbtpptdnbjnqwdrllmnbcgfltmggpqfbfpmnhcmpgsgptflglzswtmrjfzmwmwphfjngnfmmtqlrsltlvlfmwmjvvtgngllszwzdjjmbnwwgzpqltlrzfdwchgttvlhgjjhjqmlrrwsqlhsgzsgmmsgbgvrlmbprrhlgsjnsdwcbrwvqjqmfcqcwllsvggcznwpzvgpszrqwngcnchvdlrdrgtbsjdqfpsfvwdtdlqwbfjlwrmqbrhwqmfgppwvfbgthnbqnmqqhmpfwbgljcmqqbpnwvztrcrlbvtcnncwwjcbqsmbqnqtrmpwmhlvwtfmsmtpfnmphqdvqfzvmjjhnwdfjnwvmbbwvthhwzjtzzrsmqlqtnnrqjrnchqttgsptfpdcpgfmzvqhwffqmfhwqqbdhmgcrfqtwrcgtgmglmmwhvqwvglfsvwbpvhmnbqhgfgqwwnhdhvnwggsmhjfsjmsrlcvlnhrhrlhbvhdrhbplrzspdmbcnzbwlvcmztwvghlsnzmbnrpssrngpdtmgzfcbqmfdgthcscjspspmcgdmwwwfspgjwzccrfzdpbwrfpgpgzrchffmhvwwppbjwqmdzgtpfmcblzqrghzdbzqzvbnmqbdlzjrwbbhqgtdzntgdbndmndhlnhcvqtlfcrfprfrlfglwvdnszrwjdcmtstcsnvnpcldctvqpcfhjnpvscscrtfqfjcrjlrmcqjfthptbqprbvchjlqzmfcmlhmfmdhhpcqbncmcqjsdmzflwtzfdcgmrbwbcdgjmfhlshsbwmbdcbfbvmqcgwlqpprjfrhzvsjmcjdfnwhcffhtnqpznfzpttsqqwcsvpdhdfbggzpngvbvdlpmvfjjlcfmbvmfqsczprtlnwvqnnlcrdnvpmcbrzvlfgscbcwtrbcpdnpshhmrqmhnwcndptljhwpvtcflqgmzjsfmfdzwwwhnbpzjwzgqmdcdbtfhwtgvcscbdqlcmppwjgghvrmqpwfbnjfhfcrccfzjvtjsjcsmhncdjlclvhfsvlcjcnpbqqqdjmjdbggmfwswvdjscvgrdbpcrcqtndswgdnznzpwtcdgvcrrqpdcpbmbdjrsgnfvgwpgpzttfmsczcmjvhmdpbpmjjcjsvbvbwjpwtwpsdddlsnvrshqvmwsjwwvqnczzljjfptcszgpndgczprbvjbnqpwgzmnlhvbsfbtjnwbtlzqgnmzbmqgqvwzltvqczfpdzfzsfhqlmtfcbfdqtnwzbvqblqmzvmnspntqtqdglrdmdntrghwvpfrbjgpzvrnppvnvfgwdzlvhtcscclbtftlvsprwhjvjlhrhfdgzbfbfphzbhtfdlpzcshhfzhtdvggnnbqvnrwvnhvgjgjpcrztqjmtzlzlrlmndfvctzjdpnmlgmsppqdrzmptvrsptvmmbvbwvhwptrtlfdqdqwfgldtbhqdhszcmwqnhswrdhgmgvbvbhwhlpcflsrwlvsvhvctmwwhtlgmshdqflwsdjbbzgbvbwpfncgqjzfjvmzzhgdzjvghtrtsmwgzpdrngwdbtfzrqsgdmwtdhsftfqcnmjtrqqwthcbgtmqnjvjzzplrzllnjqddvbwnglhtzljwjvscdfdnsvmrgwhjrhlrqpqgmzstnwwjpddhdbsnnsqvtsdhtmfdmbcpzwqmbhhjhcfzbvvglhfdltrmbstjhsqrbs
|
@ -4,12 +4,14 @@ mod day02;
|
|||||||
mod day03;
|
mod day03;
|
||||||
mod day04;
|
mod day04;
|
||||||
mod day05;
|
mod day05;
|
||||||
|
mod day06;
|
||||||
|
|
||||||
const CONTENT01: &'static str = include_str!("input/day01/input01");
|
const CONTENT01: &'static str = include_str!("input/day01/input01");
|
||||||
const CONTENT02: &'static str = include_str!("input/day02/input01");
|
const CONTENT02: &'static str = include_str!("input/day02/input01");
|
||||||
const CONTENT03: &'static str = include_str!("input/day03/input01");
|
const CONTENT03: &'static str = include_str!("input/day03/input01");
|
||||||
const CONTENT04: &'static str = include_str!("input/day04/input01");
|
const CONTENT04: &'static str = include_str!("input/day04/input01");
|
||||||
const CONTENT05: &'static str = include_str!("input/day05/input01");
|
const CONTENT05: &'static str = include_str!("input/day05/input01");
|
||||||
|
const CONTENT06: &'static str = include_str!("input/day06/input01");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
day01::execute_task01(&CONTENT01);
|
day01::execute_task01(&CONTENT01);
|
||||||
@ -27,4 +29,6 @@ fn main() {
|
|||||||
day05::execute_task01(&CONTENT05);
|
day05::execute_task01(&CONTENT05);
|
||||||
day05::execute_task02(&CONTENT05);
|
day05::execute_task02(&CONTENT05);
|
||||||
|
|
||||||
|
day06::execute_task01(&CONTENT06);
|
||||||
|
day06::execute_task02(&CONTENT06);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user