Skip to content

Commit 2476a98

Browse files
committed
chore: add CodingQuest.io (with problem 13)
1 parent e5a7d0b commit 2476a98

File tree

20 files changed

+315
-7
lines changed

20 files changed

+315
-7
lines changed

Cargo.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
22
resolver = "2"
3-
members = ["aoclp", "aoclp_solutions"]
3+
members = ["aoclp", "aoclp_solutions", "codingquest_clp", "codingquest_clp_solutions"]
44
default-members = ["aoclp_solutions"]
55

66
[workspace.dependencies]

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# adventofcode.rs
22

3-
My solutions to some of the [Advent of Code](https://adventofcode.com/) puzzles, using [Rust](https://www.rust-lang.org/).
3+
My solutions to some of the [Advent of Code](https://adventofcode.com/) and [Coding Quest](https://codingquest.io/) puzzles, using [Rust](https://www.rust-lang.org/).
4+
5+
(_Note to `Self`: The Coding Quest code should be moved to another repo_)

aoclp/src/positioning/pt_3d.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ where
2727
V: Into<T>,
2828
W: Into<T>,
2929
{
30-
/// Converts form a 3-number tuple to a [`Pt3D`].
30+
/// Converts form a 3-number tuple to a [`Pt3d`].
3131
fn from(value: (U, V, W)) -> Self {
3232
Self::new(value.0.into(), value.1.into(), value.2.into())
3333
}
@@ -37,7 +37,7 @@ impl<T, U, V, W> From<Pt3d<T>> for (U, V, W)
3737
where
3838
T: Into<U> + Into<V> + Into<W>,
3939
{
40-
/// Converts from a [`Pt3D`] to a 3-number tuple.
40+
/// Converts from a [`Pt3d`] to a 3-number tuple.
4141
fn from(value: Pt3d<T>) -> Self {
4242
(value.x.into(), value.y.into(), value.z.into())
4343
}
@@ -49,7 +49,7 @@ where
4949
{
5050
type Err = ();
5151

52-
/// Parses a [`Pt3D`] from a string in the form `(x, y, z)`.
52+
/// Parses a [`Pt3d`] from a string in the form `(x, y, z)`.
5353
/// Parentheses and whitespace are optional.
5454
fn from_str(s: &str) -> Result<Self, Self::Err> {
5555
static REGEX: OnceLock<Regex> = OnceLock::new();

aoclp_solutions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# aoclp_solutions
22

3-
My solutions to Advent of Code puzzles in Rust 🦀
3+
My solutions to [Advent of Code](https://adventofcode.com/) puzzles in Rust 🦀
44

55
## Requirements
66

aoclp_solutions/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Solutions to Advent of Code puzzles in Rust 🦀
1+
//! Solutions to [Advent of Code](https://adventofcode.com/) puzzles in Rust 🦀
22
33
#![allow(dead_code)]
44

codingquest_clp/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "codingquest_clp"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
aoclp = { path = "../aoclp" }
8+
itertools = { workspace = true }

codingquest_clp/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//! Helper library for Coding Quest.
2+
3+
pub mod solvers_impl;
4+
5+
pub type Error = aoclp::Error;
6+
pub type Result<T> = aoclp::Result<T>;
7+
8+
pub use aoclp;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod input;
2+
pub mod solvers;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use std::fs;
2+
use std::path::Path;
3+
4+
use aoclp::solvers_impl::input::Input;
5+
6+
pub fn get_input<S>(input: S) -> crate::Result<Input<'static>>
7+
where
8+
S: Into<String>,
9+
{
10+
Ok(Input::for_example(input))
11+
}
12+
13+
pub fn get_input_from_file<P>(path: P) -> crate::Result<Input<'static>>
14+
where
15+
P: AsRef<Path>,
16+
{
17+
get_input(fs::read_to_string(&path)?)
18+
}

0 commit comments

Comments
 (0)