-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoc-templ.py
executable file
·91 lines (66 loc) · 1.62 KB
/
aoc-templ.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python3
import sys
import re
import aoclib
from aoclib import *
import q
import itertools as it
import math
import aocd
from typing import List, Tuple
from dataclasses import dataclass
from collections import defaultdict
def set_min_x(n: int):
global min_x
min_x = aoclib.min_x = n
def set_min_y(n: int):
global min_y
min_y = aoclib.min_y = n
def set_max_x(n: int):
global max_x
max_x = aoclib.max_x = n
def set_max_y(n: int):
global max_y
max_y = aoclib.max_y = n
def flip_x_y():
global max_x, max_y
max_x, max_y = max_y, max_x
aoclib.max_x = max_x
aoclib.max_y = max_y
year = "<<YEAR>>"
day = "<<DAY>>"
def run():
if len(sys.argv) > 1:
filename = sys.argv[1]
with open(filename) as file:
lines = [l.strip('\n') for l in file]
else:
filename = None
lines = aocd.get_data(year=year, day=day).split("\n")
print("len(lines)", len(lines))
print("len(lines[0])", len(lines[0]))
ans1 = 0
ans2 = 0
set_max_x(len(lines))
set_max_y(len(lines[0]))
############
# SOLUTION #
############
sections = get_sections(lines)
for sect in sections[0:]:
for l in sect:
pass
for l in lines:
pass
###########
print("1:", ans1)
print("2:", ans2)
if filename is None:
submit = input("submit?")
if 'y' in submit.lower():
if ans1 != 0:
aocd.submit(ans1, year=year, day=day, part="a")
if ans2 != 0:
aocd.submit(ans2, year=year, day=day, part="b")
if __name__ == "__main__":
run()