-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
9,529 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
[alias] | ||
xtask = "run --release --package xtask --" | ||
day = "run --release --package xtask -- day" | ||
2021 = "run --bin aoc-2021 --" | ||
2022 = "run --bin aoc-2022 --" | ||
r2021 = "run --release --bin aoc-2021 --" | ||
r2022 = "run --release --bin aoc-2022 --" | ||
2015 = "run --bin aoc_2015 --" | ||
2021 = "run --bin aoc_2021 --" | ||
2022 = "run --bin aoc_2022 --" | ||
r2015 = "run --release --bin aoc_2015 --" | ||
r2021 = "run --release --bin aoc_2021 --" | ||
r2022 = "run --release --bin aoc_2022 --" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/*/inputs/ | ||
/*/target/ | ||
target | ||
/crates/*/inputs/ | ||
/crates/*/target/ | ||
/target/ | ||
/crates/xtask/src/TOKEN | ||
/.idea/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
[workspace] | ||
members = [ | ||
"2021", | ||
"2022", | ||
"xtask", | ||
"util/*", | ||
"year/*" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## Running the benchmarks | ||
`cargo bench -p aoc-2021` | ||
`cargo bench -p aoc_2021` | ||
|
||
## Benches | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "aoc_common" | ||
version = "0.1.0" | ||
edition = "2021" | ||
build = false | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
anyhow = "1.0.62" | ||
num-bigint = "0.4.3" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod result; | ||
pub mod coords; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
use std::fmt::Display; | ||
|
||
use num_bigint::{BigInt, BigUint}; | ||
|
||
pub fn done<A: Into<AocD>, B: Into<AocD>>(a: A, b: B) -> AocResult { | ||
Ok((a.into(), b.into())) | ||
} | ||
|
||
pub type AocResult = anyhow::Result<(AocD, AocD)>; | ||
|
||
#[derive(Default, Debug, Clone)] | ||
pub enum AocD { | ||
#[default] | ||
Nothing, | ||
Number(usize), | ||
ULong(BigUint), | ||
Integer(isize), | ||
Long(BigInt), | ||
String(String), | ||
List(Vec<AocD>), | ||
} | ||
|
||
impl Display for AocD { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
use AocD::*; | ||
match self { | ||
Nothing => write!(f, "TODO"), | ||
Integer(n) => write!(f, "{n}"), | ||
Long(n) => write!(f, "{n}"), | ||
Number(n) => write!(f, "{n}"), | ||
String(s) => write!(f, "{s}"), | ||
ULong(n) => write!(f, "{n}"), | ||
List(l) => { | ||
write!(f, "[")?; | ||
let mut second = false; | ||
for x in l { | ||
if second { | ||
write!(f, ", ")?; | ||
} else { | ||
second = true; | ||
} | ||
write!(f, "{x}")?; | ||
} | ||
write!(f, "]") | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl From<()> for AocD { | ||
fn from(_: ()) -> Self { | ||
Self::Nothing | ||
} | ||
} | ||
|
||
impl From<Vec<AocD>> for AocD { | ||
fn from(v: Vec<AocD>) -> Self { | ||
Self::List(v) | ||
} | ||
} | ||
|
||
impl From<String> for AocD { | ||
fn from(v: String) -> Self { | ||
Self::String(v) | ||
} | ||
} | ||
|
||
impl From<BigInt> for AocD { | ||
fn from(v: BigInt) -> Self { | ||
Self::Long(v) | ||
} | ||
} | ||
|
||
impl From<isize> for AocD { | ||
fn from(v: isize) -> Self { | ||
Self::Integer(v) | ||
} | ||
} | ||
|
||
impl From<BigUint> for AocD { | ||
fn from(v: BigUint) -> Self { | ||
Self::ULong(v) | ||
} | ||
} | ||
|
||
impl From<usize> for AocD { | ||
fn from(v: usize) -> Self { | ||
Self::Number(v) | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
53616c7465645f5f4c9bdcd6d080dc8e543af5be4d06b6da11a3c411a7527125dba01f618c97eede9fc8a185711d44cd92df0c701db8a4e638467adf46fe2d3d |
Oops, something went wrong.