diff --git a/2022/day b/2022/day new file mode 100755 index 0000000..10b7d10 --- /dev/null +++ b/2022/day @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +BASEDIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")") + +N=$(printf '%02d\n' "$1") + +input="${BASEDIR}/input/day${N}.txt" +bin="${BASEDIR}/src/bin/day${N}.rs" + +template="${BASEDIR}/src/bin/dayXX.rs.tmpl" + +touch "${input}" +sed "s/dayXX/day${N}/g" "${template}" > "${bin}" + +"${EDITOR}" -- "${input}" "${bin}" diff --git a/2022/src/bin/dayXX.rs.tmpl b/2022/src/bin/dayXX.rs.tmpl new file mode 100644 index 0000000..93cd8de --- /dev/null +++ b/2022/src/bin/dayXX.rs.tmpl @@ -0,0 +1,11 @@ +const INPUT: &str = include_str!("../../input/dayXX.txt"); + +fn main() { + println!("{}", part1(INPUT)); +} + +fn part1(input: &str) -> usize { + for line in input.split('\n').filter(|l| !l.is_empty()) { + todo!() + } +}