Watch
1
0
Fork
You've already forked advent-of-code
0

Add day helper

CHECKPOINT
This commit is contained in:
Jeremy Kaplan 2022-12-02 22:29:54 -08:00
commit f53e0b0d00
2 changed files with 28 additions and 0 deletions

17
2022/day Executable file
View file

@ -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}"

View file

@ -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!()
}
}