Add new day script

This commit is contained in:
Gabriel Augendre 2020-12-16 08:11:32 +01:00
parent 3fe94bbb02
commit 144814eaed
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
2 changed files with 15 additions and 8 deletions

13
2020/new_day Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
set -euxo pipefail
if [[ $# -ne 2 ]]; then
>&2 echo "Usage: $0 <number> <python_module_name>"
exit 2
fi
filename=day$1_$2.py
cp template.py $filename
sed -e "s/dayXX/day$1/g" -i "" ./$filename
touch inputs/day$1
touch inputs/day$1-test1

View file

@ -1,8 +1,3 @@
import functools
import re
from typing import Dict, Iterable, List, Union
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
print(f"\n+ Running on {filename}")
with open(filename) as f:
@ -29,6 +24,5 @@ def solve_part_2(data):
if __name__ == "__main__":
main("inputs/day14-test1", 436)
main("inputs/day14-test2", 1)
main("inputs/day14")
main("inputs/dayXX-test1")
main("inputs/dayXX")