-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoc
executable file
·45 lines (35 loc) · 830 Bytes
/
aoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/zsh
# Usage: ./aoc 5 [2023] [folder]
# downloads the input file; generates solution file; and opens it in pycharm.
export BETTER_EXCEPTIONS=1
DAY=$1
CURRENT_YEAR=$(date +%Y)
YEAR=${2:-$CURRENT_YEAR}
PATH_PREFIX=${2:+$2/}$DAY
INPUTFILE="$PATH_PREFIX.in"
OUTFILE="$PATH_PREFIX.py"
if [[ $# -eq 2 ]]
then
mkdir -p $YEAR
fi
./input_dl $DAY $YEAR $PATH_PREFIX
sample=$(head -5 $INPUTFILE | cut -c 1-60)
tm=$(date +%H:%M)
cat > $OUTFILE <<EOF
#!/usr/bin/env python3
from lib import *
# $tm
infile = sys.argv[1] if len(sys.argv)>1 else '$DAY.in'
f = open(infile, 'r') if infile != '-' else sys.stdin
lines = list(map(Input, f))
#data = Input(f.read())
#grid = Grid.from_text(data)
'''
$sample
'''
part1 = part2 = 0
print(f'Part 1: {part1}')
print(f'Part 2: {part2}')
EOF
chmod +x $OUTFILE
pycharm $OUTFILE $INPUTFILE