summaryrefslogtreecommitdiffstats
path: root/day8/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'day8/__init__.py')
-rw-r--r--day8/__init__.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/day8/__init__.py b/day8/__init__.py
new file mode 100644
index 0000000..21e18d2
--- /dev/null
+++ b/day8/__init__.py
@@ -0,0 +1,27 @@
1# -*- coding: utf-8 -*-
2from abc import ABC
3from typing import Iterator, Any, List
4
5from aoc import BaseAssignment
6
7
8class Assignment(BaseAssignment):
9 trees: List[str]
10
11 def row_at(self, y: int) -> List[int]:
12 return [int(i) for i in self.trees[y]]
13
14 def col_at(self, x: int):
15 return [int(i[x]) for i in self.trees]
16
17 def run(self, input: Iterator) -> Any:
18 self.trees = list(input)
19
20 width = len(self.trees[0])
21 height = len(self.trees)
22
23 return ((width - 1) * 2) + ((height - 1) * 2)
24
25
26class AssignmentOne(Assignment):
27 example_result = 21