Skip to content

Commit

Permalink
Dont include year in solution macro
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed Nov 25, 2024
1 parent c77380d commit ad8351e
Show file tree
Hide file tree
Showing 69 changed files with 91 additions and 127 deletions.
2 changes: 1 addition & 1 deletion aoc_2021/src/day_01.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Sonar Sweep", (2022, 00));
solution!("Sonar Sweep", 1);

fn part_a(input: &str) -> Answer {
let data = input
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_02.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Dive!", (2022, 00));
solution!("Dive!", 2);

fn part_a(input: &str) -> Answer {
let mut dep: u32 = 0;
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_03.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Binary Diagnostic", (2022, 00));
solution!("Binary Diagnostic", 3);

fn part_a(input: &str) -> Answer {
let num_len = input.lines().next().unwrap().len();
Expand Down
8 changes: 4 additions & 4 deletions aoc_2021/src/day_04.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Giant Squid", (2022, 00));
solution!("Giant Squid", 4);

fn part_a(input: &str) -> Answer {
let bingo = Bingo::parse_input(input);
Expand All @@ -11,9 +11,9 @@ fn part_a(input: &str) -> Answer {

fn part_b(input: &str) -> Answer {
let bingo = Bingo::parse_input(input);
let loseing = bingo.loseing_solve();
let losing = bingo.losing_solve();

loseing.0[loseing.1].final_out(loseing.2).into()
losing.0[losing.1].final_out(losing.2).into()
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -67,7 +67,7 @@ impl Bingo {
}
}

fn loseing_solve(self) -> (Vec<Board>, usize, u32) {
fn losing_solve(self) -> (Vec<Board>, usize, u32) {
let mut nums = self.numbers.clone();
let mut tick = self.boards;
let mut take = self.take;
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_05.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use common::{solution, Answer};

use hashbrown::HashMap;

solution!("Hydrothermal Venture", (2022, 00));
solution!("Hydrothermal Venture", 5);

fn part_a(input: &str) -> Answer {
run(input, false).into()
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::hash::Hash;

use hashbrown::HashMap;

solution!("Lanternfish", (2022, 00));
solution!("Lanternfish", 6);

fn part_a(input: &str) -> Answer {
let data = Fish::parse_inp(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_07.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("The Treachery of Whales", (2022, 00));
solution!("The Treachery of Whales", 7);

fn part_a(input: &str) -> Answer {
let data = parse_crabs(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_08.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DIGITS: [&str; 10] = [
"abcefg", "cf", "acdeg", "acdfg", "bcdf", "abdfg", "abdefg", "acf", "abcdefg", "abcdfg",
];

solution!("Seven Segment Search", (2022, 00));
solution!("Seven Segment Search", 8);

fn part_a(input: &str) -> Answer {
let data = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_09.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Smoke Basin", (2022, 00));
solution!("Smoke Basin", 9);

fn part_a(input: &str) -> Answer {
let data = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use common::{solution, Answer};

const CHARS: [(char, char); 4] = [('(', ')'), ('[', ']'), ('{', '}'), ('<', '>')];

solution!("Syntax Scoring", (2022, 00));
solution!("Syntax Scoring", 10);

fn part_a(input: &str) -> Answer {
let data = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_11.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Dumbo Octopus", (2022, 00));
solution!("Dumbo Octopus", 11);

fn part_a(input: &str) -> Answer {
let mut octopi = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use common::{solution, Answer};
use hashbrown::{HashMap, HashSet};
use petgraph::graph::{NodeIndex, UnGraph};

solution!("Passage Pathing", (2022, 00));
solution!("Passage Pathing", 12);

fn part_a(input: &str) -> Answer {
let graph = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use nd_vec::vector;

type Point = nd_vec::Vec2<usize>;

solution!("Transparent Origami", (2022, 00));
solution!("Transparent Origami", 13);

fn part_a(input: &str) -> Answer {
let mut paper = Paper::parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_14.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use hashbrown::HashMap;

use common::{solution, Answer};

solution!("Extended Polymerization", (2022, 00));
solution!("Extended Polymerization", 14);

fn part_a(input: &str) -> Answer {
process(input, 10).into()
Expand Down
2 changes: 1 addition & 1 deletion aoc_2021/src/day_15.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use common::{solution, Answer};
use hashbrown::HashMap;
use nd_vec::vector;

solution!("Chiton", (2022, 00));
solution!("Chiton", 15);

fn part_a(input: &str) -> Answer {
let matrix = Matrix::new_chars(input, |chr| chr.to_digit(10).unwrap() as u8);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_01.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Calorie Counting", (2022, 00));
solution!("Calorie Counting", 1);

fn part_a(input: &str) -> Answer {
let elfs = get_elfs(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_02.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Rock Paper Scissors", (2022, 00));
solution!("Rock Paper Scissors", 2);

fn part_a(input: &str) -> Answer {
let mut score = 0;
Expand Down
12 changes: 6 additions & 6 deletions aoc_2022/src/day_03.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ use hashbrown::HashSet;

use common::{solution, Answer};

solution!("Rucksack Reorganization", (2022, 00));
solution!("Rucksack Reorganization", 3);

fn part_a(input: &str) -> Answer {
let mut out = 0;

for i in input.trim().lines() {
let mut bolth = i[0..i.len() / 2].chars().collect::<Vec<_>>();
let mut both = i[0..i.len() / 2].chars().collect::<Vec<_>>();
let pocket_2 = i[i.len() / 2..].chars().collect::<Vec<_>>();
bolth.retain(|x| pocket_2.contains(x));
bolth.dedup();
both.retain(|x| pocket_2.contains(x));
both.dedup();

debug_assert!(bolth.len() == 1);
out += score_item(bolth[0]) as usize;
debug_assert!(both.len() == 1);
out += score_item(both[0]) as usize;
}

out.into()
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_04.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Camp Cleanup", (2022, 00));
solution!("Camp Cleanup", 4);

fn part_a(input: &str) -> Answer {
let mut out = 0;
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_05.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Supply Stacks", (2022, 00));
solution!("Supply Stacks", 5);

fn part_a(input: &str) -> Answer {
process(input, true).into()
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use hashbrown::HashSet;

use common::{solution, Answer};

solution!("Tuning Trouble", (2022, 00));
solution!("Tuning Trouble", 6);

fn part_a(input: &str) -> Answer {
process(input, 4).into()
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_07.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use hashbrown::HashSet;

use common::{solution, Answer};

solution!("No Space Left On Device", (2022, 00));
solution!("No Space Left On Device", 7);

fn part_a(input: &str) -> Answer {
process(input)
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_08.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Treetop Tree House", (2022, 00));
solution!("Treetop Tree House", 8);

fn part_a(input: &str) -> Answer {
let trees = parse_trees(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use nd_vec::vector;

type Point = nd_vec::Vec2<i32>;

solution!("Rope Bridge", (2022, 00));
solution!("Rope Bridge", 9);

fn part_a(input: &str) -> Answer {
process(input, 1).into()
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_10.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Cathode-Ray Tube", (2022, 00));
solution!("Cathode-Ray Tube", 10);

fn part_a(input: &str) -> Answer {
let instructions = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::VecDeque;

use common::{solution, Answer};

solution!("Monkey in the Middle", (2022, 00));
solution!("Monkey in the Middle", 11);

fn part_a(input: &str) -> Answer {
let monkeys = parse_monkeys(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use nd_vec::vector;

type Point = nd_vec::Vec2<usize>;

solution!("Hill Climbing Algorithm", (2022, 00));
solution!("Hill Climbing Algorithm", 12);

fn part_a(input: &str) -> Answer {
let map = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cmp::Ordering;

use common::{solution, Answer};

solution!("Distress Signal", (2022, 00));
solution!("Distress Signal", 13);

fn part_a(input: &str) -> Answer {
let signals = parse(input);
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_14.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use common::{solution, Answer};
use nd_vec::vector;

solution!("Regolith Reservoir", 14);

type Point = nd_vec::Vec2<usize>;

const NEW_POINT: Point = vector!(500, 0);

solution!("Regolith Reservoir", (2022, 00));

fn part_a(input: &str) -> Answer {
let mut world = World::parse(input);

Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_15.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use common::{solution, Answer};
use nd_vec::vector;
use rayon::prelude::*;

type Point = nd_vec::Vec2<isize>;
solution!("Beacon Exclusion Zone", 15);

solution!("Beacon Exclusion Zone", (2022, 00));
type Point = nd_vec::Vec2<isize>;

fn part_a(input: &str) -> Answer {
let world = World::parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use common::{solution, Answer};

use hashbrown::HashMap;

solution!("Proboscidea Volcanium", (2022, 00));
solution!("Proboscidea Volcanium", 16);

fn part_a(input: &str) -> Answer {
let parse = parse(input);
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_17.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use hashbrown::{hash_map::Entry, HashMap};
use common::{solution, Answer};
use nd_vec::vector;

type Point = nd_vec::Vec2<i64>;
solution!("Pyroclastic Flow", 17);

solution!("Pyroclastic Flow", (2022, 00));
type Point = nd_vec::Vec2<i64>;

fn part_a(input: &str) -> Answer {
let mut world = World::new(input);
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_18.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use hashbrown::HashSet;
use common::{solution, Answer};
use nd_vec::{vector, Vector};

type Pos = nd_vec::Vec3<i32>;
solution!("Boiling Boulders", 18);

solution!("Boiling Boulders", (2022, 00));
type Pos = nd_vec::Vec3<i32>;

fn part_a(input: &str) -> Answer {
let world = World::parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_19.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use common::{solution, Answer};
use hashbrown::HashMap;

solution!("Not Enough Minerals ", (2022, 00));
solution!("Not Enough Minerals", 19);

fn part_a(input: &str) -> Answer {
let robots = parse(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_20.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use common::{solution, Answer};

solution!("Grove Positioning System", (2022, 00));
solution!("Grove Positioning System", 20);

fn part_a(input: &str) -> Answer {
let mut file = File::new(input);
Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use hashbrown::HashMap;

use common::{solution, Answer};

solution!("Monkey Math", (2022, 00));
solution!("Monkey Math", 21);

fn part_a(input: &str) -> Answer {
let monkeys = MonkeyBusiness::new(input);
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::collections::VecDeque;

use common::{solution, Answer};

type Point = nd_vec::Vec2<isize>;
solution!("Monkey Map", 22);

solution!("Monkey Map", (2022, 00));
type Point = nd_vec::Vec2<isize>;

fn part_a(input: &str) -> Answer {
let mut world = World::parse(input);
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_23.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use hashbrown::{hash_map::Entry, HashMap, HashSet};
use common::{solution, Answer};
use nd_vec::vector;

type Point = nd_vec::Vec2<isize>;
solution!("Unstable Diffusion", 32);

solution!("Unstable Diffusion", (2022, 00));
type Point = nd_vec::Vec2<isize>;

fn part_a(input: &str) -> Answer {
let mut world = World::parse(input);
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_24.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use hashbrown::HashSet;
use nd_vec::{vector, Vec2};
use pathfinding::directed::bfs::bfs;

type Pos = Vec2<usize>;
solution!("Blizzard Basin", 24);

solution!("Blizzard Basin", (2022, 00));
type Pos = Vec2<usize>;

fn part_a(input: &str) -> Answer {
let basin = Basin::parse(input);
Expand Down
Loading

0 comments on commit ad8351e

Please sign in to comment.