-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.py
60 lines (43 loc) · 1.42 KB
/
template.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
from collections import defaultdict, deque, Counter
from itertools import combinations, combinations_with_replacement, permutations, product
from functools import reduce, cmp_to_key
from operator import add, mul, itemgetter, attrgetter
import os
from parse import parse
import sys
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, root_dir)
from aoc_elp import *
######################
SAMPLE_EXPECTED = None
######################
assert SAMPLE_EXPECTED != None, "Must enter sample value"
def parse_group(group):
lines = group.split("\n")
ret = []
for y, line in enumerate(lines):
line = line.strip()
assert len(line) != 0
split = line.split(" ")
for x, xc in enumerate(split):
pass
assert len(split) != 0
ret.append(split)
return ret
def parse_lines(raw):
# Groups.
# groups = raw.split("\n\n")
# Do something with the groups.
return parse_group(raw)
def solve(raw):
parsed = parse_lines(raw)
print(parsed)
ret = 0
return ret
if __name__ == "__main__":
SAMPLE, REAL = get_raw_inputs(sys.argv)
sample = solve(SAMPLE)
assert sample == SAMPLE_EXPECTED, "Sample Result %s != %s expected" % (sample, SAMPLE_EXPECTED)
print("\n*** SAMPLE PASSED ***\n")
solved = solve(REAL)
print("SOLUTION: ", solved)