Skip to content

Commit

Permalink
Start on new solution system without dynamic dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed Nov 25, 2024
1 parent df3c817 commit aafcbcd
Show file tree
Hide file tree
Showing 71 changed files with 260 additions and 259 deletions.
4 changes: 2 additions & 2 deletions aoc_2021/src/day_01.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day01;

impl Solution for Day01 {
impl ISolution for Day01 {
fn name(&self) -> &'static str {
"Sonar Sweep"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_02.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day02;

impl Solution for Day02 {
impl ISolution for Day02 {
fn name(&self) -> &'static str {
"Dive!"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_03.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day03;

impl Solution for Day03 {
impl ISolution for Day03 {
fn name(&self) -> &'static str {
"Binary Diagnostic"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_04.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day04;

impl Solution for Day04 {
impl ISolution for Day04 {
fn name(&self) -> &'static str {
"Giant Squid"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_05.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

use hashbrown::HashMap;

pub struct Day05;

impl Solution for Day05 {
impl ISolution for Day05 {
fn name(&self) -> &'static str {
"Hydrothermal Venture"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_06.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

use std::hash::Hash;

use hashbrown::HashMap;

pub struct Day06;

impl Solution for Day06 {
impl ISolution for Day06 {
fn name(&self) -> &'static str {
"Lanternfish"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_07.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day07;

impl Solution for Day07 {
impl ISolution for Day07 {
fn name(&self) -> &'static str {
"The Treachery of Whales"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_08.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

use hashbrown::HashMap;

Expand All @@ -10,7 +10,7 @@ const DIGITS: [&str; 10] = [

pub struct Day08;

impl Solution for Day08 {
impl ISolution for Day08 {
fn name(&self) -> &'static str {
"Seven Segment Search"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_09.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day09;

impl Solution for Day09 {
impl ISolution for Day09 {
fn name(&self) -> &'static str {
"Smoke Basin"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_10.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

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

pub struct Day10;

impl Solution for Day10 {
impl ISolution for Day10 {
fn name(&self) -> &'static str {
"Syntax Scoring"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_11.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day11;

impl Solution for Day11 {
impl ISolution for Day11 {
fn name(&self) -> &'static str {
"Dumbo Octopus"
}
Expand Down
6 changes: 3 additions & 3 deletions aoc_2021/src/day_12.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};
use hashbrown::{HashMap, HashSet};
use petgraph::graph::{NodeIndex, UnGraph};

pub struct Day12;

impl Solution for Day12 {
impl ISolution for Day12 {
fn name(&self) -> &'static str {
"Passage Pathing"
}
Expand Down Expand Up @@ -103,7 +103,7 @@ fn parse(input: &str) -> ParseResult {

#[cfg(test)]
mod test {
use common::Solution;
use common::ISolution;
use indoc::indoc;

use super::Day12;
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_13.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use hashbrown::HashSet;

use common::{Answer, Solution};
use common::{Answer, ISolution};
use nd_vec::vector;

type Point = nd_vec::Vec2<usize>;

pub struct Day13;

impl Solution for Day13 {
impl ISolution for Day13 {
fn name(&self) -> &'static str {
"Transparent Origami"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/day_14.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use hashbrown::HashMap;

use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day14;

impl Solution for Day14 {
impl ISolution for Day14 {
fn name(&self) -> &'static str {
"Extended Polymerization"
}
Expand Down
6 changes: 3 additions & 3 deletions aoc_2021/src/day_15.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use aoc_lib::{direction::Direction, matrix::Matrix};
use common::{Answer, Solution};
use common::{Answer, ISolution};
use hashbrown::HashMap;
use nd_vec::vector;

pub struct Day15;

impl Solution for Day15 {
impl ISolution for Day15 {
fn name(&self) -> &'static str {
"Chiton"
}
Expand Down Expand Up @@ -51,7 +51,7 @@ impl Solution for Day15 {

#[cfg(test)]
mod test {
use common::Solution;
use common::ISolution;
use indoc::indoc;

use super::Day15;
Expand Down
4 changes: 2 additions & 2 deletions aoc_2021/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use common::Solution;
pub use common::ISolution;

mod day_01;
mod day_02;
Expand All @@ -17,7 +17,7 @@ mod day_14;
mod day_15;
// [import_marker]

pub const ALL: &[&dyn Solution] = &[
pub const ALL: &[&dyn ISolution] = &[
&day_01::Day01,
&day_02::Day02,
&day_03::Day03,
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_01.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day01;

impl Solution for Day01 {
impl ISolution for Day01 {
fn name(&self) -> &'static str {
"Calorie Counting"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_02.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day02;

impl Solution for Day02 {
impl ISolution for Day02 {
fn name(&self) -> &'static str {
"Rock Paper Scissors"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_03.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use hashbrown::HashSet;

use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day03;

impl Solution for Day03 {
impl ISolution for Day03 {
fn name(&self) -> &'static str {
"Rucksack Reorganization"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_04.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day04;

impl Solution for Day04 {
impl ISolution for Day04 {
fn name(&self) -> &'static str {
"Camp Cleanup"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_05.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day05;

impl Solution for Day05 {
impl ISolution for Day05 {
fn name(&self) -> &'static str {
"Supply Stacks"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_06.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use hashbrown::HashSet;

use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day06;

impl Solution for Day06 {
impl ISolution for Day06 {
fn name(&self) -> &'static str {
"Tuning Trouble"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_07.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use hashbrown::HashSet;

use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day07;

impl Solution for Day07 {
impl ISolution for Day07 {
fn name(&self) -> &'static str {
"No Space Left On Device"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_08.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day08;

impl Solution for Day08 {
impl ISolution for Day08 {
fn name(&self) -> &'static str {
"Treetop Tree House"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use std::vec;

use hashbrown::HashSet;

use common::{Answer, Solution};
use common::{Answer, ISolution};
use nd_vec::vector;

type Point = nd_vec::Vec2<i32>;

pub struct Day09;

impl Solution for Day09 {
impl ISolution for Day09 {
fn name(&self) -> &'static str {
"Rope Bridge"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_10.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day10;

impl Solution for Day10 {
impl ISolution for Day10 {
fn name(&self) -> &'static str {
"Cathode-Ray Tube"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_11.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::collections::VecDeque;

use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day11;

impl Solution for Day11 {
impl ISolution for Day11 {
fn name(&self) -> &'static str {
"Monkey in the Middle"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_12.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::collections::VecDeque;

use common::{Answer, Solution};
use common::{Answer, ISolution};
use nd_vec::vector;

type Point = nd_vec::Vec2<usize>;

pub struct Day12;

impl Solution for Day12 {
impl ISolution for Day12 {
fn name(&self) -> &'static str {
"Hill Climbing Algorithm"
}
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_13.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::cmp::Ordering;

use common::{Answer, Solution};
use common::{Answer, ISolution};

pub struct Day13;

impl Solution for Day13 {
impl ISolution for Day13 {
fn name(&self) -> &'static str {
"Distress Signal"
}
Expand Down
Loading

0 comments on commit aafcbcd

Please sign in to comment.