1
0
Fork 0

Improve template

This commit is contained in:
Lars Martens 2023-12-11 12:57:54 +01:00
parent ab7b9af735
commit 0035d5295c
Signed by: haselkern
GPG key ID: B5CF1F363C179AD4
2 changed files with 19 additions and 1 deletions

View file

@ -14,7 +14,7 @@ run:
# Begin working on todays problem. Downloads input, creates template and opens the problem and code. # Begin working on todays problem. Downloads input, creates template and opens the problem and code.
begin: _input-folder begin: _input-folder
echo "const INPUT: &str = include_str!(\"../../input/{{day}}\"); const TEST_INPUT: &str = include_str!(\"../../input/{{day}}-test\"); fn main() {}" >> {{file}} cp -n template.rs src/bin/{{day}}.rs
rustfmt {{file}} rustfmt {{file}}
curl --silent "https://adventofcode.com/{{year}}/day/{{dayWithout0}}/input" -H "Cookie: session=$AOC_SESSION" > "input/{{day}}" curl --silent "https://adventofcode.com/{{year}}/day/{{dayWithout0}}/input" -H "Cookie: session=$AOC_SESSION" > "input/{{day}}"
touch input/{{day}}-test touch input/{{day}}-test

18
template.rs Normal file
View file

@ -0,0 +1,18 @@
use aoc2023::*;
const INPUT: &str = include_str!("../../input/XX");
fn main() {
assert_example!(part1, "XX-test", 0);
println!("Part 1: {}", part1(INPUT));
assert_example!(part2, "XX-test", 0);
println!("Part 2: {}", part2(INPUT));
}
fn part1(input: &str) -> usize {
0
}
fn part2(input: &str) -> usize {
0
}